From 35f34f86872b9dfab92fd387255ff6ad4e51a117 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Mon, 23 Feb 2026 17:33:24 +1100 Subject: [PATCH 01/21] init aaz update --- .../azure/cli/core/aaz/_client.py | 3 +- .../azure/cli/core/aaz/_command.py | 100 ++++++++- .../azure/cli/core/aaz/_poller.py | 3 - .../network/aaz/latest/network/__init__.py | 5 - .../network/application_gateway/__init__.py | 12 -- .../address_pool/__init__.py | 8 - .../application_gateway/auth_cert/__init__.py | 8 - .../client_cert/__init__.py | 8 - .../frontend_ip/__init__.py | 8 - .../frontend_port/__init__.py | 8 - .../http_listener/__init__.py | 8 - .../http_settings/__init__.py | 8 - .../application_gateway/identity/__init__.py | 5 - .../application_gateway/listener/__init__.py | 8 - .../private_link/__init__.py | 7 - .../private_link/ip_config/__init__.py | 7 - .../application_gateway/probe/__init__.py | 8 - .../redirect_config/__init__.py | 8 - .../rewrite_rule/__init__.py | 10 - .../rewrite_rule/condition/__init__.py | 9 - .../rewrite_rule/set/__init__.py | 8 - .../application_gateway/root_cert/__init__.py | 8 - .../routing_rule/__init__.py | 8 - .../application_gateway/rule/__init__.py | 8 - .../application_gateway/settings/__init__.py | 8 - .../application_gateway/ssl_cert/__init__.py | 8 - .../ssl_policy/__init__.py | 6 - .../ssl_policy/predefined/__init__.py | 4 - .../ssl_profile/__init__.py | 8 - .../url_path_map/__init__.py | 8 - .../url_path_map/rule/__init__.py | 5 - .../waf_config/__init__.py | 4 - .../waf_policy/__init__.py | 8 - .../waf_policy/custom_rule/__init__.py | 7 - .../custom_rule/match_condition/__init__.py | 5 - .../waf_policy/managed_rule/__init__.py | 2 - .../managed_rule/exception/__init__.py | 3 - .../managed_rule/exclusion/__init__.py | 3 - .../waf_policy/policy_setting/__init__.py | 3 - .../aaz/latest/network/asg/__init__.py | 8 - .../aaz/latest/network/custom_ip/__init__.py | 2 - .../network/custom_ip/prefix/__init__.py | 8 - .../network/ddos_custom_policy/__init__.py | 7 - .../network/ddos_protection/__init__.py | 8 - .../aaz/latest/network/dns/__init__.py | 3 - .../network/dns/dnssec_config/__init__.py | 6 - .../latest/network/dns/record_set/__init__.py | 8 - .../aaz/latest/network/dns/zone/__init__.py | 7 - .../latest/network/express_route/__init__.py | 13 -- .../network/express_route/auth/__init__.py | 7 - .../network/express_route/gateway/__init__.py | 8 - .../gateway/connection/__init__.py | 8 - .../network/express_route/peering/__init__.py | 9 - .../peering/connection/__init__.py | 7 - .../connection/ipv6_config/__init__.py | 5 - .../peering/peer_connection/__init__.py | 4 - .../network/express_route/port/__init__.py | 9 - .../port/authorization/__init__.py | 8 - .../express_route/port/identity/__init__.py | 6 - .../express_route/port/link/__init__.py | 6 - .../express_route/port/location/__init__.py | 4 - .../network/aaz/latest/network/lb/__init__.py | 10 - .../network/lb/address_pool/__init__.py | 8 - .../lb/address_pool/address/__init__.py | 8 - .../network/lb/address_pool/basic/__init__.py | 4 - .../address_pool/tunnel_interface/__init__.py | 8 - .../latest/network/lb/frontend_ip/__init__.py | 8 - .../network/lb/inbound_nat_pool/__init__.py | 8 - .../network/lb/inbound_nat_rule/__init__.py | 8 - .../network/lb/outbound_rule/__init__.py | 8 - .../aaz/latest/network/lb/probe/__init__.py | 8 - .../aaz/latest/network/lb/rule/__init__.py | 8 - .../latest/network/local_gateway/__init__.py | 8 - .../aaz/latest/network/nat/__init__.py | 2 - .../latest/network/nat/gateway/__init__.py | 8 - .../network/network_watcher/__init__.py | 2 - .../connection_monitor/__init__.py | 7 - .../packet_capture/__init__.py | 8 - .../aaz/latest/network/nic/__init__.py | 10 - .../latest/network/nic/ip_config/__init__.py | 8 - .../network/nic/ip_config/ag_pool/__init__.py | 4 - .../ip_config/inbound_nat_rule/__init__.py | 5 - .../network/nic/ip_config/lb_pool/__init__.py | 4 - .../aaz/latest/network/nsg/__init__.py | 8 - .../aaz/latest/network/nsg/rule/__init__.py | 8 - .../network/private_endpoint/__init__.py | 9 - .../network/private_endpoint/asg/__init__.py | 6 - .../dns_zone_group/__init__.py | 9 - .../private_endpoint/ip_config/__init__.py | 6 - .../network/private_link_service/__init__.py | 9 - .../connection/__init__.py | 5 - .../aaz/latest/network/profile/__init__.py | 6 - .../aaz/latest/network/public_ip/__init__.py | 8 - .../public_ip/ddos_protection/__init__.py | 3 - .../network/public_ip/prefix/__init__.py | 8 - .../latest/network/route_filter/__init__.py | 8 - .../network/route_filter/rule/__init__.py | 9 - .../latest/network/route_table/__init__.py | 8 - .../network/route_table/route/__init__.py | 8 - .../latest/network/routeserver/__init__.py | 8 - .../network/routeserver/ip_config/__init__.py | 5 - .../network/routeserver/peering/__init__.py | 10 - .../security_partner_provider/__init__.py | 8 - .../network/service_endpoint/__init__.py | 3 - .../service_endpoint/policy/__init__.py | 8 - .../policy_definition/__init__.py | 8 - .../network/traffic_manager/__init__.py | 2 - .../traffic_manager/endpoint/__init__.py | 7 - .../traffic_manager/profile/__init__.py | 8 - .../network/virtual_appliance/__init__.py | 11 - .../virtual_appliance/connection/__init__.py | 6 - .../virtual_appliance/identity/__init__.py | 6 - .../inbound_security_rule/__init__.py | 4 - .../virtual_appliance/site/__init__.py | 8 - .../network/virtual_appliance/sku/__init__.py | 4 - .../virtual_network_appliance/__init__.py | 8 - .../aaz/latest/network/vnet/__init__.py | 10 - .../latest/network/vnet/peering/__init__.py | 8 - .../latest/network/vnet/subnet/__init__.py | 9 - .../latest/network/vnet_gateway/__init__.py | 20 -- .../network/vnet_gateway/aad/__init__.py | 5 - .../network/vnet_gateway/identity/__init__.py | 6 - .../vnet_gateway/ipsec_policy/__init__.py | 5 - .../vnet_gateway/migration/__init__.py | 6 - .../network/vnet_gateway/nat_rule/__init__.py | 6 - .../vnet_gateway/packet_capture/__init__.py | 4 - .../vnet_gateway/revoked_cert/__init__.py | 5 - .../vnet_gateway/root_cert/__init__.py | 5 - .../vnet_gateway/vpn_client/__init__.py | 6 - .../vpn_client/ipsec_policy/__init__.py | 4 - .../latest/network/vpn_connection/__init__.py | 10 - .../vpn_connection/ipsec_policy/__init__.py | 5 - .../vpn_connection/packet_capture/__init__.py | 4 - .../vpn_connection/shared_key/__init__.py | 5 - .../aaz/latest/network/watcher/__init__.py | 12 -- .../watcher/connection_monitor/__init__.py | 11 - .../connection_monitor/endpoint/__init__.py | 7 - .../connection_monitor/output/__init__.py | 5 - .../test_configuration/__init__.py | 7 - .../connection_monitor/test_group/__init__.py | 6 - .../network/watcher/flow_log/__init__.py | 9 - .../watcher/packet_capture/__init__.py | 9 - .../watcher/troubleshooting/__init__.py | 4 - .../cli/command_modules/network/commands.py | 28 +-- .../cli/command_modules/network/custom.py | 196 ++++++++++-------- .../command_modules/network/operations/dns.py | 9 +- .../network/operations/load_balancer.py | 56 +++-- .../command_modules/network/operations/nat.py | 3 +- .../operations/vnet_gateway_migration.py | 6 +- .../network/operations/watcher.py | 78 ++++--- 150 files changed, 311 insertions(+), 1148 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/aaz/_client.py b/src/azure-cli-core/azure/cli/core/aaz/_client.py index 4d39bedaab0..0455bc7679c 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_client.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_client.py @@ -8,7 +8,6 @@ from azure.core.polling.base_polling import LocationPolling, StatusCheckPolling from abc import abstractmethod -from ._poller import AAZNoPolling, AAZBasePolling from azure.cli.core.cloud import (CloudEndpointNotSetException, CloudSuffixNotSetException, CloudNameEnum as _CloudNameEnum) @@ -111,6 +110,7 @@ def send_request(self, request, stream=False, **kwargs): # pylint: disable=argu def build_lro_polling(self, no_wait, initial_session, deserialization_callback, error_callback, lro_options=None, path_format_arguments=None): from azure.core.polling.base_polling import OperationResourcePolling + from ._poller import AAZNoPolling, AAZBasePolling if no_wait == True: # noqa: E712, pylint: disable=singleton-comparison polling = AAZNoPolling() else: @@ -233,6 +233,7 @@ def _build_per_call_policies(cls, ctx, **kwargs): def build_lro_polling(self, no_wait, initial_session, deserialization_callback, error_callback, lro_options=None, path_format_arguments=None): from azure.mgmt.core.polling.arm_polling import AzureAsyncOperationPolling, BodyContentPolling + from ._poller import AAZNoPolling, AAZBasePolling if no_wait == True: # noqa: E712, pylint: disable=singleton-comparison polling = AAZNoPolling() else: diff --git a/src/azure-cli-core/azure/cli/core/aaz/_command.py b/src/azure-cli-core/azure/cli/core/aaz/_command.py index 577d8a7cf45..869454808db 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_command.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_command.py @@ -22,7 +22,6 @@ from ._base import AAZUndefined, AAZBaseValue from ._field_type import AAZObjectType from ._paging import AAZPaged -from ._poller import AAZLROPoller from ._command_ctx import AAZCommandCtx from .exceptions import AAZUnknownFieldError, AAZUnregisteredArg from .utils import get_aaz_profile_module_name @@ -235,6 +234,7 @@ def processor(schema, result): def build_lro_poller(self, executor, extract_result): """ Build AAZLROPoller instance to support long running operation """ + from ._poller import AAZLROPoller polling_generator = executor() if self.ctx.lro_no_wait: # run until yield the first polling @@ -389,20 +389,20 @@ def decorator(cls): def load_aaz_command_table(loader, aaz_pkg_name, args): """ This function is used in AzCommandsLoader.load_command_table. - It will load commands in module's aaz package. + It will load commands in module's aaz package using file-path based navigation. """ profile_pkg = _get_profile_pkg(aaz_pkg_name, loader.cli_ctx.cloud) command_table = {} command_group_table = {} - if args is None: - arg_str = '' - fully_load = True + if args is None or os.environ.get(AAZ_PACKAGE_FULL_LOAD_ENV_NAME, 'False').lower() == 'true': + effective_args = None # fully load else: - arg_str = ' '.join(args).lower() # Sometimes args may contain capital letters. - fully_load = os.environ.get(AAZ_PACKAGE_FULL_LOAD_ENV_NAME, 'False').lower() == 'true' # disable cut logic + effective_args = list(args) if profile_pkg is not None: - _load_aaz_pkg(loader, profile_pkg, command_table, command_group_table, arg_str, fully_load) + base_path = os.path.dirname(profile_pkg.__file__) + _load_aaz_by_path(loader, base_path, profile_pkg.__name__, effective_args, + command_table, command_group_table) for group_name, command_group in command_group_table.items(): loader.command_group_table[group_name] = command_group @@ -439,6 +439,90 @@ def _wrapper(cls): return _wrapper +def _try_import_module(relative_name, package): + """Try to import a module by relative name, return None on failure.""" + try: + return importlib.import_module(relative_name, package) + except (ModuleNotFoundError, ImportError): + logger.debug('Failed to import module %s relative to %s.', relative_name, package) + return None + + +def _register_from_module(loader, mod, command_table, command_group_table): + """Scan a module's namespace for AAZCommand/AAZCommandGroup classes and register them.""" + for value in mod.__dict__.values(): + if not isinstance(value, type): + continue + if issubclass(value, AAZCommandGroup) and value.AZ_NAME: + command_group_table[value.AZ_NAME] = value(cli_ctx=loader.cli_ctx) + elif issubclass(value, AAZCommand) and value.AZ_NAME: + command_table[value.AZ_NAME] = value(loader=loader) + + +def _load_aaz_by_path(loader, base_path, base_module, args, command_table, command_group_table): + """Recursively navigate the AAZ package tree guided by CLI args. + + - args is None → full recursive load of all commands under this directory. + - args has items → try to match first arg as a command file or sub-directory, + recurse with remaining args on match. + - args exhausted / no match → load current level's commands and sub-group headers. + + :param base_path: Filesystem path of the current package directory. + :param base_module: Dotted module name of the current package. + :param args: Remaining CLI args (list of str), or None for full load. + """ + if not os.path.isdir(base_path): + return + + if args is not None and args: + first_arg = args[0].lower().replace('-', '_') + + # First arg matches a command file (e.g. "create" → "_create.py") + cmd_file = os.path.join(base_path, f"_{first_arg}.py") + if os.path.isfile(cmd_file): + mod = _try_import_module(f"._{first_arg}", base_module) + if mod: + _register_from_module(loader, mod, command_table, command_group_table) + return + + # First arg matches a sub-directory (command group) + sub_dir = os.path.join(base_path, first_arg) + if os.path.isdir(sub_dir): + sub_module = f"{base_module}.{first_arg}" + mod = _try_import_module('.__cmd_group', sub_module) + if mod: + _register_from_module(loader, mod, command_table, command_group_table) + _load_aaz_by_path(loader, sub_dir, sub_module, args[1:], command_table, command_group_table) + return + + # Load __cmd_group + all command files at this level + mod = _try_import_module('.__cmd_group', base_module) + if mod: + _register_from_module(loader, mod, command_table, command_group_table) + + for entry in os.listdir(base_path): + entry_path = os.path.join(base_path, entry) + + # Command files: _create.py, _list.py, etc. + if (entry.startswith('_') and not entry.startswith('__') + and entry.endswith('.py') and os.path.isfile(entry_path)): + mod = _try_import_module(f'.{entry[:-3]}', base_module) + if mod: + _register_from_module(loader, mod, command_table, command_group_table) + + # Sub-directories + elif not entry.startswith('_') and os.path.isdir(entry_path): + sub_module = f"{base_module}.{entry}" + if args is None: + # Full load → recurse into every sub-directory + _load_aaz_by_path(loader, entry_path, sub_module, None, command_table, command_group_table) + else: + # Args exhausted / not matched → only load sub-group headers for help listing + mod = _try_import_module('.__cmd_group', sub_module) + if mod: + _register_from_module(loader, mod, command_table, command_group_table) + + def _load_aaz_pkg(loader, pkg, parent_command_table, command_group_table, arg_str, fully_load): """ Load aaz commands and aaz command groups under a package folder. """ diff --git a/src/azure-cli-core/azure/cli/core/aaz/_poller.py b/src/azure-cli-core/azure/cli/core/aaz/_poller.py index a45b540cb2b..0e6f3653b56 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_poller.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_poller.py @@ -12,9 +12,6 @@ from azure.core.polling.base_polling import LROBasePolling from azure.core.tracing.common import with_current_context from azure.core.tracing.decorator import distributed_trace -# import requests in main thread to resolve import deadlock between threads in python -# reference https://github.com/psf/requests/issues/2925 and https://github.com/Azure/azure-cli/issues/26272 -import requests # pylint: disable=unused-import _LOGGER = logging.getLogger(__name__) diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/__init__.py index dd6ee862156..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list_service_aliases import * -from ._list_service_tags import * -from ._list_usages import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/__init__.py index 30f3747a2fb..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/__init__.py @@ -7,15 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._health import * -from ._health_on_demand import * -from ._list import * -from ._show import * -from ._start import * -from ._stop import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/address_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/address_pool/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/address_pool/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/address_pool/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/auth_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/auth_cert/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/auth_cert/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/auth_cert/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/client_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/client_cert/__init__.py index 6a368bd6925..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/client_cert/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/client_cert/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_ip/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_ip/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_ip/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_port/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_port/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_port/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/frontend_port/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_listener/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_listener/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_listener/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_listener/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_settings/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_settings/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_settings/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/http_settings/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/identity/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/identity/__init__.py index 398d2342290..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/identity/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/identity/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._assign import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/listener/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/listener/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/listener/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/listener/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/__init__.py index 1f180acf0f8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/ip_config/__init__.py index 1f180acf0f8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/ip_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/private_link/ip_config/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/probe/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/probe/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/probe/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/probe/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/redirect_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/redirect_config/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/redirect_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/redirect_config/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/__init__.py index bc773126135..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/__init__.py @@ -7,13 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_request_headers import * -from ._list_response_headers import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/condition/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/condition/__init__.py index 5558a6c21f0..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/condition/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/condition/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_server_variables import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/set/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/set/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/set/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rewrite_rule/set/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/root_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/root_cert/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/root_cert/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/root_cert/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/routing_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/routing_rule/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/routing_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/routing_rule/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rule/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/rule/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/settings/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/settings/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/settings/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/settings/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_cert/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_cert/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_cert/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/__init__.py index 90499e5a6af..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list_options import * -from ._set import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/predefined/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/predefined/__init__.py index 2df85698253..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/predefined/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_policy/predefined/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_profile/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_profile/__init__.py index 6a368bd6925..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_profile/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/ssl_profile/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/rule/__init__.py index cf0f7e303bd..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/url_path_map/rule/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_config/__init__.py index 3b4943adc7f..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_config/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list_dynamic_rule_sets import * -from ._list_rule_sets import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/__init__.py index c401f439385..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py index 6d65f71f52e..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exception/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exception/__init__.py index 82b56d69810..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exception/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exception/__init__.py @@ -7,6 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exclusion/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exclusion/__init__.py index 82b56d69810..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exclusion/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/managed_rule/exclusion/__init__.py @@ -7,6 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/policy_setting/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/policy_setting/__init__.py index 8b77eb02118..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/policy_setting/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/policy_setting/__init__.py @@ -7,6 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/asg/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/asg/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/asg/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/asg/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/prefix/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/prefix/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/prefix/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/custom_ip/prefix/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_custom_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_custom_policy/__init__.py index a66fcaa1a56..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_custom_policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_custom_policy/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_protection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_protection/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_protection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/ddos_protection/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/__init__.py index 7d937d2e260..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/__init__.py @@ -7,6 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list_references import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/dnssec_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/dnssec_config/__init__.py index 1965d86a763..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/dnssec_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/dnssec_config/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/record_set/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/record_set/__init__.py index 3d2174ed2f2..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/record_set/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/record_set/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_by_type import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/zone/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/zone/__init__.py index c401f439385..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/zone/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/dns/zone/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/__init__.py index dc7537afca8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/__init__.py @@ -7,16 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._get_stats import * -from ._list import * -from ._list_arp_tables import * -from ._list_route_tables import * -from ._list_route_tables_summary import * -from ._list_service_providers import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/auth/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/auth/__init__.py index 2d1a2078686..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/auth/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/auth/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/connection/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/connection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/connection/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/__init__.py index 5f93e2265e3..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._get_stats import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/__init__.py index 2d1a2078686..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/ipv6_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/ipv6_config/__init__.py index 62e97d1b434..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/ipv6_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/connection/ipv6_config/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._remove import * -from ._set import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/peer_connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/peer_connection/__init__.py index 2df85698253..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/peer_connection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/peering/peer_connection/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/__init__.py index bdf6e7d8ebf..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._generate_loa import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/authorization/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/authorization/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/authorization/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/authorization/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/identity/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/identity/__init__.py index 3a074471e35..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/identity/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/identity/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._assign import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/link/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/link/__init__.py index 8287c45a4be..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/link/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/link/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/location/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/location/__init__.py index 2df85698253..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/location/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/port/location/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/__init__.py index 9f901c71872..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/__init__.py @@ -7,13 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_mapping import * -from ._list_nic import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/address/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/address/__init__.py index 6a368bd6925..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/address/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/address/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/basic/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/basic/__init__.py index fe1400d7322..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/basic/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/basic/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/tunnel_interface/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/tunnel_interface/__init__.py index 6a368bd6925..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/tunnel_interface/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/address_pool/tunnel_interface/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/frontend_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/frontend_ip/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/frontend_ip/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/frontend_ip/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_pool/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_pool/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_pool/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_rule/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/inbound_nat_rule/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/outbound_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/outbound_rule/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/outbound_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/outbound_rule/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/probe/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/probe/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/probe/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/probe/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/rule/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/lb/rule/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/local_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/local_gateway/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/local_gateway/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/local_gateway/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/gateway/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/gateway/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nat/gateway/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/connection_monitor/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/connection_monitor/__init__.py index 2d1a2078686..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/connection_monitor/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/connection_monitor/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/packet_capture/__init__.py index 6a05992cfef..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/packet_capture/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/network_watcher/packet_capture/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._query_status import * -from ._show import * -from ._stop import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/__init__.py index 7b725850ba8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/__init__.py @@ -7,13 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_effective_nsg import * -from ._show import * -from ._show_effective_route_table import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/ag_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/ag_pool/__init__.py index 0b07bb6fd96..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/ag_pool/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/ag_pool/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._remove import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/inbound_nat_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/inbound_nat_rule/__init__.py index 7767ee77098..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/inbound_nat_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/inbound_nat_rule/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._remove import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/lb_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/lb_pool/__init__.py index 0b07bb6fd96..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/lb_pool/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/ip_config/lb_pool/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._remove import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/rule/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/rule/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/__init__.py index 6fcd252319f..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_types import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/asg/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/asg/__init__.py index d4895df0486..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/asg/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/asg/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/dns_zone_group/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/dns_zone_group/__init__.py index 75707106567..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/dns_zone_group/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/dns_zone_group/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._create import * -from ._delete import * -from ._list import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/ip_config/__init__.py index d4895df0486..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/ip_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_endpoint/ip_config/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/__init__.py index 3d01b84640a..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_auto_approved import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/connection/__init__.py index 9ab38d3432f..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/connection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/private_link_service/connection/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._delete import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/profile/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/profile/__init__.py index f68091245a7..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/profile/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/profile/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._delete import * -from ._list import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/ddos_protection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/ddos_protection/__init__.py index 28d5f355813..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/ddos_protection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/ddos_protection/__init__.py @@ -7,6 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/prefix/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/prefix/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/prefix/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/prefix/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/rule/__init__.py index b00e0eb2de3..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_filter/rule/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_service_communities import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/route/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/route/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/route/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/route_table/route/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/ip_config/__init__.py index 7fccbe55080..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/ip_config/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/ip_config/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/peering/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/peering/__init__.py index c1cd9b6b75a..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/peering/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/routeserver/peering/__init__.py @@ -7,13 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_advertised_routes import * -from ._list_learned_routes import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/security_partner_provider/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/security_partner_provider/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/security_partner_provider/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/security_partner_provider/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/__init__.py index d63ae5a6fc9..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/__init__.py @@ -7,6 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy_definition/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy_definition/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy_definition/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/service_endpoint/policy_definition/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/__init__.py index 24707b6559b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._show import * -from ._show_geographic_hierarchy import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/profile/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/profile/__init__.py index d028234dbce..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/profile/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/profile/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._check_dns import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/__init__.py index 91db2849017..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/__init__.py @@ -7,14 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._get_boot_diagnostic_log import * -from ._list import * -from ._reimage import * -from ._restart import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/connection/__init__.py index 8287c45a4be..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/connection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/connection/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/identity/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/identity/__init__.py index 3a074471e35..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/identity/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/identity/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._assign import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/inbound_security_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/inbound_security_rule/__init__.py index 4fbda4a6e7a..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/inbound_security_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/inbound_security_rule/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/site/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/site/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/site/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/site/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/sku/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/sku/__init__.py index 2df85698253..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/sku/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/sku/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_network_appliance/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_network_appliance/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_network_appliance/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_network_appliance/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/__init__.py index c352aa0e33a..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/__init__.py @@ -7,13 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._check_ip_address import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_endpoint_services import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/peering/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/peering/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/peering/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/peering/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/subnet/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/subnet/__init__.py index 699d5eaf622..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/subnet/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet/subnet/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_available_delegations import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/__init__.py index d36e0dbe3c1..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/__init__.py @@ -7,23 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._disconnect_vpn_connections import * -from ._get_failover_all_tests_detail import * -from ._get_failover_single_test_detail import * -from ._get_resiliency_information import * -from ._get_routes_information import * -from ._list import * -from ._list_advertised_routes import * -from ._list_bgp_peer_status import * -from ._list_learned_routes import * -from ._reset import * -from ._show import * -from ._show_supported_devices import * -from ._start_site_failover_test import * -from ._stop_site_failover_test import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/aad/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/aad/__init__.py index 398d2342290..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/aad/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/aad/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._assign import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/identity/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/identity/__init__.py index 3a074471e35..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/identity/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/identity/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._assign import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/ipsec_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/ipsec_policy/__init__.py index 233ea53b2ea..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/ipsec_policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/ipsec_policy/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/migration/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/migration/__init__.py index d63e1abee3b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/migration/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/migration/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._abort import * -from ._commit import * -from ._execute import * -from ._prepare import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/nat_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/nat_rule/__init__.py index d4895df0486..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/nat_rule/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/nat_rule/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/packet_capture/__init__.py index cf3f2a3424c..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/packet_capture/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/packet_capture/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._start import * -from ._stop import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/revoked_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/revoked_cert/__init__.py index cf0f7e303bd..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/revoked_cert/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/revoked_cert/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/root_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/root_cert/__init__.py index cf0f7e303bd..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/root_cert/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/root_cert/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/__init__.py index cf4b661605e..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._generate import * -from ._generate_vpn_profile import * -from ._show_health import * -from ._show_url import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py index 4a524a853c8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._set import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/__init__.py index fe62f24fc09..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/__init__.py @@ -7,13 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._delete import * -from ._list import * -from ._list_connection import * -from ._list_ike_sas import * -from ._show import * -from ._show_device_config_script import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/ipsec_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/ipsec_policy/__init__.py index 233ea53b2ea..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/ipsec_policy/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/ipsec_policy/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/packet_capture/__init__.py index cf3f2a3424c..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/packet_capture/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/packet_capture/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._start import * -from ._stop import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/shared_key/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/shared_key/__init__.py index c7524bb868c..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/shared_key/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vpn_connection/shared_key/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._reset import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/__init__.py index 4f8deff3ba1..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/__init__.py @@ -7,15 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._run_configuration_diagnostic import * -from ._show_next_hop import * -from ._show_security_group_view import * -from ._show_topology import * -from ._test_connectivity import * -from ._test_ip_flow import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/__init__.py index 227ac9a27f4..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/__init__.py @@ -7,14 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._query import * -from ._show import * -from ._start import * -from ._stop import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/endpoint/__init__.py index 1f180acf0f8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/endpoint/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/endpoint/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/output/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/output/__init__.py index 233ea53b2ea..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/output/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/output/__init__.py @@ -7,8 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_configuration/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_configuration/__init__.py index 1f180acf0f8..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_configuration/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_configuration/__init__.py @@ -7,10 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._remove import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_group/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_group/__init__.py index 3f385cdeb37..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_group/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/connection_monitor/test_group/__init__.py @@ -7,9 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._add import * -from ._list import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/flow_log/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/flow_log/__init__.py index 1aaf3da6fc6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/flow_log/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/flow_log/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._configure_flow_log import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/packet_capture/__init__.py index 5a717484610..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/packet_capture/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/packet_capture/__init__.py @@ -7,12 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._show_status import * -from ._stop import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/troubleshooting/__init__.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/troubleshooting/__init__.py index 1a94969d1a6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/troubleshooting/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/watcher/troubleshooting/__init__.py @@ -7,7 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._show import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/network/commands.py b/src/azure-cli/azure/cli/command_modules/network/commands.py index 15127789a1b..ac657bcf409 100644 --- a/src/azure-cli/azure/cli/command_modules/network/commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/commands.py @@ -441,7 +441,7 @@ def load_command_table(self, _): with self.command_group('network cross-region-lb') as g: g.custom_command('create', 'create_cross_region_load_balancer', transform=DeploymentOutputLongRunningOperation(self.cli_ctx), supports_no_wait=True, table_transformer=deployment_validate_table_format, validator=process_cross_region_lb_create_namespace, exception_handler=handle_template_based_exception) - from .aaz.latest.network.lb import Wait + from .aaz.latest.network.lb._wait import Wait from .operations.load_balancer import CrossRegionLoadBalancerShow, CrossRegionLoadBalancerDelete, CrossRegionLoadBalancerUpdate, CrossRegionLoadBalancerList self.command_table['network cross-region-lb show'] = CrossRegionLoadBalancerShow(loader=self) self.command_table['network cross-region-lb delete'] = CrossRegionLoadBalancerDelete(loader=self) @@ -484,13 +484,14 @@ def load_command_table(self, _): # region LocalGateways with self.command_group('network local-gateway'): - from .aaz.latest.network.local_gateway import List + from .aaz.latest.network.local_gateway._list import List self.command_table['network local-gateway list'] = List(loader=self, table_transformer=transform_local_gateway_table_output) # endregion # region NetworkInterfaces: (NIC) with self.command_group("network nic"): - from .aaz.latest.network.nic import ListEffectiveNsg, ShowEffectiveRouteTable + from .aaz.latest.network.nic._list_effective_nsg import ListEffectiveNsg + from .aaz.latest.network.nic._show_effective_route_table import ShowEffectiveRouteTable from .custom import NICCreate, NICUpdate self.command_table["network nic create"] = NICCreate(loader=self) self.command_table["network nic update"] = NICUpdate(loader=self) @@ -516,7 +517,7 @@ def load_command_table(self, _): with self.command_group("network nsg rule") as g: from .custom import NSGRuleCreate, NSGRuleUpdate - from .aaz.latest.network.nsg.rule import Show + from .aaz.latest.network.nsg.rule._show import Show self.command_table["network nsg rule create"] = NSGRuleCreate(loader=self) self.command_table["network nsg rule update"] = NSGRuleUpdate(loader=self) self.command_table["network nsg rule show"] = Show(loader=self, table_transformer=transform_nsg_rule_table_output) @@ -610,7 +611,8 @@ def load_command_table(self, _): public_ip_show_table_transform = public_ip_show_table_transform.replace('$zone$', 'Zones: (!zones && \' \') || join(` `, zones), ') with self.command_group('network public-ip') as g: - from .aaz.latest.network.public_ip import List, Show + from .aaz.latest.network.public_ip._list import List + from .aaz.latest.network.public_ip._show import Show from .custom import PublicIPUpdate self.command_table['network public-ip update'] = PublicIPUpdate(loader=self) self.command_table['network public-ip list'] = List(loader=self, table_transformer='[].' + public_ip_show_table_transform) @@ -623,7 +625,7 @@ def load_command_table(self, _): # endregion # region RouteFilters - from azure.cli.command_modules.network.aaz.latest.network.route_filter.rule import ListServiceCommunities + from .aaz.latest.network.route_filter.rule._list_service_communities import ListServiceCommunities self.command_table['network route-filter rule list-service-communities'] = ListServiceCommunities(loader=self, table_transformer=transform_service_community_table_output) # endregion @@ -637,13 +639,13 @@ def load_command_table(self, _): g.custom_command('update', 'update_traffic_manager_endpoint') g.custom_command('list', 'list_traffic_manager_endpoints') - from azure.cli.command_modules.network.aaz.latest.network.traffic_manager.endpoint import ShowGeographicHierarchy + from .aaz.latest.network.traffic_manager.endpoint._show_geographic_hierarchy import ShowGeographicHierarchy self.command_table['network traffic-manager endpoint show-geographic-hierarchy'] = ShowGeographicHierarchy(loader=self, table_transformer=transform_geographic_hierachy_table_output) # endregion # region VirtualNetworks with self.command_group("network vnet") as g: - from .aaz.latest.network.vnet import List + from .aaz.latest.network.vnet._list import List from .custom import VNetCreate, VNetUpdate self.command_table["network vnet create"] = VNetCreate(loader=self) self.command_table["network vnet update"] = VNetUpdate(loader=self) @@ -665,7 +667,9 @@ def load_command_table(self, _): # region VirtualNetworkGateways with self.command_group('network vnet-gateway'): from .custom import VnetGatewayCreate, VnetGatewayUpdate, VnetGatewayVpnConnectionsDisconnect, VNetGatewayShow, VNetGatewayList - from .aaz.latest.network.vnet_gateway import ListBgpPeerStatus, ListAdvertisedRoutes, ListLearnedRoutes + from .aaz.latest.network.vnet_gateway._list_bgp_peer_status import ListBgpPeerStatus + from .aaz.latest.network.vnet_gateway._list_advertised_routes import ListAdvertisedRoutes + from .aaz.latest.network.vnet_gateway._list_learned_routes import ListLearnedRoutes self.command_table['network vnet-gateway create'] = VnetGatewayCreate(loader=self) self.command_table['network vnet-gateway update'] = VnetGatewayUpdate(loader=self) self.command_table['network vnet-gateway disconnect-vpn-connections'] = VnetGatewayVpnConnectionsDisconnect(loader=self) @@ -684,14 +688,14 @@ def load_command_table(self, _): self.command_table['network vnet-gateway migration prepare'] = VNetGatewayMigrationPrepare(loader=self) with self.command_group('network vnet-gateway packet-capture'): - from .aaz.latest.network.vnet_gateway import Wait + from .aaz.latest.network.vnet_gateway._wait import Wait self.command_table['network vnet-gateway packet-capture wait'] = Wait(loader=self) with self.command_group('network vnet-gateway vpn-client') as g: g.custom_command('generate', 'generate_vpn_client') with self.command_group('network vnet-gateway vpn-client ipsec-policy'): - from .aaz.latest.network.vnet_gateway import Wait + from .aaz.latest.network.vnet_gateway._wait import Wait self.command_table['network vnet-gateway vpn-client ipsec-policy wait'] = Wait(loader=self) with self.command_group('network vnet-gateway revoked-cert'): @@ -738,7 +742,7 @@ def load_command_table(self, _): with self.command_group('network vpn-connection packet-capture'): from .custom import VpnConnPackageCaptureStop - from .aaz.latest.network.vpn_connection import Wait + from .aaz.latest.network.vpn_connection._wait import Wait self.command_table['network vpn-connection packet-capture stop'] = VpnConnPackageCaptureStop(loader=self) self.command_table['network vpn-connection packet-capture wait'] = Wait(loader=self) # endregion diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 2813ad8cd04..2d92872fdfd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -25,93 +25,115 @@ from azure.cli.command_modules.network.zone_file.parse_zone_file import parse_zone_file from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone_file -from .aaz.latest.network import ListUsages as _UsagesList -from .aaz.latest.network.application_gateway import Update as _ApplicationGatewayUpdate -from .aaz.latest.network.application_gateway.address_pool import Create as _AddressPoolCreate, \ - Update as _AddressPoolUpdate -from .aaz.latest.network.application_gateway.auth_cert import Create as _AuthCertCreate, Update as _AuthCertUpdate -from .aaz.latest.network.application_gateway.client_cert import Add as _ClientCertAdd, Update as _ClientCertUpdate -from .aaz.latest.network.application_gateway.frontend_ip import Create as _FrontendIPCreate, Update as _FrontendIPUpdate -from .aaz.latest.network.application_gateway.http_listener import Create as _HTTPListenerCreate, \ - Update as _HTTPListenerUpdate -from .aaz.latest.network.application_gateway.http_settings import Create as _HTTPSettingsCreate, \ - Update as _HTTPSettingsUpdate -from .aaz.latest.network.application_gateway.identity import Assign as _IdentityAssign -from .aaz.latest.network.application_gateway.private_link import Add as _AGPrivateLinkAdd, \ - Remove as _AGPrivateLinkRemove -from .aaz.latest.network.application_gateway.private_link.ip_config import Add as _AGPrivateLinkIPConfigAdd -from .aaz.latest.network.application_gateway.listener import Create as _ListenerCreate, Update as _ListenerUpdate -from .aaz.latest.network.application_gateway.redirect_config import Create as _RedirectConfigCreate, \ - Update as _RedirectConfigUpdate -from .aaz.latest.network.application_gateway.rewrite_rule import Create as _AGRewriteRuleCreate, \ - Update as _AGRewriteRuleUpdate -from .aaz.latest.network.application_gateway.root_cert import Create as _RootCertCreate, Update as _RootCertUpdate -from .aaz.latest.network.application_gateway.routing_rule import Create as _RoutingRuleCreate, \ - Update as _RoutingRuleUpdate -from .aaz.latest.network.application_gateway.rule import Create as _RuleCreate, Update as _RuleUpdate -from .aaz.latest.network.application_gateway.settings import Create as _SettingsCreate, Update as _SettingsUpdate -from .aaz.latest.network.application_gateway.ssl_cert import Create as _SSLCertCreate, Update as _SSLCertUpdate -from .aaz.latest.network.application_gateway.ssl_policy import Set as _SSLPolicySet -from .aaz.latest.network.application_gateway.ssl_profile import Add as _SSLProfileAdd, Update as _SSLProfileUpdate -from .aaz.latest.network.application_gateway.url_path_map import Create as _URLPathMapCreate, \ - Update as _URLPathMapUpdate -from .aaz.latest.network.application_gateway.url_path_map.rule import Create as _URLPathMapRuleCreate -from .aaz.latest.network.application_gateway.waf_policy import Create as _WAFCreate -from .aaz.latest.network.application_gateway.waf_policy.custom_rule.match_condition import \ - Add as _WAFCustomRuleMatchConditionAdd -from .aaz.latest.network.application_gateway.waf_policy.policy_setting import Update as _WAFPolicySettingUpdate -from .aaz.latest.network.custom_ip.prefix import Create as _CustomIpPrefixCreate, Update as _CustomIpPrefixUpdate -from .aaz.latest.network.ddos_custom_policy import Update as _DdosCustomPolicyUpdate -from .aaz.latest.network.dns.record_set import List as _DNSRecordSetListByZone -from .aaz.latest.network.dns.zone import Create as _DNSZoneCreate -from .aaz.latest.network.express_route import Create as _ExpressRouteCreate, Update as _ExpressRouteUpdate -from .aaz.latest.network.express_route.gateway import Create as _ExpressRouteGatewayCreate, \ - Update as _ExpressRouteGatewayUpdate -from .aaz.latest.network.express_route.gateway.connection import Create as _ExpressRouteConnectionCreate, \ - Update as _ExpressRouteConnectionUpdate -from .aaz.latest.network.express_route.peering import Create as _ExpressRoutePeeringCreate, \ - Update as _ExpressRoutePeeringUpdate -from .aaz.latest.network.express_route.peering.connection import Create as _ExpressRoutePeeringConnectionCreate -from .aaz.latest.network.express_route.port import Create as _ExpressRoutePortCreate -from .aaz.latest.network.express_route.port.identity import Assign as _ExpressRoutePortIdentityAssign -from .aaz.latest.network.express_route.port.link import Update as _ExpressRoutePortLinkUpdate -from .aaz.latest.network.nic import Create as _NICCreate, Update as _NICUpdate -from .aaz.latest.network.nic.ip_config import Create as _NICIPConfigCreate, Update as _NICIPConfigUpdate -from .aaz.latest.network.nic.ip_config.inbound_nat_rule import Add as _NICIPConfigNATAdd, \ - Remove as _NICIPConfigNATRemove -from .aaz.latest.network.nsg import Create as _NSGCreate -from .aaz.latest.network.nsg.rule import Create as _NSGRuleCreate, Update as _NSGRuleUpdate -from .aaz.latest.network.public_ip import Create as _PublicIPCreate, Update as _PublicIPUpdate -from .aaz.latest.network.private_endpoint import Create as _PrivateEndpointCreate, Update as _PrivateEndpointUpdate -from .aaz.latest.network.private_endpoint.asg import Add as _PrivateEndpointAsgAdd -from .aaz.latest.network.private_endpoint.dns_zone_group import Create as _PrivateEndpointPrivateDnsZoneGroupCreate, \ - Add as _PrivateEndpointPrivateDnsZoneAdd -from .aaz.latest.network.private_endpoint.ip_config import Add as _PrivateEndpointIpConfigAdd -from .aaz.latest.network.private_link_service import Create as _PrivateLinkServiceCreate, \ - Update as _PrivateLinkServiceUpdate -from .aaz.latest.network.private_link_service.connection import Update as _PrivateEndpointConnectionUpdate -from .aaz.latest.network.public_ip.prefix import Create as _PublicIpPrefixCreate -from .aaz.latest.network.security_partner_provider import Create as _SecurityPartnerProviderCreate, \ - Update as _SecurityPartnerProviderUpdate -from .aaz.latest.network.virtual_appliance import Create as _VirtualApplianceCreate, Update as _VirtualApplianceUpdate -from .aaz.latest.network.vnet import Create as _VNetCreate, Update as _VNetUpdate -from .aaz.latest.network.vnet.peering import Create as _VNetPeeringCreate -from .aaz.latest.network.vnet.subnet import Create as _VNetSubnetCreate, Update as _VNetSubnetUpdate -from .aaz.latest.network.vnet_gateway import Create as _VnetGatewayCreate, Update as _VnetGatewayUpdate, \ - DisconnectVpnConnections as _VnetGatewayVpnConnectionsDisconnect, Show as _VNetGatewayShow, List as _VNetGatewayList -from .aaz.latest.network.vnet_gateway.aad import Assign as _VnetGatewayAadAssign -from .aaz.latest.network.vnet_gateway.ipsec_policy import Add as _VnetGatewayIpsecPolicyAdd -from .aaz.latest.network.vnet_gateway.nat_rule import Add as _VnetGatewayNatRuleAdd, List as _VnetGatewayNatRuleShow, \ - Remove as _VnetGatewayNatRuleRemove -from .aaz.latest.network.vnet_gateway.revoked_cert import Create as _VnetGatewayRevokedCertCreate -from .aaz.latest.network.vnet_gateway.root_cert import Create as _VnetGatewayRootCertCreate -from .aaz.latest.network.vnet_gateway.vpn_client import GenerateVpnProfile as _VpnProfileGenerate, \ - Generate as _VpnClientPackageGenerate -from .aaz.latest.network.vpn_connection import Update as _VpnConnectionUpdate, \ - ShowDeviceConfigScript as _VpnConnectionDeviceConfigScriptShow -from .aaz.latest.network.vpn_connection.ipsec_policy import Add as _VpnConnIpsecPolicyAdd -from .aaz.latest.network.vpn_connection.packet_capture import Stop as _VpnConnPackageCaptureStop -from .aaz.latest.network.vpn_connection.shared_key import Update as _VpnConnSharedKeyUpdate +from .aaz.latest.network._list_usages import ListUsages as _UsagesList +from .aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate +from .aaz.latest.network.application_gateway.address_pool._create import Create as _AddressPoolCreate +from .aaz.latest.network.application_gateway.address_pool._update import Update as _AddressPoolUpdate +from .aaz.latest.network.application_gateway.auth_cert._create import Create as _AuthCertCreate +from .aaz.latest.network.application_gateway.auth_cert._update import Update as _AuthCertUpdate +from .aaz.latest.network.application_gateway.client_cert._add import Add as _ClientCertAdd +from .aaz.latest.network.application_gateway.client_cert._update import Update as _ClientCertUpdate +from .aaz.latest.network.application_gateway.frontend_ip._create import Create as _FrontendIPCreate +from .aaz.latest.network.application_gateway.frontend_ip._update import Update as _FrontendIPUpdate +from .aaz.latest.network.application_gateway.http_listener._create import Create as _HTTPListenerCreate +from .aaz.latest.network.application_gateway.http_listener._update import Update as _HTTPListenerUpdate +from .aaz.latest.network.application_gateway.http_settings._create import Create as _HTTPSettingsCreate +from .aaz.latest.network.application_gateway.http_settings._update import Update as _HTTPSettingsUpdate +from .aaz.latest.network.application_gateway.identity._assign import Assign as _IdentityAssign +from .aaz.latest.network.application_gateway.private_link._add import Add as _AGPrivateLinkAdd +from .aaz.latest.network.application_gateway.private_link._remove import Remove as _AGPrivateLinkRemove +from .aaz.latest.network.application_gateway.private_link.ip_config._add import Add as _AGPrivateLinkIPConfigAdd +from .aaz.latest.network.application_gateway.listener._create import Create as _ListenerCreate +from .aaz.latest.network.application_gateway.listener._update import Update as _ListenerUpdate +from .aaz.latest.network.application_gateway.redirect_config._create import Create as _RedirectConfigCreate +from .aaz.latest.network.application_gateway.redirect_config._update import Update as _RedirectConfigUpdate +from .aaz.latest.network.application_gateway.rewrite_rule._create import Create as _AGRewriteRuleCreate +from .aaz.latest.network.application_gateway.rewrite_rule._update import Update as _AGRewriteRuleUpdate +from .aaz.latest.network.application_gateway.root_cert._create import Create as _RootCertCreate +from .aaz.latest.network.application_gateway.root_cert._update import Update as _RootCertUpdate +from .aaz.latest.network.application_gateway.routing_rule._create import Create as _RoutingRuleCreate +from .aaz.latest.network.application_gateway.routing_rule._update import Update as _RoutingRuleUpdate +from .aaz.latest.network.application_gateway.rule._create import Create as _RuleCreate +from .aaz.latest.network.application_gateway.rule._update import Update as _RuleUpdate +from .aaz.latest.network.application_gateway.settings._create import Create as _SettingsCreate +from .aaz.latest.network.application_gateway.settings._update import Update as _SettingsUpdate +from .aaz.latest.network.application_gateway.ssl_cert._create import Create as _SSLCertCreate +from .aaz.latest.network.application_gateway.ssl_cert._update import Update as _SSLCertUpdate +from .aaz.latest.network.application_gateway.ssl_policy._set import Set as _SSLPolicySet +from .aaz.latest.network.application_gateway.ssl_profile._add import Add as _SSLProfileAdd +from .aaz.latest.network.application_gateway.ssl_profile._update import Update as _SSLProfileUpdate +from .aaz.latest.network.application_gateway.url_path_map._create import Create as _URLPathMapCreate +from .aaz.latest.network.application_gateway.url_path_map._update import Update as _URLPathMapUpdate +from .aaz.latest.network.application_gateway.url_path_map.rule._create import Create as _URLPathMapRuleCreate +from .aaz.latest.network.application_gateway.waf_policy._create import Create as _WAFCreate +from .aaz.latest.network.application_gateway.waf_policy.custom_rule.match_condition._add import Add as _WAFCustomRuleMatchConditionAdd +from .aaz.latest.network.application_gateway.waf_policy.policy_setting._update import Update as _WAFPolicySettingUpdate +from .aaz.latest.network.custom_ip.prefix._create import Create as _CustomIpPrefixCreate +from .aaz.latest.network.custom_ip.prefix._update import Update as _CustomIpPrefixUpdate +from .aaz.latest.network.ddos_custom_policy._update import Update as _DdosCustomPolicyUpdate +from .aaz.latest.network.dns.record_set._list import List as _DNSRecordSetListByZone +from .aaz.latest.network.dns.zone._create import Create as _DNSZoneCreate +from .aaz.latest.network.express_route._create import Create as _ExpressRouteCreate +from .aaz.latest.network.express_route._update import Update as _ExpressRouteUpdate +from .aaz.latest.network.express_route.gateway._create import Create as _ExpressRouteGatewayCreate +from .aaz.latest.network.express_route.gateway._update import Update as _ExpressRouteGatewayUpdate +from .aaz.latest.network.express_route.gateway.connection._create import Create as _ExpressRouteConnectionCreate +from .aaz.latest.network.express_route.gateway.connection._update import Update as _ExpressRouteConnectionUpdate +from .aaz.latest.network.express_route.peering._create import Create as _ExpressRoutePeeringCreate +from .aaz.latest.network.express_route.peering._update import Update as _ExpressRoutePeeringUpdate +from .aaz.latest.network.express_route.peering.connection._create import Create as _ExpressRoutePeeringConnectionCreate +from .aaz.latest.network.express_route.port._create import Create as _ExpressRoutePortCreate +from .aaz.latest.network.express_route.port.identity._assign import Assign as _ExpressRoutePortIdentityAssign +from .aaz.latest.network.express_route.port.link._update import Update as _ExpressRoutePortLinkUpdate +from .aaz.latest.network.nic._create import Create as _NICCreate +from .aaz.latest.network.nic._update import Update as _NICUpdate +from .aaz.latest.network.nic.ip_config._create import Create as _NICIPConfigCreate +from .aaz.latest.network.nic.ip_config._update import Update as _NICIPConfigUpdate +from .aaz.latest.network.nic.ip_config.inbound_nat_rule._add import Add as _NICIPConfigNATAdd +from .aaz.latest.network.nic.ip_config.inbound_nat_rule._remove import Remove as _NICIPConfigNATRemove +from .aaz.latest.network.nsg._create import Create as _NSGCreate +from .aaz.latest.network.nsg.rule._create import Create as _NSGRuleCreate +from .aaz.latest.network.nsg.rule._update import Update as _NSGRuleUpdate +from .aaz.latest.network.public_ip._create import Create as _PublicIPCreate +from .aaz.latest.network.public_ip._update import Update as _PublicIPUpdate +from .aaz.latest.network.private_endpoint._create import Create as _PrivateEndpointCreate +from .aaz.latest.network.private_endpoint._update import Update as _PrivateEndpointUpdate +from .aaz.latest.network.private_endpoint.asg._add import Add as _PrivateEndpointAsgAdd +from .aaz.latest.network.private_endpoint.dns_zone_group._create import Create as _PrivateEndpointPrivateDnsZoneGroupCreate +from .aaz.latest.network.private_endpoint.dns_zone_group._add import Add as _PrivateEndpointPrivateDnsZoneAdd +from .aaz.latest.network.private_endpoint.ip_config._add import Add as _PrivateEndpointIpConfigAdd +from .aaz.latest.network.private_link_service._create import Create as _PrivateLinkServiceCreate +from .aaz.latest.network.private_link_service._update import Update as _PrivateLinkServiceUpdate +from .aaz.latest.network.private_link_service.connection._update import Update as _PrivateEndpointConnectionUpdate +from .aaz.latest.network.public_ip.prefix._create import Create as _PublicIpPrefixCreate +from .aaz.latest.network.security_partner_provider._create import Create as _SecurityPartnerProviderCreate +from .aaz.latest.network.security_partner_provider._update import Update as _SecurityPartnerProviderUpdate +from .aaz.latest.network.virtual_appliance._create import Create as _VirtualApplianceCreate +from .aaz.latest.network.virtual_appliance._update import Update as _VirtualApplianceUpdate +from .aaz.latest.network.vnet._create import Create as _VNetCreate +from .aaz.latest.network.vnet._update import Update as _VNetUpdate +from .aaz.latest.network.vnet.peering._create import Create as _VNetPeeringCreate +from .aaz.latest.network.vnet.subnet._create import Create as _VNetSubnetCreate +from .aaz.latest.network.vnet.subnet._update import Update as _VNetSubnetUpdate +from .aaz.latest.network.vnet_gateway._create import Create as _VnetGatewayCreate +from .aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate +from .aaz.latest.network.vnet_gateway._disconnect_vpn_connections import DisconnectVpnConnections as _VnetGatewayVpnConnectionsDisconnect +from .aaz.latest.network.vnet_gateway._show import Show as _VNetGatewayShow +from .aaz.latest.network.vnet_gateway._list import List as _VNetGatewayList +from .aaz.latest.network.vnet_gateway.aad._assign import Assign as _VnetGatewayAadAssign +from .aaz.latest.network.vnet_gateway.ipsec_policy._add import Add as _VnetGatewayIpsecPolicyAdd +from .aaz.latest.network.vnet_gateway.nat_rule._add import Add as _VnetGatewayNatRuleAdd +from .aaz.latest.network.vnet_gateway.nat_rule._list import List as _VnetGatewayNatRuleShow +from .aaz.latest.network.vnet_gateway.nat_rule._remove import Remove as _VnetGatewayNatRuleRemove +from .aaz.latest.network.vnet_gateway.revoked_cert._create import Create as _VnetGatewayRevokedCertCreate +from .aaz.latest.network.vnet_gateway.root_cert._create import Create as _VnetGatewayRootCertCreate +from .aaz.latest.network.vnet_gateway.vpn_client._generate_vpn_profile import GenerateVpnProfile as _VpnProfileGenerate +from .aaz.latest.network.vnet_gateway.vpn_client._generate import Generate as _VpnClientPackageGenerate +from .aaz.latest.network.vpn_connection._update import Update as _VpnConnectionUpdate +from .aaz.latest.network.vpn_connection._show_device_config_script import ShowDeviceConfigScript as _VpnConnectionDeviceConfigScriptShow +from .aaz.latest.network.vpn_connection.ipsec_policy._add import Add as _VpnConnIpsecPolicyAdd +from .aaz.latest.network.vpn_connection.packet_capture._stop import Stop as _VpnConnPackageCaptureStop +from .aaz.latest.network.vpn_connection.shared_key._update import Update as _VpnConnSharedKeyUpdate from .operations.dns import (RecordSetAShow as DNSRecordSetAShow, RecordSetAAAAShow as DNSRecordSetAAAAShow, # pylint: disable=unused-import RecordSetDSShow as DNSRecordSetDSShow, RecordSetMXShow as DNSRecordSetMXShow, RecordSetNAPTRShow as DNSRecordSetNAPTRShow, RecordSetNSShow as DNSRecordSetNSShow, diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/dns.py b/src/azure-cli/azure/cli/command_modules/network/operations/dns.py index d41f22c7a1b..f7d025baa75 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/dns.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/dns.py @@ -8,9 +8,12 @@ from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg from azure.cli.core.aaz.utils import assign_aaz_list_arg -from ..aaz.latest.network.dns.record_set import Update as _RecordSetUpdate, Show as _RecordSetShow, \ - ListByType as _RecordSetListByType, Delete as _RecordSetDelete, Create as _RecordSetCreate -from ..aaz.latest.network.dns import ListReferences as _DNSListReferences +from ..aaz.latest.network.dns.record_set._update import Update as _RecordSetUpdate +from ..aaz.latest.network.dns.record_set._show import Show as _RecordSetShow +from ..aaz.latest.network.dns.record_set._list_by_type import ListByType as _RecordSetListByType +from ..aaz.latest.network.dns.record_set._delete import Delete as _RecordSetDelete +from ..aaz.latest.network.dns.record_set._create import Create as _RecordSetCreate +from ..aaz.latest.network.dns._list_references import ListReferences as _DNSListReferences logger = get_logger(__name__) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py b/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py index 3537650e7f7..0fc57f6eeeb 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py @@ -8,26 +8,42 @@ from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, \ AAZStrArg, AAZArgEnum from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id -from ..aaz.latest.network.lb import Delete as _LBDelete, Update as _LBUpdate, List as _LBList, Show as _LBShow -from ..aaz.latest.network.lb.frontend_ip import Create as _LBFrontendIPCreate, Update as _LBFrontendIPUpdate, \ - Show as _LBFrontendIPShow, Delete as _LBFrontendIPDelete, List as _LBFrontendIPList -from ..aaz.latest.network.lb.inbound_nat_pool import Create as _LBInboundNatPoolCreate, \ - Update as _LBInboundNatPoolUpdate -from ..aaz.latest.network.lb.inbound_nat_rule import Create as _LBInboundNatRuleCreate, \ - Update as _LBInboundNatRuleUpdate -from ..aaz.latest.network.lb.rule import Create as _LBRuleCreate, Update as _LBRuleUpdate, Show as _LBRuleShow, \ - Delete as _LBRuleDelete, List as _LBRuleList -from ..aaz.latest.network.lb.outbound_rule import Create as _LBOutboundRuleCreate, Update as _LBOutboundRuleUpdate -from ..aaz.latest.network.lb.address_pool import Create as _LBAddressPoolCreate, Update as _LBAddressPoolUpdate, \ - Show as _LBAddressPoolShow, Delete as _LBAddressPoolDelete, List as _LBAddressPoolList -from ..aaz.latest.network.lb.address_pool.address import Add as _LBAddressPoolAddressAdd, \ - Update as _LBAddressPoolAddressUpdate, Show as _LBAddressPoolAddressShow, \ - Remove as _LBAddressPoolAddressRemove, List as _LBAddressPoolAddressList -from ..aaz.latest.network.lb.address_pool.basic import Create as _LBAddressPoolBasicCreate, \ - Delete as _LBAddressPoolBasicDelete -from ..aaz.latest.network.lb.address_pool.tunnel_interface import Add as _LBAddressPoolTunnelInterfaceAdd, \ - Update as _LBAddressPoolTunnelInterfaceUpdate -from ..aaz.latest.network.lb.probe import Create as _LBProbeCreate, Update as _LBProbeUpdate +from ..aaz.latest.network.lb._delete import Delete as _LBDelete +from ..aaz.latest.network.lb._update import Update as _LBUpdate +from ..aaz.latest.network.lb._list import List as _LBList +from ..aaz.latest.network.lb._show import Show as _LBShow +from ..aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate +from ..aaz.latest.network.lb.frontend_ip._update import Update as _LBFrontendIPUpdate +from ..aaz.latest.network.lb.frontend_ip._show import Show as _LBFrontendIPShow +from ..aaz.latest.network.lb.frontend_ip._delete import Delete as _LBFrontendIPDelete +from ..aaz.latest.network.lb.frontend_ip._list import List as _LBFrontendIPList +from ..aaz.latest.network.lb.inbound_nat_pool._create import Create as _LBInboundNatPoolCreate +from ..aaz.latest.network.lb.inbound_nat_pool._update import Update as _LBInboundNatPoolUpdate +from ..aaz.latest.network.lb.inbound_nat_rule._create import Create as _LBInboundNatRuleCreate +from ..aaz.latest.network.lb.inbound_nat_rule._update import Update as _LBInboundNatRuleUpdate +from ..aaz.latest.network.lb.rule._create import Create as _LBRuleCreate +from ..aaz.latest.network.lb.rule._update import Update as _LBRuleUpdate +from ..aaz.latest.network.lb.rule._show import Show as _LBRuleShow +from ..aaz.latest.network.lb.rule._delete import Delete as _LBRuleDelete +from ..aaz.latest.network.lb.rule._list import List as _LBRuleList +from ..aaz.latest.network.lb.outbound_rule._create import Create as _LBOutboundRuleCreate +from ..aaz.latest.network.lb.outbound_rule._update import Update as _LBOutboundRuleUpdate +from ..aaz.latest.network.lb.address_pool._create import Create as _LBAddressPoolCreate +from ..aaz.latest.network.lb.address_pool._update import Update as _LBAddressPoolUpdate +from ..aaz.latest.network.lb.address_pool._show import Show as _LBAddressPoolShow +from ..aaz.latest.network.lb.address_pool._delete import Delete as _LBAddressPoolDelete +from ..aaz.latest.network.lb.address_pool._list import List as _LBAddressPoolList +from ..aaz.latest.network.lb.address_pool.address._add import Add as _LBAddressPoolAddressAdd +from ..aaz.latest.network.lb.address_pool.address._update import Update as _LBAddressPoolAddressUpdate +from ..aaz.latest.network.lb.address_pool.address._show import Show as _LBAddressPoolAddressShow +from ..aaz.latest.network.lb.address_pool.address._remove import Remove as _LBAddressPoolAddressRemove +from ..aaz.latest.network.lb.address_pool.address._list import List as _LBAddressPoolAddressList +from ..aaz.latest.network.lb.address_pool.basic._create import Create as _LBAddressPoolBasicCreate +from ..aaz.latest.network.lb.address_pool.basic._delete import Delete as _LBAddressPoolBasicDelete +from ..aaz.latest.network.lb.address_pool.tunnel_interface._add import Add as _LBAddressPoolTunnelInterfaceAdd +from ..aaz.latest.network.lb.address_pool.tunnel_interface._update import Update as _LBAddressPoolTunnelInterfaceUpdate +from ..aaz.latest.network.lb.probe._create import Create as _LBProbeCreate +from ..aaz.latest.network.lb.probe._update import Update as _LBProbeUpdate logger = get_logger(__name__) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/nat.py b/src/azure-cli/azure/cli/command_modules/network/operations/nat.py index b0eb439861e..7727087942c 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/nat.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/nat.py @@ -7,7 +7,8 @@ from azure.cli.core.aaz.utils import assign_aaz_list_arg -from ..aaz.latest.network.nat.gateway import Create as _GatewayCreate, Update as _GatewayUpdate +from ..aaz.latest.network.nat.gateway._create import Create as _GatewayCreate +from ..aaz.latest.network.nat.gateway._update import Update as _GatewayUpdate class GatewayCreate(_GatewayCreate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py b/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py index fb6c107f35f..351219da89b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py @@ -5,8 +5,10 @@ # pylint: disable=protected-access, line-too-long -from ..aaz.latest.network.vnet_gateway.migration import Prepare as _VNetGatewayMigrationPrepare, \ - Execute as _VNetGatewayMigrationExecute, Commit as _VNetGatewayMigrationCommit, Abort as _VNetGatewayMigrationAbort +from ..aaz.latest.network.vnet_gateway.migration._prepare import Prepare as _VNetGatewayMigrationPrepare +from ..aaz.latest.network.vnet_gateway.migration._execute import Execute as _VNetGatewayMigrationExecute +from ..aaz.latest.network.vnet_gateway.migration._commit import Commit as _VNetGatewayMigrationCommit +from ..aaz.latest.network.vnet_gateway.migration._abort import Abort as _VNetGatewayMigrationAbort class VNetGatewayMigrationPrepare(_VNetGatewayMigrationPrepare): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py b/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py index a086aa110f5..8ab9311ee64 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py @@ -19,45 +19,55 @@ from azure.cli.command_modules.network._validators import validate_managed_identity_resource_id from .._validators import _resolve_api_version -from ..aaz.latest.network.watcher import RunConfigurationDiagnostic as _RunConfigurationDiagnostic -from ..aaz.latest.network.watcher import ShowNextHop as _ShowNextHop, ShowSecurityGroupView as _ShowSecurityGroupView, \ - ShowTopology as _ShowTopology -from ..aaz.latest.network.watcher import TestConnectivity as _TestConnectivity, TestIpFlow as _TestIPFlow - -from ..aaz.latest.network.watcher.flow_log import Create as _NwFlowLogCreate, Update as _NwFlowLogUpdate, \ - List as _NwFlowLogList, Delete as _NwFlowLogDelete -from ..aaz.latest.network.watcher.troubleshooting import Start as _NwTroubleshootingStart, \ - Show as _NwTroubleshootingShow -from ..aaz.latest.network.watcher.packet_capture import Create as _PacketCaptureCreate -from ..aaz.latest.network.watcher.packet_capture import Delete as _PacketCaptureDelete, List as _PacketCaptureList, \ - Show as _PacketCaptureShow, ShowStatus as _PacketCaptureShowStatus, Stop as _PacketCaptureStop - -from ..aaz.latest.network.watcher.connection_monitor import Create as _WatcherConnectionMonitorCreate -from ..aaz.latest.network.watcher.connection_monitor import Start as _WatcherConnectionMonitorStart -from ..aaz.latest.network.watcher.connection_monitor import Stop as _WatcherConnectionMonitorStop -from ..aaz.latest.network.watcher.connection_monitor import Show as _WatcherConnectionMonitorShow -from ..aaz.latest.network.watcher.connection_monitor import List as _WatcherConnectionMonitorList -from ..aaz.latest.network.watcher.connection_monitor import Delete as _WatcherConnectionMonitorDelete -from ..aaz.latest.network.watcher.connection_monitor import Query as _WatcherConnectionMonitorQuery -from ..aaz.latest.network.watcher.connection_monitor import Update as _WatcherConnectionMonitorUpdate -from ..aaz.latest.network.watcher.connection_monitor.output import Add as _WatcherConnectionMonitorOutputAdd, \ - List as _WatcherConnectionMonitorOutputList -from ..aaz.latest.network.watcher.connection_monitor.endpoint import Show as _WatcherConnectionMonitorEndpointShow, \ - Remove as _WatcherConnectionMonitorEndpointRemove, List as _WatcherConnectionMonitorEndpointList, \ - Add as _WatcherConnectionMonitorEndpointAdd - -from ..aaz.latest.network.watcher.connection_monitor.test_configuration import Add as _MonitorTestConfigurationAdd, \ - Show as _MonitorTestConfigurationShow, List as _MonitorTestConfigurationList, \ - Remove as _MonitorTestConfigurationRemove - -from ..aaz.latest.network.watcher.connection_monitor.test_group import Add as _WatcherConnectionMonitorTestGroupAdd, \ - Show as _WatcherConnectionMonitorTestGroupShow, List as _WatcherConnectionMonitorTestGroupList +from ..aaz.latest.network.watcher._run_configuration_diagnostic import RunConfigurationDiagnostic as _RunConfigurationDiagnostic +from ..aaz.latest.network.watcher._show_next_hop import ShowNextHop as _ShowNextHop +from ..aaz.latest.network.watcher._show_security_group_view import ShowSecurityGroupView as _ShowSecurityGroupView +from ..aaz.latest.network.watcher._show_topology import ShowTopology as _ShowTopology +from ..aaz.latest.network.watcher._test_connectivity import TestConnectivity as _TestConnectivity +from ..aaz.latest.network.watcher._test_ip_flow import TestIpFlow as _TestIPFlow + +from ..aaz.latest.network.watcher.flow_log._create import Create as _NwFlowLogCreate +from ..aaz.latest.network.watcher.flow_log._update import Update as _NwFlowLogUpdate +from ..aaz.latest.network.watcher.flow_log._list import List as _NwFlowLogList +from ..aaz.latest.network.watcher.flow_log._delete import Delete as _NwFlowLogDelete +from ..aaz.latest.network.watcher.troubleshooting._start import Start as _NwTroubleshootingStart +from ..aaz.latest.network.watcher.troubleshooting._show import Show as _NwTroubleshootingShow +from ..aaz.latest.network.watcher.packet_capture._create import Create as _PacketCaptureCreate +from ..aaz.latest.network.watcher.packet_capture._delete import Delete as _PacketCaptureDelete +from ..aaz.latest.network.watcher.packet_capture._list import List as _PacketCaptureList +from ..aaz.latest.network.watcher.packet_capture._show import Show as _PacketCaptureShow +from ..aaz.latest.network.watcher.packet_capture._show_status import ShowStatus as _PacketCaptureShowStatus +from ..aaz.latest.network.watcher.packet_capture._stop import Stop as _PacketCaptureStop + +from ..aaz.latest.network.watcher.connection_monitor._create import Create as _WatcherConnectionMonitorCreate +from ..aaz.latest.network.watcher.connection_monitor._start import Start as _WatcherConnectionMonitorStart +from ..aaz.latest.network.watcher.connection_monitor._stop import Stop as _WatcherConnectionMonitorStop +from ..aaz.latest.network.watcher.connection_monitor._show import Show as _WatcherConnectionMonitorShow +from ..aaz.latest.network.watcher.connection_monitor._list import List as _WatcherConnectionMonitorList +from ..aaz.latest.network.watcher.connection_monitor._delete import Delete as _WatcherConnectionMonitorDelete +from ..aaz.latest.network.watcher.connection_monitor._query import Query as _WatcherConnectionMonitorQuery +from ..aaz.latest.network.watcher.connection_monitor._update import Update as _WatcherConnectionMonitorUpdate +from ..aaz.latest.network.watcher.connection_monitor.output._add import Add as _WatcherConnectionMonitorOutputAdd +from ..aaz.latest.network.watcher.connection_monitor.output._list import List as _WatcherConnectionMonitorOutputList +from ..aaz.latest.network.watcher.connection_monitor.endpoint._show import Show as _WatcherConnectionMonitorEndpointShow +from ..aaz.latest.network.watcher.connection_monitor.endpoint._remove import Remove as _WatcherConnectionMonitorEndpointRemove +from ..aaz.latest.network.watcher.connection_monitor.endpoint._list import List as _WatcherConnectionMonitorEndpointList +from ..aaz.latest.network.watcher.connection_monitor.endpoint._add import Add as _WatcherConnectionMonitorEndpointAdd + +from ..aaz.latest.network.watcher.connection_monitor.test_configuration._add import Add as _MonitorTestConfigurationAdd +from ..aaz.latest.network.watcher.connection_monitor.test_configuration._show import Show as _MonitorTestConfigurationShow +from ..aaz.latest.network.watcher.connection_monitor.test_configuration._list import List as _MonitorTestConfigurationList +from ..aaz.latest.network.watcher.connection_monitor.test_configuration._remove import Remove as _MonitorTestConfigurationRemove + +from ..aaz.latest.network.watcher.connection_monitor.test_group._add import Add as _WatcherConnectionMonitorTestGroupAdd +from ..aaz.latest.network.watcher.connection_monitor.test_group._show import Show as _WatcherConnectionMonitorTestGroupShow +from ..aaz.latest.network.watcher.connection_monitor.test_group._list import List as _WatcherConnectionMonitorTestGroupList logger = get_logger(__name__) def get_network_watcher_from_location(cmd, watcher_name="watcher_name", rg_name="watcher_rg"): - from ..aaz.latest.network.watcher import List + from ..aaz.latest.network.watcher._list import List args = cmd.ctx.args location = args.location.to_serialized_data() From f2907c0f73e693ea35056e0300d74cb6a322c100 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Tue, 24 Feb 2026 16:59:43 +1100 Subject: [PATCH 02/21] Refactor code structure for optimizing import logic for multilevel help in network module --- .../azure/cli/core/aaz/_command.py | 2 +- src/azure-cli-core/azure/cli/core/parser.py | 10 + .../cli/command_modules/network/__init__.py | 10 + .../cli/command_modules/network/commands.py | 562 +-- .../cli/command_modules/network/custom.py | 3853 +---------------- .../command_modules/network/operations/dns.py | 897 ---- .../network/operations/latest/__init__.py | 6 + .../operations/latest/network/__init__.py | 6 + .../operations/latest/network/_list_usages.py | 25 + .../network/application_gateway/__init__.py | 6 + .../network/application_gateway/_update.py | 41 + .../address_pool/__init__.py | 6 + .../address_pool/_create.py | 40 + .../address_pool/_update.py | 56 + .../application_gateway/auth_cert/__init__.py | 6 + .../application_gateway/auth_cert/_create.py | 29 + .../application_gateway/auth_cert/_update.py | 30 + .../client_cert/__init__.py | 6 + .../application_gateway/client_cert/_add.py | 33 + .../client_cert/_update.py | 30 + .../frontend_ip/__init__.py | 6 + .../frontend_ip/_create.py | 34 + .../frontend_ip/_update.py | 29 + .../http_listener/__init__.py | 6 + .../http_listener/_create.py | 60 + .../http_listener/_update.py | 54 + .../http_settings/__init__.py | 6 + .../http_settings/_create.py | 73 + .../http_settings/_update.py | 83 + .../application_gateway/identity/__init__.py | 6 + .../application_gateway/identity/_assign.py | 36 + .../application_gateway/listener/__init__.py | 6 + .../application_gateway/listener/_create.py | 55 + .../application_gateway/listener/_update.py | 44 + .../private_link/__init__.py | 6 + .../application_gateway/private_link/_add.py | 120 + .../private_link/_remove.py | 28 + .../private_link/ip_config/__init__.py | 6 + .../private_link/ip_config/_add.py | 34 + .../redirect_config/__init__.py | 6 + .../redirect_config/_create.py | 21 + .../redirect_config/_update.py | 29 + .../rewrite_rule/__init__.py | 6 + .../rewrite_rule/_create.py | 42 + .../rewrite_rule/_update.py | 54 + .../application_gateway/root_cert/__init__.py | 6 + .../application_gateway/root_cert/_create.py | 32 + .../application_gateway/root_cert/_update.py | 29 + .../routing_rule/__init__.py | 6 + .../routing_rule/_create.py | 59 + .../routing_rule/_update.py | 37 + .../application_gateway/rule/__init__.py | 6 + .../application_gateway/rule/_create.py | 71 + .../application_gateway/rule/_update.py | 55 + .../application_gateway/settings/__init__.py | 6 + .../application_gateway/settings/_create.py | 46 + .../application_gateway/settings/_update.py | 48 + .../application_gateway/ssl_cert/__init__.py | 6 + .../application_gateway/ssl_cert/_create.py | 28 + .../application_gateway/ssl_cert/_update.py | 29 + .../ssl_policy/__init__.py | 6 + .../application_gateway/ssl_policy/_set.py | 19 + .../ssl_profile/__init__.py | 6 + .../application_gateway/ssl_profile/_add.py | 48 + .../ssl_profile/_update.py | 51 + .../url_path_map/__init__.py | 6 + .../url_path_map/_create.py | 106 + .../url_path_map/_update.py | 33 + .../url_path_map/rule/__init__.py | 6 + .../url_path_map/rule/_create.py | 46 + .../waf_policy/__init__.py | 6 + .../application_gateway/waf_policy/_create.py | 44 + .../waf_policy/custom_rule/__init__.py | 6 + .../custom_rule/match_condition/__init__.py | 6 + .../custom_rule/match_condition/_add.py | 47 + .../waf_policy/policy_setting/__init__.py | 6 + .../waf_policy/policy_setting/_update.py | 14 + .../network/cross_region_lb/__cmd_group.py | 23 + .../network/cross_region_lb/__init__.py | 6 + .../latest/network/cross_region_lb/_delete.py | 18 + .../latest/network/cross_region_lb/_list.py | 18 + .../latest/network/cross_region_lb/_show.py | 18 + .../latest/network/cross_region_lb/_update.py | 21 + .../latest/network/cross_region_lb/_wait.py | 18 + .../address_pool/__cmd_group.py | 21 + .../cross_region_lb/address_pool/__init__.py | 6 + .../cross_region_lb/address_pool/_create.py | 55 + .../cross_region_lb/address_pool/_delete.py | 18 + .../cross_region_lb/address_pool/_list.py | 18 + .../cross_region_lb/address_pool/_show.py | 18 + .../cross_region_lb/address_pool/_update.py | 56 + .../address_pool/address/__cmd_group.py | 21 + .../address_pool/address/__init__.py | 6 + .../address_pool/address/_add.py | 35 + .../address_pool/address/_list.py | 18 + .../address_pool/address/_remove.py | 17 + .../address_pool/address/_show.py | 18 + .../address_pool/address/_update.py | 35 + .../frontend_ip/__cmd_group.py | 21 + .../cross_region_lb/frontend_ip/__init__.py | 6 + .../cross_region_lb/frontend_ip/_create.py | 40 + .../cross_region_lb/frontend_ip/_delete.py | 18 + .../cross_region_lb/frontend_ip/_list.py | 18 + .../cross_region_lb/frontend_ip/_show.py | 18 + .../cross_region_lb/frontend_ip/_update.py | 40 + .../cross_region_lb/rule/__cmd_group.py | 21 + .../network/cross_region_lb/rule/__init__.py | 6 + .../network/cross_region_lb/rule/_create.py | 76 + .../network/cross_region_lb/rule/_delete.py | 18 + .../network/cross_region_lb/rule/_list.py | 18 + .../network/cross_region_lb/rule/_show.py | 18 + .../network/cross_region_lb/rule/_update.py | 67 + .../latest/network/custom_ip/__init__.py | 6 + .../network/custom_ip/prefix/__init__.py | 6 + .../network/custom_ip/prefix/_create.py | 29 + .../network/custom_ip/prefix/_update.py | 19 + .../operations/latest/network/dns/__init__.py | 6 + .../latest/network/dns/_list_references.py | 40 + .../latest/network/dns/record_set/__init__.py | 6 + .../latest/network/dns/record_set/_base.py | 111 + .../network/dns/record_set/a/__init__.py | 6 + .../network/dns/record_set/a/_create.py | 21 + .../network/dns/record_set/a/_delete.py | 21 + .../latest/network/dns/record_set/a/_list.py | 21 + .../latest/network/dns/record_set/a/_show.py | 21 + .../network/dns/record_set/a/_update.py | 21 + .../network/dns/record_set/aaaa/__init__.py | 6 + .../network/dns/record_set/aaaa/_create.py | 21 + .../network/dns/record_set/aaaa/_delete.py | 21 + .../network/dns/record_set/aaaa/_list.py | 21 + .../network/dns/record_set/aaaa/_show.py | 21 + .../network/dns/record_set/aaaa/_update.py | 21 + .../network/dns/record_set/caa/__init__.py | 6 + .../network/dns/record_set/caa/_create.py | 21 + .../network/dns/record_set/caa/_delete.py | 21 + .../network/dns/record_set/caa/_list.py | 21 + .../network/dns/record_set/caa/_show.py | 21 + .../network/dns/record_set/caa/_update.py | 21 + .../network/dns/record_set/cname/__init__.py | 6 + .../network/dns/record_set/cname/_create.py | 21 + .../network/dns/record_set/cname/_delete.py | 21 + .../network/dns/record_set/cname/_list.py | 21 + .../network/dns/record_set/cname/_show.py | 21 + .../network/dns/record_set/cname/_update.py | 21 + .../network/dns/record_set/ds/__init__.py | 6 + .../network/dns/record_set/ds/_create.py | 21 + .../network/dns/record_set/ds/_delete.py | 21 + .../latest/network/dns/record_set/ds/_list.py | 21 + .../latest/network/dns/record_set/ds/_show.py | 21 + .../network/dns/record_set/ds/_update.py | 21 + .../network/dns/record_set/mx/__init__.py | 6 + .../network/dns/record_set/mx/_create.py | 21 + .../network/dns/record_set/mx/_delete.py | 21 + .../latest/network/dns/record_set/mx/_list.py | 21 + .../latest/network/dns/record_set/mx/_show.py | 21 + .../network/dns/record_set/mx/_update.py | 21 + .../network/dns/record_set/naptr/__init__.py | 6 + .../network/dns/record_set/naptr/_create.py | 21 + .../network/dns/record_set/naptr/_delete.py | 21 + .../network/dns/record_set/naptr/_list.py | 21 + .../network/dns/record_set/naptr/_show.py | 21 + .../network/dns/record_set/naptr/_update.py | 21 + .../network/dns/record_set/ns/__init__.py | 6 + .../network/dns/record_set/ns/_create.py | 21 + .../network/dns/record_set/ns/_delete.py | 21 + .../latest/network/dns/record_set/ns/_list.py | 21 + .../latest/network/dns/record_set/ns/_show.py | 21 + .../network/dns/record_set/ns/_update.py | 21 + .../network/dns/record_set/ptr/__init__.py | 6 + .../network/dns/record_set/ptr/_create.py | 21 + .../network/dns/record_set/ptr/_delete.py | 21 + .../network/dns/record_set/ptr/_list.py | 21 + .../network/dns/record_set/ptr/_show.py | 21 + .../network/dns/record_set/ptr/_update.py | 21 + .../network/dns/record_set/soa/__init__.py | 6 + .../network/dns/record_set/soa/_show.py | 31 + .../network/dns/record_set/srv/__init__.py | 6 + .../network/dns/record_set/srv/_create.py | 21 + .../network/dns/record_set/srv/_delete.py | 21 + .../network/dns/record_set/srv/_list.py | 21 + .../network/dns/record_set/srv/_show.py | 21 + .../network/dns/record_set/srv/_update.py | 21 + .../network/dns/record_set/tlsa/__init__.py | 6 + .../network/dns/record_set/tlsa/_create.py | 21 + .../network/dns/record_set/tlsa/_delete.py | 21 + .../network/dns/record_set/tlsa/_list.py | 21 + .../network/dns/record_set/tlsa/_show.py | 21 + .../network/dns/record_set/tlsa/_update.py | 21 + .../network/dns/record_set/txt/__init__.py | 6 + .../network/dns/record_set/txt/_create.py | 21 + .../network/dns/record_set/txt/_delete.py | 21 + .../network/dns/record_set/txt/_list.py | 21 + .../network/dns/record_set/txt/_show.py | 21 + .../network/dns/record_set/txt/_update.py | 21 + .../latest/network/express_route/__init__.py | 6 + .../latest/network/express_route/_create.py | 42 + .../latest/network/express_route/_update.py | 50 + .../network/express_route/gateway/__init__.py | 6 + .../network/express_route/gateway/_create.py | 20 + .../network/express_route/gateway/_update.py | 20 + .../gateway/connection/__init__.py | 6 + .../gateway/connection/_create.py | 47 + .../gateway/connection/_update.py | 55 + .../network/express_route/peering/__init__.py | 6 + .../network/express_route/peering/_create.py | 62 + .../network/express_route/peering/_update.py | 57 + .../peering/connection/__init__.py | 6 + .../peering/connection/_create.py | 23 + .../network/express_route/port/__init__.py | 6 + .../network/express_route/port/_create.py | 30 + .../express_route/port/identity/__init__.py | 6 + .../express_route/port/identity/_assign.py | 35 + .../express_route/port/link/__init__.py | 6 + .../express_route/port/link/_update.py | 29 + .../operations/latest/network/lb/__init__.py | 6 + .../network/lb/address_pool/__init__.py | 6 + .../latest/network/lb/address_pool/_create.py | 125 + .../latest/network/lb/address_pool/_delete.py | 18 + .../latest/network/lb/address_pool/_update.py | 76 + .../lb/address_pool/address/__init__.py | 6 + .../network/lb/address_pool/address/_add.py | 42 + .../lb/address_pool/address/_update.py | 48 + .../address_pool/tunnel_interface/__init__.py | 6 + .../lb/address_pool/tunnel_interface/_add.py | 24 + .../address_pool/tunnel_interface/_update.py | 24 + .../latest/network/lb/frontend_ip/__init__.py | 6 + .../latest/network/lb/frontend_ip/_create.py | 60 + .../latest/network/lb/frontend_ip/_update.py | 61 + .../network/lb/inbound_nat_pool/__init__.py | 6 + .../network/lb/inbound_nat_pool/_create.py | 32 + .../network/lb/inbound_nat_pool/_update.py | 24 + .../network/lb/inbound_nat_rule/__init__.py | 6 + .../network/lb/inbound_nat_rule/_create.py | 39 + .../network/lb/inbound_nat_rule/_update.py | 30 + .../network/lb/outbound_rule/__init__.py | 6 + .../network/lb/outbound_rule/_create.py | 44 + .../network/lb/outbound_rule/_update.py | 45 + .../latest/network/lb/probe/__init__.py | 6 + .../latest/network/lb/probe/_create.py | 32 + .../latest/network/lb/probe/_update.py | 32 + .../latest/network/lb/rule/__init__.py | 6 + .../latest/network/lb/rule/_create.py | 80 + .../latest/network/lb/rule/_update.py | 72 + .../latest/network/local_gateway/__init__.py | 6 + .../latest/network/local_gateway/_list.py | 15 + .../operations/latest/network/nat/__init__.py | 6 + .../latest/network/nat/gateway/__init__.py | 6 + .../latest/network/nat/gateway/_create.py | 53 + .../network/nat/gateway/_update.py} | 50 +- .../operations/latest/network/nic/__init__.py | 6 + .../operations/latest/network/nic/_create.py | 152 + .../latest/network/nic/_list_effective_nsg.py | 15 + .../nic/_show_effective_route_table.py | 15 + .../operations/latest/network/nic/_update.py | 38 + .../latest/network/nic/ip_config/__init__.py | 6 + .../latest/network/nic/ip_config/_create.py | 133 + .../latest/network/nic/ip_config/_update.py | 164 + .../ip_config/inbound_nat_rule/__init__.py | 6 + .../nic/ip_config/inbound_nat_rule/_add.py | 28 + .../nic/ip_config/inbound_nat_rule/_remove.py | 25 + .../operations/latest/network/nsg/__init__.py | 6 + .../operations/latest/network/nsg/_create.py | 14 + .../latest/network/nsg/rule/__init__.py | 6 + .../latest/network/nsg/rule/_create.py | 65 + .../latest/network/nsg/rule/_show.py | 15 + .../latest/network/nsg/rule/_update.py | 94 + .../network/private_endpoint/__init__.py | 6 + .../network/private_endpoint/_create.py | 72 + .../network/private_endpoint/_update.py | 32 + .../network/private_endpoint/asg/__init__.py | 6 + .../network/private_endpoint/asg/_add.py | 22 + .../dns_zone_group/__init__.py | 6 + .../private_endpoint/dns_zone_group/_add.py | 35 + .../dns_zone_group/_create.py | 32 + .../private_endpoint/ip_config/__init__.py | 6 + .../private_endpoint/ip_config/_add.py | 15 + .../network/private_link_service/__init__.py | 6 + .../network/private_link_service/_create.py | 67 + .../network/private_link_service/_update.py | 38 + .../connection/__init__.py | 6 + .../connection/_update.py | 19 + .../latest/network/public_ip/__init__.py | 6 + .../latest/network/public_ip/_create.py | 24 + .../latest/network/public_ip/_list.py | 24 + .../latest/network/public_ip/_show.py | 24 + .../latest/network/public_ip/_update.py | 45 + .../network/public_ip/prefix/__init__.py | 6 + .../network/public_ip/prefix/_create.py | 39 + .../latest/network/route_filter/__init__.py | 6 + .../network/route_filter/rule/__init__.py | 6 + .../rule/_list_service_communities.py | 16 + .../security_partner_provider/__init__.py | 6 + .../security_partner_provider/_create.py | 21 + .../security_partner_provider/_update.py | 21 + .../network/traffic_manager/__init__.py | 6 + .../traffic_manager/endpoint/__init__.py | 6 + .../endpoint/_show_geographic_hierarchy.py | 16 + .../network/virtual_appliance/__init__.py | 6 + .../network/virtual_appliance/_create.py | 21 + .../network/virtual_appliance/_update.py | 21 + .../latest/network/vnet/__init__.py | 6 + .../operations/latest/network/vnet/_create.py | 76 + .../operations/latest/network/vnet/_list.py | 15 + .../operations/latest/network/vnet/_update.py | 31 + .../latest/network/vnet/peering/__init__.py | 6 + .../latest/network/vnet/peering/_create.py | 21 + .../latest/network/vnet/subnet/__init__.py | 6 + .../latest/network/vnet/subnet/_create.py | 119 + .../latest/network/vnet/subnet/_update.py | 138 + .../latest/network/vnet_gateway/__init__.py | 6 + .../latest/network/vnet_gateway/_create.py | 133 + .../_disconnect_vpn_connections.py | 20 + .../latest/network/vnet_gateway/_list.py | 28 + .../vnet_gateway/_list_advertised_routes.py | 16 + .../vnet_gateway/_list_bgp_peer_status.py | 16 + .../vnet_gateway/_list_learned_routes.py | 16 + .../latest/network/vnet_gateway/_show.py | 26 + .../latest/network/vnet_gateway/_update.py | 94 + .../network/vnet_gateway/aad/__init__.py | 6 + .../network/vnet_gateway/aad/_assign.py | 20 + .../vnet_gateway/ipsec_policy/__init__.py | 6 + .../network/vnet_gateway/ipsec_policy/_add.py | 18 + .../vnet_gateway/migration/__init__.py | 6 + .../network/vnet_gateway/migration/_abort.py | 29 + .../network/vnet_gateway/migration/_commit.py | 29 + .../vnet_gateway/migration/_execute.py | 29 + .../vnet_gateway/migration/_prepare.py | 29 + .../network/vnet_gateway/nat_rule/__init__.py | 6 + .../network/vnet_gateway/nat_rule/_add.py | 61 + .../network/vnet_gateway/nat_rule/_list.py | 23 + .../network/vnet_gateway/nat_rule/_remove.py | 28 + .../vnet_gateway/packet_capture/__init__.py | 6 + .../vnet_gateway/packet_capture/_wait.py | 18 + .../vnet_gateway/revoked_cert/__init__.py | 6 + .../vnet_gateway/revoked_cert/_create.py | 18 + .../vnet_gateway/root_cert/__init__.py | 6 + .../network/vnet_gateway/root_cert/_create.py | 33 + .../vnet_gateway/vpn_client/__init__.py | 6 + .../vpn_client/ipsec_policy/__init__.py | 6 + .../vpn_client/ipsec_policy/_wait.py | 18 + .../latest/network/vpn_connection/__init__.py | 6 + .../_show_device_config_script.py | 20 + .../latest/network/vpn_connection/_update.py | 17 + .../vpn_connection/ipsec_policy/__init__.py | 6 + .../vpn_connection/ipsec_policy/_add.py | 16 + .../vpn_connection/packet_capture/__init__.py | 6 + .../vpn_connection/packet_capture/_stop.py | 17 + .../vpn_connection/packet_capture/_wait.py | 18 + .../vpn_connection/shared_key/__init__.py | 6 + .../vpn_connection/shared_key/_update.py | 17 + .../latest/network/watcher/__init__.py | 6 + .../latest/network/watcher/_helpers.py | 168 + .../watcher/_run_configuration_diagnostic.py | 123 + .../latest/network/watcher/_show_next_hop.py | 39 + .../watcher/_show_security_group_view.py | 35 + .../latest/network/watcher/_show_topology.py | 58 + .../network/watcher/_test_connectivity.py | 73 + .../latest/network/watcher/_test_ip_flow.py | 67 + .../watcher/connection_monitor/__init__.py | 6 + .../watcher/connection_monitor/_create.py | 306 ++ .../watcher/connection_monitor/_delete.py | 35 + .../watcher/connection_monitor/_list.py | 35 + .../watcher/connection_monitor/_query.py | 35 + .../watcher/connection_monitor/_show.py | 35 + .../watcher/connection_monitor/_start.py | 35 + .../watcher/connection_monitor/_stop.py | 35 + .../connection_monitor/endpoint/__init__.py | 6 + .../connection_monitor/endpoint/_add.py | 99 + .../connection_monitor/endpoint/_list.py | 33 + .../connection_monitor/endpoint/_remove.py | 55 + .../connection_monitor/endpoint/_show.py | 33 + .../connection_monitor/output/__init__.py | 6 + .../watcher/connection_monitor/output/_add.py | 38 + .../connection_monitor/output/_list.py | 33 + .../test_configuration/__init__.py | 6 + .../test_configuration/_add.py | 64 + .../test_configuration/_list.py | 33 + .../test_configuration/_remove.py | 53 + .../test_configuration/_show.py | 33 + .../connection_monitor/test_group/__init__.py | 6 + .../connection_monitor/test_group/_add.py | 232 + .../connection_monitor/test_group/_list.py | 33 + .../connection_monitor/test_group/_show.py | 33 + .../network/watcher/flow_log/__init__.py | 6 + .../network/watcher/flow_log/_create.py | 147 + .../network/watcher/flow_log/_delete.py | 36 + .../latest/network/watcher/flow_log/_list.py | 36 + .../network/watcher/flow_log/_update.py | 146 + .../watcher/packet_capture/__init__.py | 6 + .../network/watcher/packet_capture/_create.py | 70 + .../network/watcher/packet_capture/_delete.py | 27 + .../network/watcher/packet_capture/_list.py | 27 + .../network/watcher/packet_capture/_show.py | 27 + .../watcher/packet_capture/_show_status.py | 27 + .../network/watcher/packet_capture/_stop.py | 27 + .../watcher/troubleshooting/__init__.py | 6 + .../network/watcher/troubleshooting/_show.py | 48 + .../network/watcher/troubleshooting/_start.py | 57 + .../network/operations/load_balancer.py | 1251 ------ .../operations/vnet_gateway_migration.py | 95 - .../network/operations/watcher.py | 2159 --------- 401 files changed, 11520 insertions(+), 8837 deletions(-) delete mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/dns.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/_list_usages.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/_assign.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_wait.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/_assign.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_create.py rename src/azure-cli/azure/cli/command_modules/network/operations/{nat.py => latest/network/nat/gateway/_update.py} (53%) create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_list_effective_nsg.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_show_effective_route_table.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_remove.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/_list_service_communities.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/_show_geographic_hierarchy.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_disconnect_vpn_connections.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_advertised_routes.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_bgp_peer_status.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_learned_routes.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/_assign.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_abort.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_commit.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_execute.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_prepare.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/_wait.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/_wait.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_show_device_config_script.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_stop.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_wait.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py delete mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py delete mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py delete mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/watcher.py diff --git a/src/azure-cli-core/azure/cli/core/aaz/_command.py b/src/azure-cli-core/azure/cli/core/aaz/_command.py index 869454808db..f8246a7842f 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_command.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_command.py @@ -474,7 +474,7 @@ def _load_aaz_by_path(loader, base_path, base_module, args, command_table, comma if not os.path.isdir(base_path): return - if args is not None and args: + if args is not None and args and not args[0].startswith('-'): first_arg = args[0].lower().replace('-', '_') # First arg matches a command file (e.g. "create" → "_create.py") diff --git a/src/azure-cli-core/azure/cli/core/parser.py b/src/azure-cli-core/azure/cli/core/parser.py index 2fba4d56922..9939c766d1e 100644 --- a/src/azure-cli-core/azure/cli/core/parser.py +++ b/src/azure-cli-core/azure/cli/core/parser.py @@ -143,6 +143,16 @@ def load_command_table(self, command_loader): _argument_validators=argument_validators, _parser=command_parser) + # Ensure subparsers are created for all registered command groups, even + # those that have no commands in the (possibly truncated) command table. + # Without this, empty command groups would not appear in help output. + for group_name in grp_tbl: + # _get_subparser creates intermediate subparsers for path[:1] through + # path[:len-1]. Append a sentinel so the full group path is treated + # as an intermediate level and its subparser is created. + path = group_name.split() + ['_placeholder'] + self._get_subparser(path, grp_tbl) + def validation_error(self, message): az_error = ValidationError(message) az_error.print_error() diff --git a/src/azure-cli/azure/cli/command_modules/network/__init__.py b/src/azure-cli/azure/cli/command_modules/network/__init__.py index d163ab420b6..287930c60fd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/network/__init__.py @@ -42,6 +42,16 @@ def load_command_table(self, args): aaz_pkg_name=aaz.__name__, args=args ) + try: + from . import operations + except ImportError: + operations = None + if operations: + load_aaz_command_table( + loader=self, + aaz_pkg_name=operations.__name__, + args=args + ) load_command_table(self, args) return self.command_table diff --git a/src/azure-cli/azure/cli/command_modules/network/commands.py b/src/azure-cli/azure/cli/command_modules/network/commands.py index ac657bcf409..a421f228716 100644 --- a/src/azure-cli/azure/cli/command_modules/network/commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/commands.py @@ -10,14 +10,11 @@ from azure.cli.core.commands import CliCommandType from azure.cli.command_modules.network._format import ( - transform_local_gateway_table_output, transform_dns_record_set_output, + transform_dns_record_set_output, transform_dns_zone_table_output, transform_public_ip_create_output, transform_traffic_manager_create_output, - transform_geographic_hierachy_table_output, - transform_service_community_table_output, transform_waf_rule_sets_table_output, - transform_network_usage_table, transform_nsg_rule_table_output, - transform_vnet_table_output, transform_effective_route_table, transform_effective_nsg, - transform_vnet_gateway_routes_table, transform_vnet_gateway_bgp_peer_table) + transform_waf_rule_sets_table_output, + transform_nsg_rule_table_output) from azure.cli.command_modules.network._validators import ( process_ag_create_namespace, process_lb_create_namespace, @@ -33,16 +30,10 @@ # pylint: disable=too-many-locals, too-many-statements def load_command_table(self, _): # region NetworkRoot - with self.command_group('network'): - from azure.cli.command_modules.network.custom import UsagesList - self.command_table['network list-usages'] = UsagesList(loader=self, - table_transformer=transform_network_usage_table) # endregion # region ApplicationGateways with self.command_group("network application-gateway") as g: - from .custom import ApplicationGatewayUpdate - self.command_table["network application-gateway update"] = ApplicationGatewayUpdate(loader=self) g.custom_command("show-backend-health", "show_ag_backend_health") g.custom_command("create", "create_application_gateway", transform=DeploymentOutputLongRunningOperation(self.cli_ctx), @@ -51,101 +42,12 @@ def load_command_table(self, _): validator=process_ag_create_namespace, exception_handler=handle_template_based_exception) - with self.command_group("network application-gateway address-pool"): - from .custom import AddressPoolCreate, AddressPoolUpdate - self.command_table["network application-gateway address-pool create"] = AddressPoolCreate(loader=self) - self.command_table["network application-gateway address-pool update"] = AddressPoolUpdate(loader=self) - - with self.command_group("network application-gateway auth-cert"): - from .custom import AuthCertCreate, AuthCertUpdate - self.command_table["network application-gateway auth-cert create"] = AuthCertCreate(loader=self) - self.command_table["network application-gateway auth-cert update"] = AuthCertUpdate(loader=self) - - with self.command_group("network application-gateway root-cert"): - from .custom import RootCertCreate, RootCertUpdate - self.command_table["network application-gateway root-cert create"] = RootCertCreate(loader=self) - self.command_table["network application-gateway root-cert update"] = RootCertUpdate(loader=self) - - with self.command_group("network application-gateway client-cert"): - from .custom import ClientCertAdd, ClientCertUpdate - self.command_table["network application-gateway client-cert add"] = ClientCertAdd(loader=self) - self.command_table["network application-gateway client-cert update"] = ClientCertUpdate(loader=self) - - with self.command_group("network application-gateway frontend-ip"): - from .custom import FrontedIPCreate, FrontedIPUpdate - self.command_table["network application-gateway frontend-ip create"] = FrontedIPCreate(loader=self) - self.command_table["network application-gateway frontend-ip update"] = FrontedIPUpdate(loader=self) - - with self.command_group("network application-gateway settings"): - from .custom import SettingsCreate, SettingsUpdate - self.command_table["network application-gateway settings create"] = SettingsCreate(loader=self) - self.command_table["network application-gateway settings update"] = SettingsUpdate(loader=self) - - with self.command_group("network application-gateway http-settings"): - from .custom import HTTPSettingsCreate, HTTPSettingsUpdate - self.command_table["network application-gateway http-settings create"] = HTTPSettingsCreate(loader=self) - self.command_table["network application-gateway http-settings update"] = HTTPSettingsUpdate(loader=self) - - with self.command_group("network application-gateway listener"): - from .custom import ListenerCreate, ListenerUpdate - self.command_table["network application-gateway listener create"] = ListenerCreate(loader=self) - self.command_table["network application-gateway listener update"] = ListenerUpdate(loader=self) - - with self.command_group("network application-gateway http-listener"): - from .custom import HTTPListenerCreate, HTTPListenerUpdate - self.command_table["network application-gateway http-listener create"] = HTTPListenerCreate(loader=self) - self.command_table["network application-gateway http-listener update"] = HTTPListenerUpdate(loader=self) + with self.command_group("network application-gateway identity") as g: - from .custom import IdentityAssign - self.command_table["network application-gateway identity assign"] = IdentityAssign(loader=self) g.custom_command("remove", "remove_ag_identity", supports_no_wait=True) - with self.command_group("network application-gateway private-link"): - from .custom import AGPrivateLinkAdd, AGPrivateLinkRemove, AGPrivateLinkIPConfigAdd - self.command_table["network application-gateway private-link add"] = AGPrivateLinkAdd(loader=self) - self.command_table["network application-gateway private-link remove"] = AGPrivateLinkRemove(loader=self) - self.command_table["network application-gateway private-link ip-config add"] = AGPrivateLinkIPConfigAdd(loader=self) - - with self.command_group("network application-gateway redirect-config"): - from .custom import RedirectConfigCreate, RedirectConfigUpdate - self.command_table["network application-gateway redirect-config create"] = RedirectConfigCreate(loader=self) - self.command_table["network application-gateway redirect-config update"] = RedirectConfigUpdate(loader=self) - - with self.command_group("network application-gateway rewrite-rule"): - from .custom import AGRewriteRuleCreate, AGRewriteRuleUpdate - self.command_table["network application-gateway rewrite-rule create"] = AGRewriteRuleCreate(loader=self) - self.command_table["network application-gateway rewrite-rule update"] = AGRewriteRuleUpdate(loader=self) - - with self.command_group("network application-gateway routing-rule"): - from .custom import RoutingRuleCreate, RoutingRuleUpdate - self.command_table["network application-gateway routing-rule create"] = RoutingRuleCreate(loader=self) - self.command_table["network application-gateway routing-rule update"] = RoutingRuleUpdate(loader=self) - - with self.command_group("network application-gateway rule"): - from .custom import RuleCreate, RuleUpdate - self.command_table["network application-gateway rule create"] = RuleCreate(loader=self) - self.command_table["network application-gateway rule update"] = RuleUpdate(loader=self) - - with self.command_group("network application-gateway ssl-cert"): - from .custom import SSLCertCreate, SSLCertUpdate - self.command_table["network application-gateway ssl-cert create"] = SSLCertCreate(loader=self) - self.command_table["network application-gateway ssl-cert update"] = SSLCertUpdate(loader=self) - - with self.command_group("network application-gateway ssl-policy"): - from .custom import SSLPolicySet - self.command_table["network application-gateway ssl-policy set"] = SSLPolicySet(loader=self) - - with self.command_group("network application-gateway ssl-profile"): - from .custom import SSLProfileAdd, SSLProfileUpdate - self.command_table["network application-gateway ssl-profile add"] = SSLProfileAdd(loader=self) - self.command_table["network application-gateway ssl-profile update"] = SSLProfileUpdate(loader=self) - - with self.command_group("network application-gateway url-path-map"): - from .custom import URLPathMapCreate, URLPathMapUpdate, URLPathMapRuleCreate - self.command_table["network application-gateway url-path-map create"] = URLPathMapCreate(loader=self) - self.command_table["network application-gateway url-path-map update"] = URLPathMapUpdate(loader=self) - self.command_table["network application-gateway url-path-map rule create"] = URLPathMapRuleCreate(loader=self) + with self.command_group("network application-gateway waf-config") as g: g.custom_command("list-rule-sets", "list_ag_waf_rule_sets", table_transformer=transform_waf_rule_sets_table_output) @@ -154,13 +56,6 @@ def load_command_table(self, _): # endregion # region ApplicationGatewayWAFPolicy - with self.command_group("network application-gateway waf-policy"): - from .custom import WAFCreate - self.command_table["network application-gateway waf-policy create"] = WAFCreate(loader=self) - - with self.command_group("network application-gateway waf-policy custom-rule match-condition"): - from .custom import WAFCustomRuleMatchConditionAdd - self.command_table["network application-gateway waf-policy custom-rule match-condition add"] = WAFCustomRuleMatchConditionAdd(loader=self) with self.command_group("network application-gateway waf-policy managed-rule exception") as g: g.custom_command("remove", "remove_waf_managed_rule_exception") @@ -182,8 +77,6 @@ def load_command_table(self, _): g.custom_command("update", "update_waf_managed_rule_set", validator=process_appgw_waf_policy_update) with self.command_group("network application-gateway waf-policy policy-setting") as g: - from .custom import WAFPolicySettingUpdate - self.command_table["network application-gateway waf-policy policy-setting update"] = WAFPolicySettingUpdate(loader=self) g.custom_command("list", "list_waf_policy_setting") # endregion @@ -194,9 +87,6 @@ def load_command_table(self, _): # endregion # region DNS - from .operations.dns import DNSListReferences - self.command_table["network dns list-references"] = DNSListReferences(loader=self) - with self.command_group('network dns zone') as g: g.custom_command('import', 'import_zone') g.custom_command('export', 'export_zone') @@ -216,176 +106,18 @@ def load_command_table(self, _): with self.command_group('network dns record-set cname') as g: g.custom_command('set-record', 'add_dns_cname_record', transform=transform_dns_record_set_output) g.custom_command('remove-record', 'remove_dns_cname_record', transform=transform_dns_record_set_output) - - from .operations.dns import RecordSetAShow as DNSRecordSetAShow, RecordSetAAAAShow as DNSRecordSetAAAAShow, \ - RecordSetDSShow as DNSRecordSetDSShow, RecordSetMXShow as DNSRecordSetMXShow, \ - RecordSetNAPTRShow as DNSRecordSetNAPTRShow, RecordSetNSShow as DNSRecordSetNSShow, \ - RecordSetPTRShow as DNSRecordSetPTRShow, RecordSetSRVShow as DNSRecordSetSRVShow, \ - RecordSetTLSAShow as DNSRecordSetTLSAShow, RecordSetTXTShow as DNSRecordSetTXTShow, \ - RecordSetCAAShow as DNSRecordSetCAAShow, RecordSetCNAMEShow as DNSRecordSetCNAMEShow, \ - RecordSetSOAShow as DNSRecordSetSOAShow - self.command_table["network dns record-set a show"] = DNSRecordSetAShow(loader=self) - self.command_table["network dns record-set aaaa show"] = DNSRecordSetAAAAShow(loader=self) - self.command_table["network dns record-set ds show"] = DNSRecordSetDSShow(loader=self) - self.command_table["network dns record-set mx show"] = DNSRecordSetMXShow(loader=self) - self.command_table["network dns record-set naptr show"] = DNSRecordSetNAPTRShow(loader=self) - self.command_table["network dns record-set ns show"] = DNSRecordSetNSShow(loader=self) - self.command_table["network dns record-set ptr show"] = DNSRecordSetPTRShow(loader=self) - self.command_table["network dns record-set srv show"] = DNSRecordSetSRVShow(loader=self) - self.command_table["network dns record-set tlsa show"] = DNSRecordSetTLSAShow(loader=self) - self.command_table["network dns record-set txt show"] = DNSRecordSetTXTShow(loader=self) - self.command_table["network dns record-set caa show"] = DNSRecordSetCAAShow(loader=self) - self.command_table["network dns record-set cname show"] = DNSRecordSetCNAMEShow(loader=self) - self.command_table["network dns record-set soa show"] = DNSRecordSetSOAShow(loader=self) - - from .operations.dns import RecordSetAList as DNSRecordSetAList, RecordSetAAAAList as DNSRecordSetAAAAList, \ - RecordSetDSList as DNSRecordSetDSList, RecordSetMXList as DNSRecordSetMXList, \ - RecordSetNAPTRList as DNSRecordSetNAPTRList, RecordSetNSList as DNSRecordSetNSList, \ - RecordSetPTRList as DNSRecordSetPTRList, RecordSetSRVList as DNSRecordSetSRVList, \ - RecordSetTLSAList as DNSRecordSetTLSAList, RecordSetTXTList as DNSRecordSetTXTList, \ - RecordSetCAAList as DNSRecordSetCAAList, RecordSetCNAMEList as DNSRecordSetCNAMEList - self.command_table["network dns record-set a list"] = DNSRecordSetAList(loader=self) - self.command_table["network dns record-set aaaa list"] = DNSRecordSetAAAAList(loader=self) - self.command_table["network dns record-set ds list"] = DNSRecordSetDSList(loader=self) - self.command_table["network dns record-set mx list"] = DNSRecordSetMXList(loader=self) - self.command_table["network dns record-set naptr list"] = DNSRecordSetNAPTRList(loader=self) - self.command_table["network dns record-set ns list"] = DNSRecordSetNSList(loader=self) - self.command_table["network dns record-set ptr list"] = DNSRecordSetPTRList(loader=self) - self.command_table["network dns record-set srv list"] = DNSRecordSetSRVList(loader=self) - self.command_table["network dns record-set tlsa list"] = DNSRecordSetTLSAList(loader=self) - self.command_table["network dns record-set txt list"] = DNSRecordSetTXTList(loader=self) - self.command_table["network dns record-set caa list"] = DNSRecordSetCAAList(loader=self) - self.command_table["network dns record-set cname list"] = DNSRecordSetCNAMEList(loader=self) - - from .operations.dns import RecordSetACreate as DNSRecordSetACreate, RecordSetAAAACreate as DNSRecordSetAAAACreate, \ - RecordSetDSCreate as DNSRecordSetDSCreate, RecordSetMXCreate as DNSRecordSetMXCreate, \ - RecordSetNAPTRCreate as DNSRecordSetNAPTRCreate, RecordSetNSCreate as DNSRecordSetNSCreate, \ - RecordSetPTRCreate as DNSRecordSetPTRCreate, RecordSetSRVCreate as DNSRecordSetSRVCreate, \ - RecordSetTLSACreate as DNSRecordSetTLSACreate, RecordSetTXTCreate as DNSRecordSetTXTCreate, \ - RecordSetCAACreate as DNSRecordSetCAACreate, RecordSetCNAMECreate as DNSRecordSetCNAMECreate - self.command_table["network dns record-set a create"] = DNSRecordSetACreate(loader=self) - self.command_table["network dns record-set aaaa create"] = DNSRecordSetAAAACreate(loader=self) - self.command_table["network dns record-set ds create"] = DNSRecordSetDSCreate(loader=self) - self.command_table["network dns record-set mx create"] = DNSRecordSetMXCreate(loader=self) - self.command_table["network dns record-set naptr create"] = DNSRecordSetNAPTRCreate(loader=self) - self.command_table["network dns record-set ns create"] = DNSRecordSetNSCreate(loader=self) - self.command_table["network dns record-set ptr create"] = DNSRecordSetPTRCreate(loader=self) - self.command_table["network dns record-set srv create"] = DNSRecordSetSRVCreate(loader=self) - self.command_table["network dns record-set tlsa create"] = DNSRecordSetTLSACreate(loader=self) - self.command_table["network dns record-set txt create"] = DNSRecordSetTXTCreate(loader=self) - self.command_table["network dns record-set caa create"] = DNSRecordSetCAACreate(loader=self) - self.command_table["network dns record-set cname create"] = DNSRecordSetCNAMECreate(loader=self) - - from .operations.dns import RecordSetAUpdate as DNSRecordSetAUpdate, RecordSetAAAAUpdate as DNSRecordSetAAAAUpdate, \ - RecordSetDSUpdate as DNSRecordSetDSUpdate, RecordSetMXUpdate as DNSRecordSetMXUpdate, \ - RecordSetNAPTRUpdate as DNSRecordSetNAPTRUpdate, RecordSetNSUpdate as DNSRecordSetNSUpdate, \ - RecordSetPTRUpdate as DNSRecordSetPTRUpdate, RecordSetSRVUpdate as DNSRecordSetSRVUpdate, \ - RecordSetTLSAUpdate as DNSRecordSetTLSAUpdate, RecordSetTXTUpdate as DNSRecordSetTXTUpdate, \ - RecordSetCAAUpdate as DNSRecordSetCAAUpdate, RecordSetCNAMEUpdate as DNSRecordSetCNAMEUpdate - self.command_table["network dns record-set a update"] = DNSRecordSetAUpdate(loader=self) - self.command_table["network dns record-set aaaa update"] = DNSRecordSetAAAAUpdate(loader=self) - self.command_table["network dns record-set ds update"] = DNSRecordSetDSUpdate(loader=self) - self.command_table["network dns record-set mx update"] = DNSRecordSetMXUpdate(loader=self) - self.command_table["network dns record-set naptr update"] = DNSRecordSetNAPTRUpdate(loader=self) - self.command_table["network dns record-set ns update"] = DNSRecordSetNSUpdate(loader=self) - self.command_table["network dns record-set ptr update"] = DNSRecordSetPTRUpdate(loader=self) - self.command_table["network dns record-set srv update"] = DNSRecordSetSRVUpdate(loader=self) - self.command_table["network dns record-set tlsa update"] = DNSRecordSetTLSAUpdate(loader=self) - self.command_table["network dns record-set txt update"] = DNSRecordSetTXTUpdate(loader=self) - self.command_table["network dns record-set caa update"] = DNSRecordSetCAAUpdate(loader=self) - self.command_table["network dns record-set cname update"] = DNSRecordSetCNAMEUpdate(loader=self) - - from .operations.dns import RecordSetADelete as DNSRecordSetADelete, RecordSetAAAADelete as DNSRecordSetAAAADelete, \ - RecordSetDSDelete as DNSRecordSetDSDelete, RecordSetMXDelete as DNSRecordSetMXDelete, \ - RecordSetNAPTRDelete as DNSRecordSetNAPTRDelete, RecordSetNSDelete as DNSRecordSetNSDelete, \ - RecordSetPTRDelete as DNSRecordSetPTRDelete, RecordSetSRVDelete as DNSRecordSetSRVDelete, \ - RecordSetTLSADelete as DNSRecordSetTLSADelete, RecordSetTXTDelete as DNSRecordSetTXTDelete, \ - RecordSetCAADelete as DNSRecordSetCAADelete, RecordSetCNAMEDelete as DNSRecordSetCNAMEDelete - self.command_table["network dns record-set a delete"] = DNSRecordSetADelete(loader=self) - self.command_table["network dns record-set aaaa delete"] = DNSRecordSetAAAADelete(loader=self) - self.command_table["network dns record-set ds delete"] = DNSRecordSetDSDelete(loader=self) - self.command_table["network dns record-set mx delete"] = DNSRecordSetMXDelete(loader=self) - self.command_table["network dns record-set naptr delete"] = DNSRecordSetNAPTRDelete(loader=self) - self.command_table["network dns record-set ns delete"] = DNSRecordSetNSDelete(loader=self) - self.command_table["network dns record-set ptr delete"] = DNSRecordSetPTRDelete(loader=self) - self.command_table["network dns record-set srv delete"] = DNSRecordSetSRVDelete(loader=self) - self.command_table["network dns record-set tlsa delete"] = DNSRecordSetTLSADelete(loader=self) - self.command_table["network dns record-set txt delete"] = DNSRecordSetTXTDelete(loader=self) - self.command_table["network dns record-set caa delete"] = DNSRecordSetCAADelete(loader=self) - self.command_table["network dns record-set cname delete"] = DNSRecordSetCNAMEDelete(loader=self) # endregion # region ExpressRoutes - with self.command_group('network express-route'): - from .custom import ExpressRouteCreate, ExpressRouteUpdate - self.command_table['network express-route create'] = ExpressRouteCreate(loader=self) - self.command_table['network express-route update'] = ExpressRouteUpdate(loader=self) - - with self.command_group('network express-route gateway'): - from .custom import ExpressRouteGatewayCreate, ExpressRouteGatewayUpdate - self.command_table['network express-route gateway create'] = ExpressRouteGatewayCreate(loader=self) - self.command_table['network express-route gateway update'] = ExpressRouteGatewayUpdate(loader=self) - - with self.command_group('network express-route gateway connection'): - from .custom import ExpressRouteConnectionUpdate, ExpressRouteConnectionCreate - self.command_table['network express-route gateway connection create'] = ExpressRouteConnectionCreate(loader=self) - self.command_table['network express-route gateway connection update'] = ExpressRouteConnectionUpdate(loader=self) - - with self.command_group('network express-route peering'): - from .custom import ExpressRoutePeeringCreate, ExpressRoutePeeringUpdate - self.command_table['network express-route peering create'] = ExpressRoutePeeringCreate(loader=self) - self.command_table['network express-route peering update'] = ExpressRoutePeeringUpdate(loader=self) - - with self.command_group('network express-route peering connection'): - from .custom import ExpressRoutePeeringConnectionCreate - self.command_table['network express-route peering connection create'] = ExpressRoutePeeringConnectionCreate(loader=self) with self.command_group('network express-route port') as g: - from .custom import ExpressRoutePortCreate - self.command_table['network express-route port create'] = ExpressRoutePortCreate(loader=self) g.custom_command('generate-loa', 'download_generated_loa_as_pdf') - - with self.command_group('network express-route port identity'): - from .custom import ExpressRoutePortIdentityAssign - self.command_table['network express-route port identity assign'] = ExpressRoutePortIdentityAssign(loader=self) - - with self.command_group('network express-route port link'): - from .custom import ExpressRoutePortLinkUpdate - self.command_table['network express-route port link update'] = ExpressRoutePortLinkUpdate(loader=self) # endregion # region PrivateEndpoint - with self.command_group('network private-endpoint'): - from azure.cli.command_modules.network.custom import PrivateEndpointCreate, PrivateEndpointUpdate - self.command_table['network private-endpoint create'] = PrivateEndpointCreate(loader=self) - self.command_table['network private-endpoint update'] = PrivateEndpointUpdate(loader=self) - - with self.command_group('network private-endpoint dns-zone-group'): - from azure.cli.command_modules.network.custom import PrivateEndpointPrivateDnsZoneGroupCreate, \ - PrivateEndpointPrivateDnsZoneAdd - self.command_table['network private-endpoint dns-zone-group create'] = \ - PrivateEndpointPrivateDnsZoneGroupCreate(loader=self) - self.command_table['network private-endpoint dns-zone-group add'] = \ - PrivateEndpointPrivateDnsZoneAdd(loader=self) - - with self.command_group('network private-endpoint ip-config'): - from azure.cli.command_modules.network.custom import PrivateEndpointIpConfigAdd - self.command_table['network private-endpoint ip-config add'] = PrivateEndpointIpConfigAdd(loader=self) - - with self.command_group('network private-endpoint asg'): - from azure.cli.command_modules.network.custom import PrivateEndpointAsgAdd - self.command_table['network private-endpoint asg add'] = PrivateEndpointAsgAdd(loader=self) # endregion # region PrivateLinkServices - with self.command_group('network private-link-service'): - from azure.cli.command_modules.network.custom import PrivateLinkServiceCreate, PrivateLinkServiceUpdate - self.command_table['network private-link-service create'] = PrivateLinkServiceCreate(loader=self) - self.command_table['network private-link-service update'] = PrivateLinkServiceUpdate(loader=self) - - with self.command_group('network private-link-service connection'): - from azure.cli.command_modules.network.custom import PrivateEndpointConnectionUpdate - self.command_table['network private-link-service connection update'] = PrivateEndpointConnectionUpdate(loader=self) # endregion # region LoadBalancers @@ -397,236 +129,48 @@ def load_command_table(self, _): validator=process_lb_create_namespace, exception_handler=handle_template_based_exception) g.custom_command('list-mapping', 'list_load_balancer_mapping') - - from .operations.load_balancer import LBFrontendIPCreate, LBFrontendIPUpdate - self.command_table["network lb frontend-ip create"] = LBFrontendIPCreate(loader=self) - self.command_table["network lb frontend-ip update"] = LBFrontendIPUpdate(loader=self) - - from .operations.load_balancer import LBInboundNatRuleCreate, LBInboundNatRuleUpdate - self.command_table["network lb inbound-nat-rule create"] = LBInboundNatRuleCreate(loader=self) - self.command_table["network lb inbound-nat-rule update"] = LBInboundNatRuleUpdate(loader=self) - - from .operations.load_balancer import LBInboundNatPoolCreate, LBInboundNatPoolUpdate - self.command_table["network lb inbound-nat-pool create"] = LBInboundNatPoolCreate(loader=self) - self.command_table["network lb inbound-nat-pool update"] = LBInboundNatPoolUpdate(loader=self) - - from .operations.load_balancer import LBRuleCreate, LBRuleUpdate - self.command_table["network lb rule create"] = LBRuleCreate(loader=self) - self.command_table["network lb rule update"] = LBRuleUpdate(loader=self) - - from .operations.load_balancer import LBOutboundRuleCreate, LBOutboundRuleUpdate - self.command_table["network lb outbound-rule create"] = LBOutboundRuleCreate(loader=self) - self.command_table["network lb outbound-rule update"] = LBOutboundRuleUpdate(loader=self) - - from .operations.load_balancer import LBAddressPoolCreate, LBAddressPoolDelete, LBAddressPoolUpdate - self.command_table["network lb address-pool create"] = LBAddressPoolCreate(loader=self) - self.command_table["network lb address-pool delete"] = LBAddressPoolDelete(loader=self) - self.command_table["network lb address-pool update"] = LBAddressPoolUpdate(loader=self) - - from .operations.load_balancer import LBAddressPoolAddressAdd, LBAddressPoolAddressUpdate - self.command_table["network lb address-pool address add"] = LBAddressPoolAddressAdd(loader=self) - self.command_table["network lb address-pool address update"] = LBAddressPoolAddressUpdate(loader=self) - - from .operations.load_balancer import LBAddressPoolTunnelInterfaceAdd, LBAddressPoolTunnelInterfaceUpdate - self.command_table["network lb address-pool tunnel-interface add"] = LBAddressPoolTunnelInterfaceAdd(loader=self) - self.command_table["network lb address-pool tunnel-interface update"] = LBAddressPoolTunnelInterfaceUpdate(loader=self) - - from .operations.load_balancer import LBProbeCreate, LBProbeUpdate - self.command_table["network lb probe create"] = LBProbeCreate(loader=self) - self.command_table["network lb probe update"] = LBProbeUpdate(loader=self) - # endregion # region cross-region load balancer with self.command_group('network cross-region-lb') as g: g.custom_command('create', 'create_cross_region_load_balancer', transform=DeploymentOutputLongRunningOperation(self.cli_ctx), supports_no_wait=True, table_transformer=deployment_validate_table_format, validator=process_cross_region_lb_create_namespace, exception_handler=handle_template_based_exception) - - from .aaz.latest.network.lb._wait import Wait - from .operations.load_balancer import CrossRegionLoadBalancerShow, CrossRegionLoadBalancerDelete, CrossRegionLoadBalancerUpdate, CrossRegionLoadBalancerList - self.command_table['network cross-region-lb show'] = CrossRegionLoadBalancerShow(loader=self) - self.command_table['network cross-region-lb delete'] = CrossRegionLoadBalancerDelete(loader=self) - self.command_table['network cross-region-lb list'] = CrossRegionLoadBalancerList(loader=self) - self.command_table['network cross-region-lb update'] = CrossRegionLoadBalancerUpdate(loader=self) - self.command_table['network cross-region-lb wait'] = Wait(loader=self) - - with self.command_group('network cross-region-lb frontend-ip') as g: - from .operations.load_balancer import CrossRegionLoadBalancerFrontendIPShow, CrossRegionLoadBalancerFrontendIPList, CrossRegionLoadBalancerFrontendIPDelete, CrossRegionLoadBalancerFrontendIPCreate, CrossRegionLoadBalancerFrontendIPUpdate - self.command_table['network cross-region-lb frontend-ip show'] = CrossRegionLoadBalancerFrontendIPShow(loader=self) - self.command_table['network cross-region-lb frontend-ip delete'] = CrossRegionLoadBalancerFrontendIPDelete(loader=self) - self.command_table['network cross-region-lb frontend-ip list'] = CrossRegionLoadBalancerFrontendIPList(loader=self) - self.command_table['network cross-region-lb frontend-ip create'] = CrossRegionLoadBalancerFrontendIPCreate(loader=self) - self.command_table['network cross-region-lb frontend-ip update'] = CrossRegionLoadBalancerFrontendIPUpdate(loader=self) - - with self.command_group('network cross-region-lb rule') as g: - from .operations.load_balancer import CrossRegionLoadBalancerRuleShow, CrossRegionLoadBalancerRuleDelete, CrossRegionLoadBalancerRuleList, CrossRegionLoadBalancerRuleCreate, CrossRegionLoadBalancerRuleUpdate - self.command_table['network cross-region-lb rule show'] = CrossRegionLoadBalancerRuleShow(loader=self) - self.command_table['network cross-region-lb rule delete'] = CrossRegionLoadBalancerRuleDelete(loader=self) - self.command_table['network cross-region-lb rule list'] = CrossRegionLoadBalancerRuleList(loader=self) - self.command_table['network cross-region-lb rule create'] = CrossRegionLoadBalancerRuleCreate(loader=self) - self.command_table['network cross-region-lb rule update'] = CrossRegionLoadBalancerRuleUpdate(loader=self) - - with self.command_group('network cross-region-lb address-pool') as g: - from .operations.load_balancer import CrossRegionLoadBalancerAddressPoolCreate, CrossRegionLoadBalancerAddressPoolUpdate, CrossRegionLoadBalancerAddressPoolList, CrossRegionLoadBalancerAddressPoolDelete, CrossRegionLoadBalancerAddressPoolShow - self.command_table['network cross-region-lb address-pool show'] = CrossRegionLoadBalancerAddressPoolShow(loader=self) - self.command_table['network cross-region-lb address-pool delete'] = CrossRegionLoadBalancerAddressPoolDelete(loader=self) - self.command_table['network cross-region-lb address-pool list'] = CrossRegionLoadBalancerAddressPoolList(loader=self) - self.command_table['network cross-region-lb address-pool create'] = CrossRegionLoadBalancerAddressPoolCreate(loader=self) - self.command_table['network cross-region-lb address-pool update'] = CrossRegionLoadBalancerAddressPoolUpdate(loader=self) - - with self.command_group('network cross-region-lb address-pool address') as g: - from .operations.load_balancer import CrossRegionLoadBalancerAddressPoolAddressAdd, CrossRegionLoadBalancerAddressPoolAddressUpdate, CrossRegionLoadBalancerAddressPoolAddressRemove, CrossRegionLoadBalancerAddressPoolAddressList, CrossRegionLoadBalancerAddressPoolAddressShow - self.command_table['network cross-region-lb address-pool address add'] = CrossRegionLoadBalancerAddressPoolAddressAdd(loader=self) - self.command_table['network cross-region-lb address-pool address remove'] = CrossRegionLoadBalancerAddressPoolAddressRemove(loader=self) - self.command_table['network cross-region-lb address-pool address update'] = CrossRegionLoadBalancerAddressPoolAddressUpdate(loader=self) - self.command_table['network cross-region-lb address-pool address list'] = CrossRegionLoadBalancerAddressPoolAddressList(loader=self) - self.command_table['network cross-region-lb address-pool address show'] = CrossRegionLoadBalancerAddressPoolAddressShow(loader=self) # endregion # region LocalGateways - with self.command_group('network local-gateway'): - from .aaz.latest.network.local_gateway._list import List - self.command_table['network local-gateway list'] = List(loader=self, table_transformer=transform_local_gateway_table_output) # endregion # region NetworkInterfaces: (NIC) - with self.command_group("network nic"): - from .aaz.latest.network.nic._list_effective_nsg import ListEffectiveNsg - from .aaz.latest.network.nic._show_effective_route_table import ShowEffectiveRouteTable - from .custom import NICCreate, NICUpdate - self.command_table["network nic create"] = NICCreate(loader=self) - self.command_table["network nic update"] = NICUpdate(loader=self) - self.command_table["network nic list-effective-nsg"] = ListEffectiveNsg(loader=self, table_transformer=transform_effective_nsg) - self.command_table["network nic show-effective-route-table"] = ShowEffectiveRouteTable(loader=self, table_transformer=transform_effective_route_table) - - with self.command_group("network nic ip-config"): - from .custom import NICIPConfigCreate, NICIPConfigUpdate, NICIPConfigNATAdd, NICIPConfigNATRemove - self.command_table["network nic ip-config create"] = NICIPConfigCreate(loader=self) - self.command_table["network nic ip-config update"] = NICIPConfigUpdate(loader=self) - self.command_table["network nic ip-config inbound-nat-rule add"] = NICIPConfigNATAdd(loader=self) - self.command_table["network nic ip-config inbound-nat-rule remove"] = NICIPConfigNATRemove(loader=self) - with self.command_group("network nic ip-config address-pool") as g: g.custom_command("add", "add_nic_ip_config_address_pool") g.custom_command("remove", "remove_nic_ip_config_address_pool") # endregion # region NetworkSecurityGroups - with self.command_group("network nsg") as g: - from .custom import NSGCreate - self.command_table["network nsg create"] = NSGCreate(loader=self) with self.command_group("network nsg rule") as g: - from .custom import NSGRuleCreate, NSGRuleUpdate - from .aaz.latest.network.nsg.rule._show import Show - self.command_table["network nsg rule create"] = NSGRuleCreate(loader=self) - self.command_table["network nsg rule update"] = NSGRuleUpdate(loader=self) - self.command_table["network nsg rule show"] = Show(loader=self, table_transformer=transform_nsg_rule_table_output) g.custom_command("list", "list_nsg_rules", table_transformer=lambda x: [transform_nsg_rule_table_output(i) for i in x]) # endregion # region NetworkWatchers with self.command_group("network watcher") as g: - from .operations.watcher import RunConfigurationDiagnostic, ShowNextHop, ShowSecurityGroupView, ShowTopology, TestConnectivity, TestIPFlow - self.command_table["network watcher test-ip-flow"] = TestIPFlow(loader=self) - self.command_table["network watcher show-next-hop"] = ShowNextHop(loader=self) - self.command_table["network watcher show-security-group-view"] = ShowSecurityGroupView(loader=self) - self.command_table["network watcher run-configuration-diagnostic"] = RunConfigurationDiagnostic(loader=self) - self.command_table["network watcher show-topology"] = ShowTopology(loader=self) - self.command_table["network watcher test-connectivity"] = TestConnectivity(loader=self) g.custom_command("configure", "configure_network_watcher") - from .operations.watcher import WatcherConnectionMonitorStart, WatcherConnectionMonitorStop, \ - WatcherConnectionMonitorList, WatcherConnectionMonitorQuery, WatcherConnectionMonitorShow, \ - WatcherConnectionMonitorDelete, WatcherConnectionMonitorCreate - self.command_table["network watcher connection-monitor create"] = WatcherConnectionMonitorCreate(loader=self) - self.command_table["network watcher connection-monitor start"] = WatcherConnectionMonitorStart(loader=self) - self.command_table["network watcher connection-monitor stop"] = WatcherConnectionMonitorStop(loader=self) - self.command_table["network watcher connection-monitor list"] = WatcherConnectionMonitorList(loader=self) - self.command_table["network watcher connection-monitor query"] = WatcherConnectionMonitorQuery(loader=self) - self.command_table["network watcher connection-monitor delete"] = WatcherConnectionMonitorDelete(loader=self) - self.command_table["network watcher connection-monitor show"] = WatcherConnectionMonitorShow(loader=self) - - from .operations.watcher import WatcherConnectionMonitorEndpointAdd, WatcherConnectionMonitorEndpointShow, \ - WatcherConnectionMonitorEndpointList, WatcherConnectionMonitorEndpointRemove - self.command_table["network watcher connection-monitor endpoint add"] = WatcherConnectionMonitorEndpointAdd( - loader=self) - self.command_table["network watcher connection-monitor endpoint remove"] = WatcherConnectionMonitorEndpointRemove( - loader=self) - self.command_table["network watcher connection-monitor endpoint show"] = WatcherConnectionMonitorEndpointShow( - loader=self) - self.command_table["network watcher connection-monitor endpoint list"] = WatcherConnectionMonitorEndpointList( - loader=self) - - from .operations.watcher import WatcherConnectionMonitorTestConfigurationAdd as WCMTAdd, \ - WatcherConnectionMonitorTestConfigurationShow as WCMTCShow, \ - WatcherConnectionMonitorTestConfigurationList as WCMTCList, \ - WatcherConnectionMonitorTestConfigurationRemove as WCMTRemove - self.command_table["network watcher connection-monitor test-configuration add"] = WCMTAdd(loader=self) - self.command_table["network watcher connection-monitor test-configuration remove"] = WCMTRemove(loader=self) - self.command_table["network watcher connection-monitor test-configuration show"] = WCMTCShow(loader=self) - self.command_table["network watcher connection-monitor test-configuration list"] = WCMTCList(loader=self) - with self.command_group('network watcher connection-monitor test-group', is_preview=True) as c: - from .operations.watcher import WatcherConnectionMonitorTestGroupAdd as WCMTGAdd, \ - WatcherConnectionMonitorTestGroupShow as WCMTGShow, \ - WatcherConnectionMonitorTestGroupList as WCMTGList - self.command_table["network watcher connection-monitor test-group add"] = WCMTGAdd(loader=self) - self.command_table["network watcher connection-monitor test-group show"] = WCMTGShow(loader=self) - self.command_table["network watcher connection-monitor test-group list"] = WCMTGList(loader=self) c.custom_command('remove', 'remove_nw_connection_monitor_test_group') with self.command_group('network watcher connection-monitor output', is_preview=True) as c: - from .operations.watcher import WatcherConnectionMonitorOutputAdd, WatcherConnectionMonitorOutputList - self.command_table["network watcher connection-monitor output add"] = WatcherConnectionMonitorOutputAdd( - loader=self) - self.command_table["network watcher connection-monitor output list"] = WatcherConnectionMonitorOutputList( - loader=self) c.custom_command('remove', 'remove_nw_connection_monitor_output') - with self.command_group("network watcher packet-capture"): - from .operations.watcher import PacketCaptureCreate, PacketCaptureDelete, PacketCaptureList, PacketCaptureShow, PacketCaptureShowStatus, PacketCaptureStop - self.command_table["network watcher packet-capture create"] = PacketCaptureCreate(loader=self) - self.command_table["network watcher packet-capture delete"] = PacketCaptureDelete(loader=self) - self.command_table["network watcher packet-capture list"] = PacketCaptureList(loader=self) - self.command_table["network watcher packet-capture show"] = PacketCaptureShow(loader=self) - self.command_table["network watcher packet-capture show-status"] = PacketCaptureShowStatus(loader=self) - self.command_table["network watcher packet-capture stop"] = PacketCaptureStop(loader=self) - with self.command_group('network watcher flow-log') as g: - from .operations.watcher import NwFlowLogCreate, NwFlowLogUpdate, NwFlowLogList, NwFlowLogDelete - self.command_table["network watcher flow-log create"] = NwFlowLogCreate(loader=self) - self.command_table["network watcher flow-log update"] = NwFlowLogUpdate(loader=self) - self.command_table["network watcher flow-log list"] = NwFlowLogList(loader=self) - self.command_table["network watcher flow-log delete"] = NwFlowLogDelete(loader=self) g.custom_show_command('show', 'show_nw_flow_logging', validator=process_nw_flow_log_show_namespace) - - with self.command_group('network watcher troubleshooting'): - from .operations.watcher import NwTroubleshootingStart, NwTroubleshootingShow - self.command_table["network watcher troubleshooting start"] = NwTroubleshootingStart(loader=self) - self.command_table["network watcher troubleshooting show"] = NwTroubleshootingShow(loader=self) # endregion # region PublicIPAddresses - public_ip_show_table_transform = '{Name:name, ResourceGroup:resourceGroup, Location:location, $zone$Address:ipAddress, AddressVersion:publicIpAddressVersion, AllocationMethod:publicIpAllocationMethod, IdleTimeoutInMinutes:idleTimeoutInMinutes, ProvisioningState:provisioningState}' - public_ip_show_table_transform = public_ip_show_table_transform.replace('$zone$', 'Zones: (!zones && \' \') || join(` `, zones), ') - with self.command_group('network public-ip') as g: - from .aaz.latest.network.public_ip._list import List - from .aaz.latest.network.public_ip._show import Show - from .custom import PublicIPUpdate - self.command_table['network public-ip update'] = PublicIPUpdate(loader=self) - self.command_table['network public-ip list'] = List(loader=self, table_transformer='[].' + public_ip_show_table_transform) - self.command_table['network public-ip show'] = Show(loader=self, table_transformer=public_ip_show_table_transform) g.custom_command('create', 'create_public_ip', transform=transform_public_ip_create_output, validator=process_public_ip_create_namespace) - - with self.command_group('network public-ip prefix'): - from azure.cli.command_modules.network.custom import PublicIpPrefixCreate - self.command_table['network public-ip prefix create'] = PublicIpPrefixCreate(loader=self) # endregion # region RouteFilters - from .aaz.latest.network.route_filter.rule._list_service_communities import ListServiceCommunities - self.command_table['network route-filter rule list-service-communities'] = ListServiceCommunities(loader=self, table_transformer=transform_service_community_table_output) # endregion # region TrafficManagers @@ -639,112 +183,38 @@ def load_command_table(self, _): g.custom_command('update', 'update_traffic_manager_endpoint') g.custom_command('list', 'list_traffic_manager_endpoints') - from .aaz.latest.network.traffic_manager.endpoint._show_geographic_hierarchy import ShowGeographicHierarchy - self.command_table['network traffic-manager endpoint show-geographic-hierarchy'] = ShowGeographicHierarchy(loader=self, table_transformer=transform_geographic_hierachy_table_output) # endregion # region VirtualNetworks with self.command_group("network vnet") as g: - from .aaz.latest.network.vnet._list import List - from .custom import VNetCreate, VNetUpdate - self.command_table["network vnet create"] = VNetCreate(loader=self) - self.command_table["network vnet update"] = VNetUpdate(loader=self) - self.command_table['network vnet list'] = List(loader=self, table_transformer=transform_vnet_table_output) g.custom_command("list-available-ips", "list_available_ips", is_preview=True) with self.command_group("network vnet peering") as g: - from .custom import VNetPeeringCreate - self.command_table["network vnet peering create"] = VNetPeeringCreate(loader=self) g.custom_command("sync", "sync_vnet_peering") with self.command_group("network vnet subnet") as g: - from .custom import VNetSubnetCreate, VNetSubnetUpdate - self.command_table["network vnet subnet create"] = VNetSubnetCreate(loader=self) - self.command_table["network vnet subnet update"] = VNetSubnetUpdate(loader=self) g.custom_command("list-available-ips", "subnet_list_available_ips", is_preview=True) # endregion # region VirtualNetworkGateways - with self.command_group('network vnet-gateway'): - from .custom import VnetGatewayCreate, VnetGatewayUpdate, VnetGatewayVpnConnectionsDisconnect, VNetGatewayShow, VNetGatewayList - from .aaz.latest.network.vnet_gateway._list_bgp_peer_status import ListBgpPeerStatus - from .aaz.latest.network.vnet_gateway._list_advertised_routes import ListAdvertisedRoutes - from .aaz.latest.network.vnet_gateway._list_learned_routes import ListLearnedRoutes - self.command_table['network vnet-gateway create'] = VnetGatewayCreate(loader=self) - self.command_table['network vnet-gateway update'] = VnetGatewayUpdate(loader=self) - self.command_table['network vnet-gateway disconnect-vpn-connections'] = VnetGatewayVpnConnectionsDisconnect(loader=self) - self.command_table["network vnet-gateway show"] = VNetGatewayShow(loader=self) - self.command_table["network vnet-gateway list"] = VNetGatewayList(loader=self) - self.command_table['network vnet-gateway list-bgp-peer-status'] = ListBgpPeerStatus(loader=self, table_transformer=transform_vnet_gateway_bgp_peer_table) - self.command_table['network vnet-gateway list-advertised-routes'] = ListAdvertisedRoutes(loader=self, table_transformer=transform_vnet_gateway_routes_table) - self.command_table['network vnet-gateway list-learned-routes'] = ListLearnedRoutes(loader=self, table_transformer=transform_vnet_gateway_routes_table) - - with self.command_group('network vnet-gateway migration') as g: - from .operations.vnet_gateway_migration import VNetGatewayMigrationAbort, VNetGatewayMigrationExecute, \ - VNetGatewayMigrationCommit, VNetGatewayMigrationPrepare - self.command_table['network vnet-gateway migration abort'] = VNetGatewayMigrationAbort(loader=self) - self.command_table['network vnet-gateway migration execute'] = VNetGatewayMigrationExecute(loader=self) - self.command_table['network vnet-gateway migration commit'] = VNetGatewayMigrationCommit(loader=self) - self.command_table['network vnet-gateway migration prepare'] = VNetGatewayMigrationPrepare(loader=self) - - with self.command_group('network vnet-gateway packet-capture'): - from .aaz.latest.network.vnet_gateway._wait import Wait - self.command_table['network vnet-gateway packet-capture wait'] = Wait(loader=self) - with self.command_group('network vnet-gateway vpn-client') as g: g.custom_command('generate', 'generate_vpn_client') - with self.command_group('network vnet-gateway vpn-client ipsec-policy'): - from .aaz.latest.network.vnet_gateway._wait import Wait - self.command_table['network vnet-gateway vpn-client ipsec-policy wait'] = Wait(loader=self) - - with self.command_group('network vnet-gateway revoked-cert'): - from .custom import VnetGatewayRevokedCertCreate - self.command_table['network vnet-gateway revoked-cert create'] = VnetGatewayRevokedCertCreate(loader=self) - - with self.command_group('network vnet-gateway root-cert'): - from .custom import VnetGatewayRootCertCreate - self.command_table['network vnet-gateway root-cert create'] = VnetGatewayRootCertCreate(loader=self) - with self.command_group('network vnet-gateway ipsec-policy') as g: - from .custom import VnetGatewayIpsecPolicyAdd - self.command_table['network vnet-gateway ipsec-policy add'] = VnetGatewayIpsecPolicyAdd(loader=self) g.custom_command('clear', 'clear_vnet_gateway_ipsec_policies', supports_no_wait=True) with self.command_group('network vnet-gateway aad') as g: - from .custom import VnetGatewayAadAssign - self.command_table['network vnet-gateway aad assign'] = VnetGatewayAadAssign(loader=self) g.custom_command('remove', 'remove_vnet_gateway_aad', supports_no_wait=True) - - with self.command_group('network vnet-gateway nat-rule'): - from .custom import VnetGatewayNatRuleAdd, VnetGatewayNatRuleShow, VnetGatewayNatRuleRemove - self.command_table['network vnet-gateway nat-rule add'] = VnetGatewayNatRuleAdd(loader=self) - self.command_table['network vnet-gateway nat-rule list'] = VnetGatewayNatRuleShow(loader=self) - self.command_table['network vnet-gateway nat-rule remove'] = VnetGatewayNatRuleRemove(loader=self) # endregion # region VirtualNetworkGatewayConnections with self.command_group('network vpn-connection') as g: - from .custom import VpnConnectionUpdate, VpnConnectionDeviceConfigScriptShow - self.command_table['network vpn-connection update'] = VpnConnectionUpdate(loader=self) - self.command_table['network vpn-connection show-device-config-script'] = VpnConnectionDeviceConfigScriptShow(loader=self) g.custom_command('create', 'create_vpn_connection', transform=DeploymentOutputLongRunningOperation(self.cli_ctx), table_transformer=deployment_validate_table_format, validator=process_vpn_connection_create_namespace, exception_handler=handle_template_based_exception) g.custom_command('list', 'list_vpn_connections') - with self.command_group('network vpn-connection shared-key'): - from .custom import VpnConnSharedKeyUpdate - self.command_table['network vpn-connection shared-key update'] = VpnConnSharedKeyUpdate(loader=self) - with self.command_group('network vpn-connection ipsec-policy') as g: - from .custom import VpnConnIpsecPolicyAdd - self.command_table['network vpn-connection ipsec-policy add'] = VpnConnIpsecPolicyAdd(loader=self) g.custom_command('clear', 'clear_vpn_conn_ipsec_policies', supports_no_wait=True) - with self.command_group('network vpn-connection packet-capture'): - from .custom import VpnConnPackageCaptureStop - from .aaz.latest.network.vpn_connection._wait import Wait - self.command_table['network vpn-connection packet-capture stop'] = VpnConnPackageCaptureStop(loader=self) - self.command_table['network vpn-connection packet-capture wait'] = Wait(loader=self) # endregion # region VirtualHub @@ -765,28 +235,6 @@ def load_command_table(self, _): g.custom_command('list', 'list_private_endpoint_connection') # endregion - # region NatGateway - from .operations.nat import GatewayCreate as NATGatewayCreate, GatewayUpdate as NATGatewayUpdate - self.command_table["network nat gateway create"] = NATGatewayCreate(loader=self) - self.command_table["network nat gateway update"] = NATGatewayUpdate(loader=self) - # endregion - - # region SecurityPartnerProvider - from .custom import SecurityPartnerProviderCreate, SecurityPartnerProviderUpdate - self.command_table["network security-partner-provider create"] = SecurityPartnerProviderCreate(loader=self) - self.command_table["network security-partner-provider update"] = SecurityPartnerProviderUpdate(loader=self) - # endregion - - # region VirtualAppliance - from .custom import VirtualApplianceCreate, VirtualApplianceUpdate - self.command_table["network virtual-appliance create"] = VirtualApplianceCreate(loader=self) - self.command_table["network virtual-appliance update"] = VirtualApplianceUpdate(loader=self) - # endregion - - # region CustomIp - from .custom import CustomIpPrefixCreate, CustomIpPrefixUpdate - self.command_table["network custom-ip prefix create"] = CustomIpPrefixCreate(loader=self) - self.command_table["network custom-ip prefix update"] = CustomIpPrefixUpdate(loader=self) # endregion # region DdosCustomPolicy diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 2d92872fdfd..f6f9b3896db 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -25,141 +25,13 @@ from azure.cli.command_modules.network.zone_file.parse_zone_file import parse_zone_file from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone_file -from .aaz.latest.network._list_usages import ListUsages as _UsagesList from .aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate -from .aaz.latest.network.application_gateway.address_pool._create import Create as _AddressPoolCreate -from .aaz.latest.network.application_gateway.address_pool._update import Update as _AddressPoolUpdate -from .aaz.latest.network.application_gateway.auth_cert._create import Create as _AuthCertCreate -from .aaz.latest.network.application_gateway.auth_cert._update import Update as _AuthCertUpdate -from .aaz.latest.network.application_gateway.client_cert._add import Add as _ClientCertAdd -from .aaz.latest.network.application_gateway.client_cert._update import Update as _ClientCertUpdate -from .aaz.latest.network.application_gateway.frontend_ip._create import Create as _FrontendIPCreate -from .aaz.latest.network.application_gateway.frontend_ip._update import Update as _FrontendIPUpdate -from .aaz.latest.network.application_gateway.http_listener._create import Create as _HTTPListenerCreate -from .aaz.latest.network.application_gateway.http_listener._update import Update as _HTTPListenerUpdate -from .aaz.latest.network.application_gateway.http_settings._create import Create as _HTTPSettingsCreate -from .aaz.latest.network.application_gateway.http_settings._update import Update as _HTTPSettingsUpdate -from .aaz.latest.network.application_gateway.identity._assign import Assign as _IdentityAssign -from .aaz.latest.network.application_gateway.private_link._add import Add as _AGPrivateLinkAdd -from .aaz.latest.network.application_gateway.private_link._remove import Remove as _AGPrivateLinkRemove -from .aaz.latest.network.application_gateway.private_link.ip_config._add import Add as _AGPrivateLinkIPConfigAdd -from .aaz.latest.network.application_gateway.listener._create import Create as _ListenerCreate -from .aaz.latest.network.application_gateway.listener._update import Update as _ListenerUpdate -from .aaz.latest.network.application_gateway.redirect_config._create import Create as _RedirectConfigCreate -from .aaz.latest.network.application_gateway.redirect_config._update import Update as _RedirectConfigUpdate -from .aaz.latest.network.application_gateway.rewrite_rule._create import Create as _AGRewriteRuleCreate -from .aaz.latest.network.application_gateway.rewrite_rule._update import Update as _AGRewriteRuleUpdate -from .aaz.latest.network.application_gateway.root_cert._create import Create as _RootCertCreate -from .aaz.latest.network.application_gateway.root_cert._update import Update as _RootCertUpdate -from .aaz.latest.network.application_gateway.routing_rule._create import Create as _RoutingRuleCreate -from .aaz.latest.network.application_gateway.routing_rule._update import Update as _RoutingRuleUpdate -from .aaz.latest.network.application_gateway.rule._create import Create as _RuleCreate -from .aaz.latest.network.application_gateway.rule._update import Update as _RuleUpdate -from .aaz.latest.network.application_gateway.settings._create import Create as _SettingsCreate -from .aaz.latest.network.application_gateway.settings._update import Update as _SettingsUpdate -from .aaz.latest.network.application_gateway.ssl_cert._create import Create as _SSLCertCreate -from .aaz.latest.network.application_gateway.ssl_cert._update import Update as _SSLCertUpdate -from .aaz.latest.network.application_gateway.ssl_policy._set import Set as _SSLPolicySet -from .aaz.latest.network.application_gateway.ssl_profile._add import Add as _SSLProfileAdd -from .aaz.latest.network.application_gateway.ssl_profile._update import Update as _SSLProfileUpdate -from .aaz.latest.network.application_gateway.url_path_map._create import Create as _URLPathMapCreate -from .aaz.latest.network.application_gateway.url_path_map._update import Update as _URLPathMapUpdate -from .aaz.latest.network.application_gateway.url_path_map.rule._create import Create as _URLPathMapRuleCreate -from .aaz.latest.network.application_gateway.waf_policy._create import Create as _WAFCreate -from .aaz.latest.network.application_gateway.waf_policy.custom_rule.match_condition._add import Add as _WAFCustomRuleMatchConditionAdd -from .aaz.latest.network.application_gateway.waf_policy.policy_setting._update import Update as _WAFPolicySettingUpdate -from .aaz.latest.network.custom_ip.prefix._create import Create as _CustomIpPrefixCreate -from .aaz.latest.network.custom_ip.prefix._update import Update as _CustomIpPrefixUpdate -from .aaz.latest.network.ddos_custom_policy._update import Update as _DdosCustomPolicyUpdate from .aaz.latest.network.dns.record_set._list import List as _DNSRecordSetListByZone from .aaz.latest.network.dns.zone._create import Create as _DNSZoneCreate -from .aaz.latest.network.express_route._create import Create as _ExpressRouteCreate -from .aaz.latest.network.express_route._update import Update as _ExpressRouteUpdate -from .aaz.latest.network.express_route.gateway._create import Create as _ExpressRouteGatewayCreate -from .aaz.latest.network.express_route.gateway._update import Update as _ExpressRouteGatewayUpdate -from .aaz.latest.network.express_route.gateway.connection._create import Create as _ExpressRouteConnectionCreate -from .aaz.latest.network.express_route.gateway.connection._update import Update as _ExpressRouteConnectionUpdate -from .aaz.latest.network.express_route.peering._create import Create as _ExpressRoutePeeringCreate -from .aaz.latest.network.express_route.peering._update import Update as _ExpressRoutePeeringUpdate -from .aaz.latest.network.express_route.peering.connection._create import Create as _ExpressRoutePeeringConnectionCreate -from .aaz.latest.network.express_route.port._create import Create as _ExpressRoutePortCreate -from .aaz.latest.network.express_route.port.identity._assign import Assign as _ExpressRoutePortIdentityAssign -from .aaz.latest.network.express_route.port.link._update import Update as _ExpressRoutePortLinkUpdate -from .aaz.latest.network.nic._create import Create as _NICCreate -from .aaz.latest.network.nic._update import Update as _NICUpdate -from .aaz.latest.network.nic.ip_config._create import Create as _NICIPConfigCreate -from .aaz.latest.network.nic.ip_config._update import Update as _NICIPConfigUpdate -from .aaz.latest.network.nic.ip_config.inbound_nat_rule._add import Add as _NICIPConfigNATAdd -from .aaz.latest.network.nic.ip_config.inbound_nat_rule._remove import Remove as _NICIPConfigNATRemove -from .aaz.latest.network.nsg._create import Create as _NSGCreate -from .aaz.latest.network.nsg.rule._create import Create as _NSGRuleCreate -from .aaz.latest.network.nsg.rule._update import Update as _NSGRuleUpdate -from .aaz.latest.network.public_ip._create import Create as _PublicIPCreate -from .aaz.latest.network.public_ip._update import Update as _PublicIPUpdate -from .aaz.latest.network.private_endpoint._create import Create as _PrivateEndpointCreate -from .aaz.latest.network.private_endpoint._update import Update as _PrivateEndpointUpdate -from .aaz.latest.network.private_endpoint.asg._add import Add as _PrivateEndpointAsgAdd -from .aaz.latest.network.private_endpoint.dns_zone_group._create import Create as _PrivateEndpointPrivateDnsZoneGroupCreate -from .aaz.latest.network.private_endpoint.dns_zone_group._add import Add as _PrivateEndpointPrivateDnsZoneAdd -from .aaz.latest.network.private_endpoint.ip_config._add import Add as _PrivateEndpointIpConfigAdd -from .aaz.latest.network.private_link_service._create import Create as _PrivateLinkServiceCreate -from .aaz.latest.network.private_link_service._update import Update as _PrivateLinkServiceUpdate -from .aaz.latest.network.private_link_service.connection._update import Update as _PrivateEndpointConnectionUpdate -from .aaz.latest.network.public_ip.prefix._create import Create as _PublicIpPrefixCreate -from .aaz.latest.network.security_partner_provider._create import Create as _SecurityPartnerProviderCreate -from .aaz.latest.network.security_partner_provider._update import Update as _SecurityPartnerProviderUpdate -from .aaz.latest.network.virtual_appliance._create import Create as _VirtualApplianceCreate -from .aaz.latest.network.virtual_appliance._update import Update as _VirtualApplianceUpdate -from .aaz.latest.network.vnet._create import Create as _VNetCreate -from .aaz.latest.network.vnet._update import Update as _VNetUpdate -from .aaz.latest.network.vnet.peering._create import Create as _VNetPeeringCreate -from .aaz.latest.network.vnet.subnet._create import Create as _VNetSubnetCreate -from .aaz.latest.network.vnet.subnet._update import Update as _VNetSubnetUpdate -from .aaz.latest.network.vnet_gateway._create import Create as _VnetGatewayCreate from .aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate -from .aaz.latest.network.vnet_gateway._disconnect_vpn_connections import DisconnectVpnConnections as _VnetGatewayVpnConnectionsDisconnect -from .aaz.latest.network.vnet_gateway._show import Show as _VNetGatewayShow -from .aaz.latest.network.vnet_gateway._list import List as _VNetGatewayList -from .aaz.latest.network.vnet_gateway.aad._assign import Assign as _VnetGatewayAadAssign -from .aaz.latest.network.vnet_gateway.ipsec_policy._add import Add as _VnetGatewayIpsecPolicyAdd -from .aaz.latest.network.vnet_gateway.nat_rule._add import Add as _VnetGatewayNatRuleAdd -from .aaz.latest.network.vnet_gateway.nat_rule._list import List as _VnetGatewayNatRuleShow -from .aaz.latest.network.vnet_gateway.nat_rule._remove import Remove as _VnetGatewayNatRuleRemove -from .aaz.latest.network.vnet_gateway.revoked_cert._create import Create as _VnetGatewayRevokedCertCreate -from .aaz.latest.network.vnet_gateway.root_cert._create import Create as _VnetGatewayRootCertCreate from .aaz.latest.network.vnet_gateway.vpn_client._generate_vpn_profile import GenerateVpnProfile as _VpnProfileGenerate from .aaz.latest.network.vnet_gateway.vpn_client._generate import Generate as _VpnClientPackageGenerate from .aaz.latest.network.vpn_connection._update import Update as _VpnConnectionUpdate -from .aaz.latest.network.vpn_connection._show_device_config_script import ShowDeviceConfigScript as _VpnConnectionDeviceConfigScriptShow -from .aaz.latest.network.vpn_connection.ipsec_policy._add import Add as _VpnConnIpsecPolicyAdd -from .aaz.latest.network.vpn_connection.packet_capture._stop import Stop as _VpnConnPackageCaptureStop -from .aaz.latest.network.vpn_connection.shared_key._update import Update as _VpnConnSharedKeyUpdate -from .operations.dns import (RecordSetAShow as DNSRecordSetAShow, RecordSetAAAAShow as DNSRecordSetAAAAShow, # pylint: disable=unused-import - RecordSetDSShow as DNSRecordSetDSShow, RecordSetMXShow as DNSRecordSetMXShow, - RecordSetNAPTRShow as DNSRecordSetNAPTRShow, RecordSetNSShow as DNSRecordSetNSShow, - RecordSetPTRShow as DNSRecordSetPTRShow, RecordSetSRVShow as DNSRecordSetSRVShow, - RecordSetTLSAShow as DNSRecordSetTLSAShow, RecordSetTXTShow as DNSRecordSetTXTShow, - RecordSetCAAShow as DNSRecordSetCAAShow, RecordSetCNAMEShow as DNSRecordSetCNAMEShow, - RecordSetSOAShow as DNSRecordSetSOAShow) -from .operations.dns import (RecordSetACreate as DNSRecordSetACreate, RecordSetAAAACreate as DNSRecordSetAAAACreate, # pylint: disable=unused-import - RecordSetDSCreate as DNSRecordSetDSCreate, RecordSetMXCreate as DNSRecordSetMXCreate, - RecordSetNAPTRCreate as DNSRecordSetNAPTRCreate, RecordSetNSCreate as DNSRecordSetNSCreate, - RecordSetPTRCreate as DNSRecordSetPTRCreate, RecordSetSRVCreate as DNSRecordSetSRVCreate, - RecordSetTLSACreate as DNSRecordSetTLSACreate, RecordSetTXTCreate as DNSRecordSetTXTCreate, - RecordSetCAACreate as DNSRecordSetCAACreate, RecordSetCNAMECreate as DNSRecordSetCNAMECreate, - RecordSetSOACreate as DNSRecordSetSOACreate) -from .operations.dns import (RecordSetAUpdate as DNSRecordSetAUpdate, RecordSetAAAAUpdate as DNSRecordSetAAAAUpdate, # pylint: disable=unused-import - RecordSetDSUpdate as DNSRecordSetDSUpdate, RecordSetMXUpdate as DNSRecordSetMXUpdate, - RecordSetNAPTRUpdate as DNSRecordSetNAPTRUpdate, RecordSetNSUpdate as DNSRecordSetNSUpdate, - RecordSetPTRUpdate as DNSRecordSetPTRUpdate, RecordSetSRVUpdate as DNSRecordSetSRVUpdate, - RecordSetTLSAUpdate as DNSRecordSetTLSAUpdate, RecordSetTXTUpdate as DNSRecordSetTXTUpdate, - RecordSetCAAUpdate as DNSRecordSetCAAUpdate, RecordSetCNAMEUpdate as DNSRecordSetCNAMEUpdate) -from .operations.dns import (RecordSetADelete as DNSRecordSetADelete, RecordSetAAAADelete as DNSRecordSetAAAADelete, # pylint: disable=unused-import - RecordSetDSDelete as DNSRecordSetDSDelete, RecordSetMXDelete as DNSRecordSetMXDelete, - RecordSetNAPTRDelete as DNSRecordSetNAPTRDelete, RecordSetNSDelete as DNSRecordSetNSDelete, - RecordSetPTRDelete as DNSRecordSetPTRDelete, RecordSetSRVDelete as DNSRecordSetSRVDelete, - RecordSetTLSADelete as DNSRecordSetTLSADelete, RecordSetTXTDelete as DNSRecordSetTXTDelete, - RecordSetCAADelete as DNSRecordSetCAADelete, RecordSetCNAMEDelete as DNSRecordSetCNAMEDelete) logger = get_logger(__name__) @@ -361,403 +233,6 @@ def create_application_gateway(cmd, application_gateway_name, resource_group_nam return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment) -class ApplicationGatewayUpdate(_ApplicationGatewayUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZDictArg, AAZStrArg, AAZArgEnum - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.custom_error_pages = AAZDictArg( - options=["--custom-error-pages"], - help="Space-separated list of custom error pages in `STATUS_CODE=URL` format.", - nullable=True, - ) - args_schema.custom_error_pages.Element = AAZStrArg( - nullable=True, - ) - args_schema.http2.enum = AAZArgEnum({"Enabled": True, "Disabled": False}) - args_schema.custom_error_configurations._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.custom_error_pages): - configurations = [] - for code, url in args.custom_error_pages.items(): - configurations.append({ - "status_code": code, - "custom_error_page_url": url, - }) - args.custom_error_configurations = configurations - if has_value(args.sku): - sku = str(args.sku) - args.sku.tier = sku.split("_", 1)[0] if not _is_v2_sku(sku) else sku - - -class AuthCertCreate(_AuthCertCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.cert_file = AAZFileArg( - options=["--cert-file"], - help="Path to the certificate file.", - required=True, - fmt=AAZFileArgBase64EncodeFormat(), - ) - args_schema.data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.cert_file): - args.data = args.cert_file - - -class AuthCertUpdate(_AuthCertUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.cert_file = AAZFileArg( - options=["--cert-file"], - help="Path to the certificate file.", - required=True, - fmt=AAZFileArgBase64EncodeFormat(), - nullable=True, - ) - args_schema.data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.cert_file): - args.data = args.cert_file - - -class AddressPoolCreate(_AddressPoolCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.servers = AAZListArg( - options=["--servers"], - help="Space-separated list of IP addresses or DNS names corresponding to backend servers." - ) - args_schema.servers.Element = AAZStrArg() - args_schema.backend_addresses._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - - def server_trans(_, server): - try: - socket.inet_aton(str(server)) # pylint:disable=no-member - return {"ip_address": server} - except OSError: # pylint:disable=no-member - return {"fqdn": server} - - args.backend_addresses = assign_aaz_list_arg( - args.backend_addresses, - args.servers, - element_transformer=server_trans - ) - - -class AddressPoolUpdate(_AddressPoolUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.servers = AAZListArg( - options=["--servers"], - help="Space-separated list of IP addresses or DNS names corresponding to backend servers.", - nullable=True, - ) - args_schema.servers.Element = AAZStrArg( - nullable=True, - ) - args_schema.backend_addresses._registered = False - return args_schema - - class NonRetryableCreateOrUpdate(_AddressPoolUpdate.ApplicationGatewaysCreateOrUpdate): - CLIENT_TYPE = "NonRetryableClient" - - def _execute_operations(self): - self.pre_operations() - self.ApplicationGatewaysGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.selectors.subresource.required()) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.selectors.subresource.required()) - yield self.NonRetryableCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - def pre_operations(self): - args = self.ctx.args - - def server_trans(_, server): - try: - socket.inet_aton(str(server)) # pylint:disable=no-member - return {"ip_address": server} - except OSError: # pylint:disable=no-member - return {"fqdn": server} - - args.backend_addresses = assign_aaz_list_arg( - args.backend_addresses, - args.servers, - element_transformer=server_trans - ) - - -class FrontedIPCreate(_FrontendIPCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="Name of the virtual network corresponding to the subnet." - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/publicIpAddresses/{}", - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/virtualNetworks/{vnet_name}/subnets/{}", - ) - args_schema.private_ip_allocation_method._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.private_ip_allocation_method = "Static" if has_value(args.private_ip_address) else "Dynamic" - - -class FrontedIPUpdate(_FrontendIPUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="Name of the virtual network corresponding to the subnet." - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/virtualNetworks/{vnet_name}/subnets/{}", - ) - args_schema.private_ip_allocation_method._registered = False - return args_schema - - def post_instance_update(self, instance): - instance.properties.private_ip_allocation_method = "Static" if has_value(instance.properties.private_ip_address) else "Dynamic" - - -class HTTPListenerCreate(_HTTPListenerCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", - ) - args_schema.frontend_port._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendPorts/{}", - ) - args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslCertificates/{}", - ) - args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslProfiles/{}", - ) - args_schema.waf_policy._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ApplicationGatewayWebApplicationFirewallPolicies/{}", - ) - args_schema.frontend_port._required = True - args_schema.protocol._registered = False - args_schema.require_server_name_indication._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.ssl_cert): - args.protocol = "Https" - args.require_server_name_indication = True if has_value(args.host_name) else None - else: - args.protocol = "Http" - - def pre_instance_create(self): - args = self.ctx.args - if not has_value(args.frontend_ip): - instance = self.ctx.vars.instance - frontend_ip_configurations = instance.properties.frontend_ip_configurations - if len(frontend_ip_configurations) == 1: - args.frontend_ip = instance.properties.frontend_ip_configurations[0].id - elif len(frontend_ip_configurations) > 1: - err_msg = "Multiple frontend IP configurations found. Specify --frontend-ip explicitly." - raise ArgumentUsageError(err_msg) - - -class HTTPListenerUpdate(_HTTPListenerUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", - ) - args_schema.frontend_port._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendPorts/{}", - ) - args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslCertificates/{}", - ) - args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslProfiles/{}", - ) - args_schema.waf_policy._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ApplicationGatewayWebApplicationFirewallPolicies/{}", - ) - args_schema.frontend_port._nullable = False - args_schema.protocol._registered = False - args_schema.require_server_name_indication._registered = False - return args_schema - - def post_instance_update(self, instance): - instance.properties.protocol = "Https" if has_value(instance.properties.ssl_certificate) else "Http" - cond1 = instance.properties.host_name - cond2 = instance.properties.protocol.to_serialized_data().lower() == "https" - instance.properties.require_server_name_indication = cond1 and cond2 - if not has_value(instance.properties.frontend_ip_configuration.id): - instance.properties.frontend_ip_configuration = None - if not has_value(instance.properties.ssl_certificate.id): - instance.properties.ssl_certificate = None - if not has_value(instance.properties.ssl_profile.id): - instance.properties.ssl_profile = None - if not has_value(instance.properties.firewall_policy.id): - instance.properties.firewall_policy = None - - -class ListenerCreate(_ListenerCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", - ) - args_schema.frontend_port._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendPorts/{}", - ) - args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslCertificates/{}", - ) - args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslProfiles/{}", - ) - args_schema.frontend_port._required = True - args_schema.protocol._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.protocol = "Tls" if has_value(args.ssl_cert) else "Tcp" - - def pre_instance_create(self): - args = self.ctx.args - if not has_value(args.frontend_ip): - instance = self.ctx.vars.instance - frontend_ip_configurations = instance.properties.frontend_ip_configurations - if len(frontend_ip_configurations) == 1: - args.frontend_ip = instance.properties.frontend_ip_configurations[0].id - elif len(frontend_ip_configurations) > 1: - err_msg = "Multiple frontend IP configurations found. Specify --frontend-ip explicitly." - raise ArgumentUsageError(err_msg) - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class ListenerUpdate(_ListenerUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", - ) - args_schema.frontend_port._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/frontendPorts/{}", - ) - args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslCertificates/{}", - ) - args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/sslProfiles/{}", - ) - args_schema.frontend_port._nullable = False - args_schema.protocol._registered = False - return args_schema - - def post_instance_update(self, instance): - instance.properties.protocol = "Tls" if has_value(instance.properties.ssl_certificate) else "Tcp" - if not has_value(instance.properties.frontend_ip_configuration.id): - instance.properties.frontend_ip_configuration = None - if not has_value(instance.properties.ssl_certificate.id): - instance.properties.ssl_certificate = None - if not has_value(instance.properties.ssl_profile.id): - instance.properties.ssl_profile = None - - -class IdentityAssign(_IdentityAssign): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.identity = AAZResourceIdArg( - options=["--identity"], - help="Name or ID of the ManagedIdentity Resource.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.ManagedIdentity" - "/userAssignedIdentities/{}", - ), - ) - args_schema.type._registered = False - args_schema.user_assigned_identities._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.type = "UserAssigned" - args.user_assigned_identities = {args.identity.to_serialized_data(): {}} - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - def remove_ag_identity(cmd, resource_group_name, application_gateway_name, no_wait=False): class IdentityRemove(_ApplicationGatewayUpdate): def pre_operations(self): @@ -773,201 +248,7 @@ def pre_instance_update(self, instance): }) -class AGPrivateLinkAdd(_AGPrivateLinkAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZBoolArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip = AAZStrArg( - options=["--frontend-ip"], - help="Frontend IP that the private link will associate to.", - required=True, - ) - args_schema.subnet = AAZStrArg( - options=["--subnet"], - help="Name or ID of a subnet within the same vnet of an application gateway.", - arg_group="Properties", - required=True, - ) - args_schema.subnet_prefix = AAZStrArg( - options=["--subnet-prefix"], - help="CIDR prefix to use when creating a new subnet.", - arg_group="Properties", - ) - args_schema.ip_address = AAZStrArg( - options=["--ip-address"], - help="Static private IP address of a subnet for private link. If omitting, a dynamic one will be created.", - arg_group="Properties", - ) - args_schema.primary = AAZBoolArg( - options=["--primary"], - help="Whether the IP configuration is primary or not.", - arg_group="Properties", - ) - args_schema.ip_configurations._registered = False - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - instance = self.ctx.vars.instance - if not any(fic for fic in instance.properties.frontend_ip_configurations if fic.name == args.frontend_ip): - err_msg = "Frontend IP doesn't exist." - raise ValidationError(err_msg) - - private_link_id = resource_id( - subscription=self.ctx.subscription_id, - resource_group=args.resource_group, - namespace="Microsoft.Network", - type="applicationGateways", - name=args.gateway_name, - child_type_1="privateLinkConfigurations", - child_name_1=args.name - ) - for fic in instance.properties.frontend_ip_configurations: - if has_value(fic.properties.private_link_configuration) \ - and fic.properties.private_link_configuration.id == private_link_id: - err_msg = "Frontend IP already reference an existing private link." - raise ValidationError(err_msg) - # associate private link with frontend IP configuration - for fic in instance.properties.frontend_ip_configurations: - if fic.name == args.frontend_ip: - fic.properties.private_link_configuration = {"id": private_link_id} - - if has_value(instance.properties.private_link_configurations): - for plc in instance.properties.private_link_configurations: - if plc.name == args.name: - err_msg = "Private link name duplicates." - raise ValidationError(err_msg) - # prepare subnet for new private link - rid = instance.properties.gateway_ip_configurations[0].properties.subnet.id.to_serialized_data() - metadata = parse_resource_id(rid) - if not is_valid_resource_id(args.subnet.to_serialized_data()): - args.subnet = resource_id( - subscription=metadata["subscription"], - resource_group=metadata["resource_group"], - namespace="Microsoft.Network", - type="virtualNetworks", - name=metadata["name"], - child_type_1="subnets", - child_name_1=args.subnet - ) - - from .aaz.latest.network.vnet import Show - vnet = Show(cli_ctx=self.cli_ctx)(command_args={ - "name": metadata["name"], - "resource_group": metadata["resource_group"] - }) - for subnet in vnet["subnets"]: - if subnet["id"] == args.subnet: - break - else: - subnet_name = parse_resource_id(args.subnet.to_serialized_data())["child_name_1"] - - from azure.cli.core.commands import LongRunningOperation - poller = VNetSubnetCreate(cli_ctx=self.cli_ctx)(command_args={ - "name": subnet_name, - "vnet_name": metadata["name"], - "resource_group": metadata["resource_group"], - "address_prefix": args.subnet_prefix, - "private_link_service_network_policies": "Disabled" - }) - LongRunningOperation(self.cli_ctx)(poller) - - args.ip_configurations = [{ - "name": "PrivateLinkDefaultIPConfiguration", - "private_ip_address": args.ip_address, - "private_ip_allocation_method": "Static" if has_value(args.ip_address) else "Dynamic", - "subnet": {"id": args.subnet}, - "primary": args.primary - }] - - -class AGPrivateLinkRemove(_AGPrivateLinkRemove): - def pre_instance_delete(self): - args = self.ctx.args - instance = self.ctx.vars.instance - for plc in instance.properties.private_link_configurations: - if plc.name == args.name: - to_be_removed = plc - break - else: - err_msg = "Private link doesn't exist." - raise ValidationError(err_msg) - - for fic in instance.properties.frontend_ip_configurations: - if has_value(fic.properties.private_link_configuration) \ - and fic.properties.private_link_configuration.id == to_be_removed.id: - fic.properties.private_link_configuration = None - - -class AGPrivateLinkIPConfigAdd(_AGPrivateLinkIPConfigAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.private_ip_allocation_method._registered = False - args_schema.subnet._registered = False - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - instance = self.ctx.vars.instance - for plc in instance.properties.private_link_configurations: - if plc.name == args.private_link: - target_private_link = plc - break - else: - err_msg = "Private link doesn't exist." - raise ValidationError(err_msg) - - args.private_ip_allocation_method = "Static" if has_value(args.ip_address) else "Dynamic" - subnet_id = target_private_link.properties.ip_configurations[0].properties.subnet.id - args.subnet.id = subnet_id - - # region application-gateway trusted-client-certificates -class ClientCertAdd(_ClientCertAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.data = AAZFileArg( - options=["--data"], - help="Path to the certificate file.", - required=True, - fmt=AAZFileArgBase64EncodeFormat(), - ) - args_schema.cert_data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.data): - args.cert_data = args.data - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class ClientCertUpdate(_ClientCertUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.data = AAZFileArg( - options=["--data"], - help="Path to the certificate file.", - required=True, - fmt=AAZFileArgBase64EncodeFormat(), - nullable=True, - ) - args_schema.cert_data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.data): - args.cert_data = args.data def show_ag_backend_health(cmd, resource_group_name, application_gateway_name, expand=None, @@ -1028,843 +309,11 @@ def show_ag_backend_health(cmd, resource_group_name, application_gateway_name, e # region application-gateway ssl-profile -class SSLProfileAdd(_SSLProfileAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.client_auth_config = AAZBoolArg( - options=["--client-auth-configuration", "--client-auth-config"], - help="Client authentication configuration of the application gateway resource.", - ) - args_schema.trusted_client_certs = AAZListArg( - options=["--trusted-client-certificates", "--trusted-client-cert"], - help="Array of references to application gateway trusted client certificates.", - ) - args_schema.trusted_client_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/trustedClientCertificates/{}", - ), - ) - args_schema.auth_configuration._registered = False - args_schema.client_certificates._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.client_auth_config): - args.auth_configuration.verify_client_cert_issuer_dn = args.client_auth_config - args.client_certificates = assign_aaz_list_arg( - args.client_certificates, - args.trusted_client_certs, - element_transformer=lambda _, cert_id: {"id": cert_id} - ) - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result -class SSLProfileUpdate(_SSLProfileUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.client_auth_config = AAZBoolArg( - options=["--client-auth-configuration", "--client-auth-config"], - help="Client authentication configuration of the application gateway resource.", - nullable=True, - ) - args_schema.trusted_client_certs = AAZListArg( - options=["--trusted-client-certificates", "--trusted-client-cert"], - help="Array of references to application gateway trusted client certificates.", - nullable=True, - ) - args_schema.trusted_client_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/trustedClientCertificates/{}", - ), - nullable=True, - ) - args_schema.auth_configuration._registered = False - args_schema.client_certificates._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.client_auth_config): - args.auth_configuration.verify_client_cert_issuer_dn = args.client_auth_config - args.client_certificates = assign_aaz_list_arg( - args.client_certificates, - args.trusted_client_certs, - element_transformer=lambda _, cert_id: {"id": cert_id} - ) - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result # endregion -class HTTPSettingsCreate(_HTTPSettingsCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZIntArg, AAZIntArgFormat, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.auth_certs = AAZListArg( - options=["--auth-certs"], - help="Space-separated list of authentication certificates (Names and IDs) to associate with the HTTP settings.", - ) - args_schema.auth_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/authenticationCertificates/{}", - ), - ) - args_schema.root_certs = AAZListArg( - options=["--root-certs"], - help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " - "`--host-name` or `--host-name-from-backend-pool` is required when this field is set.", - ) - args_schema.root_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", - ), - ) - args_schema.connection_draining_timeout = AAZIntArg( - options=["--connection-draining-timeout"], - help="Time in seconds after a backend server is removed during which on open connection remains active. " - "Range from 0 (Disabled) to 3600.", - default=0, - fmt=AAZIntArgFormat( - maximum=3600, - minimum=0, - ), - ) - args_schema.probe._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/probes/{}", - ) - args_schema.cookie_based_affinity._blank = "Enabled" - args_schema.port._required = True - args_schema.authentication_certificates._registered = False - args_schema.trusted_root_certificates._registered = False - args_schema.connection_draining._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.authentication_certificates = assign_aaz_list_arg( - args.authentication_certificates, - args.auth_certs, - element_transformer=lambda _, auth_cert_id: {"id": auth_cert_id} - ) - args.trusted_root_certificates = assign_aaz_list_arg( - args.trusted_root_certificates, - args.root_certs, - element_transformer=lambda _, root_cert_id: {"id": root_cert_id} - ) - timeout = args.connection_draining_timeout.to_serialized_data() - args.connection_draining.enabled = bool(timeout) - args.connection_draining.drain_timeout_in_sec = timeout or 1 - - -class HTTPSettingsUpdate(_HTTPSettingsUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZIntArg, AAZIntArgFormat, AAZResourceIdArg, AAZResourceIdArgFormat - - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.auth_certs = AAZListArg( - options=["--auth-certs"], - help="Space-separated list of authentication certificates (Names and IDs) to associate with the HTTP settings.", - nullable=True, - ) - args_schema.auth_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/authenticationCertificates/{}", - ), - nullable=True, - ) - args_schema.root_certs = AAZListArg( - options=["--root-certs"], - help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " - "`--host-name` or `--host-name-from-backend-pool` is required when this field is set.", - nullable=True, - ) - args_schema.root_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", - ), - nullable=True, - ) - args_schema.connection_draining_timeout = AAZIntArg( - options=["--connection-draining-timeout"], - help="Time in seconds after a backend server is removed during which on open connection remains active. " - "Range from 0 (Disabled) to 3600.", - fmt=AAZIntArgFormat( - maximum=3600, - minimum=0, - ), - nullable=True, - ) - args_schema.probe._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/probes/{}", - ) - args_schema.cookie_based_affinity._blank = "Enabled" - args_schema.authentication_certificates._registered = False - args_schema.trusted_root_certificates._registered = False - args_schema.connection_draining._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.authentication_certificates = assign_aaz_list_arg( - args.authentication_certificates, - args.auth_certs, - element_transformer=lambda _, auth_cert_id: {"id": auth_cert_id} - ) - args.trusted_root_certificates = assign_aaz_list_arg( - args.trusted_root_certificates, - args.root_certs, - element_transformer=lambda _, root_cert_id: {"id": root_cert_id} - ) - if has_value(args.connection_draining_timeout): - timeout = args.connection_draining_timeout.to_serialized_data() - args.connection_draining.enabled = bool(timeout) - args.connection_draining.drain_timeout_in_sec = timeout or 1 - - def post_instance_update(self, instance): - if not has_value(instance.properties.probe.id): - instance.properties.probe = None - - -class SettingsCreate(_SettingsCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.root_certs = AAZListArg( - options=["--root-certs"], - help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " - "`--host-name` or `--backend-pool-host-name` is required when this field is set.", - ) - args_schema.root_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", - ), - ) - args_schema.probe._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/probes/{}", - ) - args_schema.port._required = True - args_schema.trusted_root_certificates._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.trusted_root_certificates = assign_aaz_list_arg( - args.trusted_root_certificates, - args.root_certs, - element_transformer=lambda _, root_cert_id: {"id": root_cert_id} - ) - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class SettingsUpdate(_SettingsUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.root_certs = AAZListArg( - options=["--root-certs"], - help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " - "`--host-name` or `--backend-pool-host-name` is required when this field is set.", - nullable=True, - ) - args_schema.root_certs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", - ), - nullable=True, - ) - args_schema.probe._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/probes/{}", - ) - args_schema.trusted_root_certificates._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.trusted_root_certificates = assign_aaz_list_arg( - args.trusted_root_certificates, - args.root_certs, - element_transformer=lambda _, root_cert_id: {"id": root_cert_id} - ) - - def post_instance_update(self, instance): - if not has_value(instance.properties.probe.id): - instance.properties.probe = None - - -class RedirectConfigCreate(_RedirectConfigCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.target_listener._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/httpListeners/{}", - ) - args_schema.type._required = True - return args_schema - - -class RedirectConfigUpdate(_RedirectConfigUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.target_listener._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/httpListeners/{}", - ) - return args_schema - - def post_instance_update(self, instance): - if not has_value(instance.properties.target_listener.id): - instance.properties.target_listener = None - if has_value(instance.properties.target_listener): - instance.properties.target_url = None - if has_value(instance.properties.target_url): - instance.properties.target_listener = None - - -class AGRewriteRuleCreate(_AGRewriteRuleCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZDictArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.request_headers = AAZDictArg( - options=["--request-headers"], - help="Space-separated list of HEADER=VALUE pairs. " - "Values from: `az network application-gateway rewrite-rule list-request-headers`.", - ) - args_schema.request_headers.Element = AAZStrArg() - args_schema.response_headers = AAZDictArg( - options=["--response-headers"], - help="Space-separated list of HEADER=VALUE pairs. " - "Values from: `az network application-gateway rewrite-rule list-response-headers`.", - ) - args_schema.response_headers.Element = AAZStrArg() - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.request_headers): - configurations = [] - for k, v in args.request_headers.items(): - configurations.append({"header_name": k, "header_value": v}) - args.request_header_configurations = configurations - if has_value(args.response_headers): - configurations = [] - for k, v in args.response_headers.items(): - configurations.append({"header_name": k, "header_value": v}) - args.response_header_configurations = configurations - - -class AGRewriteRuleUpdate(_AGRewriteRuleUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZDictArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.request_headers = AAZDictArg( - options=["--request-headers"], - help="Space-separated list of HEADER=VALUE pairs. " - "Values from: `az network application-gateway rewrite-rule list-request-headers`.", - nullable=True, - ) - args_schema.request_headers.Element = AAZStrArg( - nullable=True, - ) - args_schema.response_headers = AAZDictArg( - options=["--response-headers"], - help="Space-separated list of HEADER=VALUE pairs. " - "Values from: `az network application-gateway rewrite-rule list-response-headers`.", - nullable=True, - ) - args_schema.response_headers.Element = AAZStrArg( - nullable=True, - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.request_headers): - if args.request_headers.to_serialized_data() is None: - args.request_header_configurations = None - else: - configurations = [] - for k, v in args.request_headers.items(): - configurations.append({"header_name": k, "header_value": v}) - args.request_header_configurations = configurations - if has_value(args.response_headers): - if args.response_headers.to_serialized_data() is None: - args.response_header_configurations = None - else: - configurations = [] - for k, v in args.response_headers.items(): - configurations.append({"header_name": k, "header_value": v}) - args.response_header_configurations = configurations - - -class RuleCreate(_RuleCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.http_listener._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/httpListeners/{}", - ) - args_schema.http_settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", - ) - args_schema.redirect_config._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/redirectConfigurations/{}", - ) - args_schema.rewrite_rule_set._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", - ) - args_schema.url_path_map._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/urlPathMaps/{}", - ) - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - instance = self.ctx.vars.instance - if not has_value(args.address_pool) and not has_value(args.redirect_config): - address_pools = instance.properties.backend_address_pools - if len(address_pools) == 1: - args.address_pool = instance.properties.backend_address_pools[0].id - elif len(address_pools) > 1: - err_msg = "Multiple backend address pools found. Specify --address-pool explicitly." - raise ArgumentUsageError(err_msg) - if not has_value(args.http_settings) and not has_value(args.redirect_config): - settings = instance.properties.backend_http_settings_collection - if len(settings) == 1: - args.http_settings = instance.properties.backend_http_settings_collection[0].id - elif len(settings) > 1: - err_msg = "Multiple backend settings found. Specify --http-settings explicitly." - raise ArgumentUsageError(err_msg) - if not has_value(args.http_listener): - listeners = instance.properties.http_listeners - if len(listeners) == 1: - args.http_listener = instance.properties.http_listeners[0].id - elif len(listeners) > 1: - err_msg = "Multiple HTTP listeners found. Specify --http-listener explicitly." - raise ArgumentUsageError(err_msg) - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class RuleUpdate(_RuleUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.http_listener._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/httpListeners/{}", - ) - args_schema.http_settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", - ) - args_schema.redirect_config._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/redirectConfigurations/{}", - ) - args_schema.rewrite_rule_set._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", - ) - args_schema.url_path_map._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/urlPathMaps/{}", - ) - return args_schema - - def post_instance_update(self, instance): - if not has_value(instance.properties.backend_address_pool.id): - instance.properties.backend_address_pool = None - if not has_value(instance.properties.backend_http_settings.id): - instance.properties.backend_http_settings = None - if not has_value(instance.properties.http_listener.id): - instance.properties.http_listener = None - if not has_value(instance.properties.redirect_configuration.id): - instance.properties.redirect_configuration = None - if not has_value(instance.properties.rewrite_rule_set.id): - instance.properties.rewrite_rule_set = None - if not has_value(instance.properties.url_path_map.id): - instance.properties.url_path_map = None - - -class RoutingRuleCreate(_RoutingRuleCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.listener._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/listeners/{}", - ) - args_schema.settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendSettingsCollection/{}", - ) - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - instance = self.ctx.vars.instance - if not has_value(args.address_pool): - address_pools = instance.properties.backend_address_pools - if len(address_pools) == 1: - args.address_pool = instance.properties.backend_address_pools[0].id - elif len(address_pools) > 1: - err_msg = "Multiple backend address pools found. Specify --address-pool explicitly." - raise ArgumentUsageError(err_msg) - if not has_value(args.listener): - listeners = instance.properties.listeners - if len(listeners) == 1: - args.listener = instance.properties.listeners[0].id - elif len(listeners) > 1: - err_msg = "Multiple listeners found. Specify --listener explicitly." - raise ArgumentUsageError(err_msg) - if not has_value(args.settings): - settings = instance.properties.backend_settings_collection - if len(settings) == 1: - args.settings = instance.properties.backend_settings_collection[0].id - elif len(settings) > 1: - err_msg = "Multiple backend settings found. Specify --settings explicitly." - raise ArgumentUsageError(err_msg) - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class RoutingRuleUpdate(_RoutingRuleUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.listener._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/listeners/{}", - ) - args_schema.settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendSettingsCollection/{}", - ) - return args_schema - - def post_instance_update(self, instance): - if not has_value(instance.properties.backend_address_pool.id): - instance.properties.backend_address_pool = None - if not has_value(instance.properties.backend_settings.id): - instance.properties.backend_settings = None - if not has_value(instance.properties.listener.id): - instance.properties.listener = None - - -class SSLCertCreate(_SSLCertCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.cert_file = AAZFileArg( - options=["--cert-file"], - help="Path to the pfx certificate file.", - fmt=AAZFileArgBase64EncodeFormat(), - ) - args_schema.data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.cert_file): - args.data = args.cert_file - - -class SSLCertUpdate(_SSLCertUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.cert_file = AAZFileArg( - options=["--cert-file"], - help="Path to the pfx certificate file.", - fmt=AAZFileArgBase64EncodeFormat(), - nullable=True, - ) - args_schema.data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.cert_file): - args.data = args.cert_file - - -class SSLPolicySet(_SSLPolicySet): - def pre_operations(self): - args = self.ctx.args - if has_value(args.name): - args.policy_type = "Predefined" - elif not has_value(args.policy_type) \ - and (has_value(args.cipher_suites) or has_value(args.min_protocol_version)): - args.policy_type = "Custom" - - -class RootCertCreate(_RootCertCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.cert_file = AAZFileArg( - options=["--cert-file"], - help="Path to the certificate file.", - fmt=AAZFileArgBase64EncodeFormat(), - ) - args_schema.data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.cert_file): - args.data = args.cert_file - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class RootCertUpdate(_RootCertUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.cert_file = AAZFileArg( - options=["--cert-file"], - help="Path to the certificate file.", - fmt=AAZFileArgBase64EncodeFormat(), - nullable=True, - ) - args_schema.data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.cert_file): - args.data = args.cert_file - - -class URLPathMapCreate(_URLPathMapCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.rule_name = AAZStrArg( - options=["--rule-name"], - arg_group="First Rule", - help="Name of the rule for a URL path map.", - default="default", - ) - args_schema.paths = AAZListArg( - options=["--paths"], - arg_group="First Rule", - help="Space-separated list of paths to associate with the rule. " - "Valid paths start and end with \"/\", e.g, \"/bar/\".", - required=True, - ) - args_schema.paths.Element = AAZStrArg() - args_schema.address_pool = AAZResourceIdArg( - options=["--address-pool"], - arg_group="First Rule", - help="Name or ID of the backend address pool to use with the created rule.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ), - ) - args_schema.http_settings = AAZResourceIdArg( - options=["--http-settings"], - arg_group="First Rule", - help="Name or ID of the HTTP settings to use with the created rule.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", - ), - ) - args_schema.redirect_config = AAZResourceIdArg( - options=["--redirect-config"], - arg_group="First Rule", - help="Name or ID of the redirect configuration to use with the created rule.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/redirectConfigurations/{}", - ), - ) - args_schema.rewrite_rule_set = AAZResourceIdArg( - options=["--rewrite-rule-set"], - arg_group="First Rule", - help="Name or ID of the rewrite rule set. If not specified, the default for the map will be used.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", - ), - ) - args_schema.waf_policy = AAZResourceIdArg( - options=["--waf-policy"], - arg_group="First Rule", - help="Name or ID of a web application firewall policy resource.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ApplicationGatewayWebApplicationFirewallPolicies/{}", - ), - ) - # add templates for resource id - args_schema.default_address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.default_http_settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", - ) - args_schema.default_redirect_config._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/redirectConfigurations/{}", - ) - args_schema.default_rewrite_rule_set._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - rules = [{ - "name": args.rule_name, - "paths": args.paths, - "backend_address_pool": {"id": args.address_pool} if has_value(args.address_pool) else None, - "backend_http_settings": {"id": args.http_settings} if has_value(args.http_settings) else None, - "redirect_configuration": {"id": args.redirect_config} if has_value(args.redirect_config) else None, - "rewrite_rule_set": {"id": args.rewrite_rule_set} if has_value(args.rewrite_rule_set) else None, - "firewall_policy": {"id": args.waf_policy} if has_value(args.waf_policy) else None, - }] - args.rules = rules - - -class URLPathMapUpdate(_URLPathMapUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - # apply templates for resource id - args_schema.default_address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.default_http_settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", - ) - args_schema.default_redirect_config._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/redirectConfigurations/{}", - ) - args_schema.default_rewrite_rule_set._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", - ) - return args_schema - - -class URLPathMapRuleCreate(_URLPathMapRuleCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.paths._required = True - # add templates for resource id - args_schema.address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ) - args_schema.http_settings._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", - ) - args_schema.redirect_config._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/redirectConfigurations/{}", - ) - args_schema.rewrite_rule_set._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", - ) - args_schema.waf_policy._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ApplicationGatewayWebApplicationFirewallPolicies/{}", - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.address_pool) and has_value(args.redirect_config): - err_msg = "Cannot reference a BackendAddressPool when Redirect Configuration is specified." - raise ArgumentUsageError(err_msg) - - def set_ag_waf_config(cmd, resource_group_name, application_gateway_name, enabled, firewall_mode=None, rule_set_type="OWASP", rule_set_version=None, disabled_rule_groups=None, disabled_rules=None, no_wait=False, @@ -1955,40 +404,6 @@ def list_ag_waf_rule_sets(cmd, _type=None, version=None, group=None): # region ApplicationGatewayWAFPolicy -class WAFCreate(_WAFCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.rule_set_type = AAZStrArg( - options=["--type"], - help="Type of the web application firewall rule set.", - default="Microsoft_DefaultRuleSet", - enum={ - "Microsoft_BotManagerRuleSet": "Microsoft_BotManagerRuleSet", - "Microsoft_DefaultRuleSet": "Microsoft_DefaultRuleSet", - "OWASP": "OWASP", - "Microsoft_HTTPDDoSRuleSet": "Microsoft_HTTPDDoSRuleSet" - }, - ) - args_schema.rule_set_version = AAZStrArg( - options=["--version"], - help="Version of the web application firewall rule set type. " - "0.1, 1.0, and 1.1 are used for Microsoft_BotManagerRuleSet", - default="2.1" - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - managed_rule_set = { - "rule_set_type": args.rule_set_type, - "rule_set_version": args.rule_set_version - } - managed_rule_definition = { - "managed_rule_sets": [managed_rule_set] - } - args.managed_rules = managed_rule_definition # endregion @@ -2003,47 +418,8 @@ def list_waf_policy_setting(cmd, resource_group_name, policy_name): # region ApplicationGatewayWAFPolicyRuleMatchConditions -class WAFCustomRuleMatchConditionAdd(_WAFCustomRuleMatchConditionAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.match_variables = AAZListArg( - options=["--match-variables"], - help="Space-separated list of variables to use when matching. Variable values: RemoteAddr, RequestMethod, " - "QueryString, PostArgs, RequestUri, RequestHeaders, RequestBody, RequestCookies.", - required=True, - ) - args_schema.match_variables.Element = AAZStrArg() - # filter arguments - args_schema.variables._required = False - args_schema.variables._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - variables = [] - for variable in args.match_variables: - try: - name, selector = str(variable).split(".", 1) - except ValueError: - name, selector = variable, None - variables.append({ - "variable_name": name, - "selector": selector, - }) - args.variables = variables - # validate - if str(args.operator).lower() == "any" and has_value(args.values): - raise ArgumentUsageError("\"Any\" operator does not require --values.") - if str(args.operator).lower() != "any" and not has_value(args.values): - raise ArgumentUsageError("Non-any operator requires --values.") - - -class WAFPolicySettingUpdate(_WAFPolicySettingUpdate): - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result + + # endregion @@ -3307,78 +1683,6 @@ def lists_match(l1, l2): # region ExpressRoutes -class ExpressRouteCreate(_ExpressRouteCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.bandwidth = AAZListArg( - options=["--bandwidth"], - help="Bandwidth of the circuit. Usage: INT {Mbps,Gbps}. Defaults to Mbps." - ) - args_schema.bandwidth.Element = AAZStrArg() - args_schema.bandwidth_in_mbps._registered = False - args_schema.bandwidth_in_gbps._registered = False - args_schema.sku_name._registered = False - args_schema.express_route_port._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRoutePorts/{}", - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.bandwidth): - converted_bandwidth = _validate_bandwidth(args.bandwidth) - args.sku_name = '{}_{}'.format(args.sku_tier, args.sku_family) - - if has_value(args.express_route_port): - args.provider = None - args.peering_location = None - args.bandwidth_in_gbps = converted_bandwidth / 1000.0 - else: - args.bandwidth_in_mbps = int(converted_bandwidth) - - -class ExpressRouteUpdate(_ExpressRouteUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.bandwidth = AAZListArg( - options=["--bandwidth"], - help="Bandwidth of the circuit. Usage: INT {Mbps,Gbps}. Defaults to Mbps.", - nullable=True - ) - args_schema.bandwidth.Element = AAZStrArg(nullable=True) - args_schema.bandwidth_in_mbps._registered = False - args_schema.bandwidth_in_gbps._registered = False - args_schema.sku_name._registered = False - args_schema.express_route_port._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/expressRoutePorts/{}" - ) - - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.sku_tier) and has_value(args.sku_family): - args.sku_name = f"{args.sku_tier}_{args.sku_family}" - - if has_value(args.bandwidth): - converted_bandwidth = _validate_bandwidth(args.bandwidth) - args.bandwidth_in_gbps = converted_bandwidth / 1000 - args.bandwidth_in_mbps = int(converted_bandwidth) - - def post_instance_update(self, instance): - if not has_value(instance.properties.express_route_port.id): - instance.properties.express_route_port = None - - if has_value(instance.properties.express_route_port): - instance.properties.service_provider_properties = None - else: - instance.properties.bandwidth_in_gbps = None def _validate_ipv6_address_prefixes(prefixes): @@ -3400,254 +1704,18 @@ def _validate_ipv6_address_prefixes(prefixes): return version == IPv6Network -class ExpressRoutePeeringCreate(_ExpressRoutePeeringCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat, AAZArgEnum - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.ip_version = AAZStrArg( - options=['--ip-version'], - arg_group="Microsoft Peering", - help="The IP version to update Microsoft Peering settings for. Allowed values: IPv4, IPv6. Default: IPv4.", - default='IPv4' - ) - args_schema.route_filter._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/routeFilters/{}", - ) - # taken from Xplat. No enums in SDK - args_schema.routing_registry_name.enum = AAZArgEnum({"ARIN": "ARIN", "APNIC": "APNIC", "AFRINIC": "AFRINIC", "LACNIC": "LACNIC", "RIPENCC": "RIPENCC", "RADB": "RADB", "ALTDB": "ALTDB", "LEVEL3": "LEVEL3"}) - args_schema.ipv6_peering_config._registered = False - args_schema.peering_name._required = False - args_schema.peering_name._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.peering_name = args.peering_type - if args.ip_version.to_serialized_data().lower() == 'ipv6': - if args.peering_type.to_serialized_data().lower() == 'microsoftpeering': - microsoft_config = {'advertised_public_prefixes': args.advertised_public_prefixes, - 'customer_asn': args.customer_asn, - 'routing_registry_name': args.routing_registry_name} - else: - microsoft_config = None - args.ipv6_peering_config = { - 'primary_peer_address_prefix': args.primary_peer_subnet, - 'secondary_peer_address_prefix': args.secondary_peer_subnet, - 'microsoft_peering_config': microsoft_config, - 'route_filter': args.route_filter - } - args.primary_peer_subnet = None - args.secondary_peer_subnet = None - args.route_filter = None - args.advertised_public_prefixes = None - args.customer_asn = None - args.routing_registry_name = None - - else: - if has_value(args.peering_type) and args.peering_type.to_serialized_data().lower() != 'microsoftpeering': - args.advertised_public_prefixes = None - args.customer_asn = None - args.routing_registry_name = None - args.legacy_mode = None - - -class ExpressRoutePeeringUpdate(_ExpressRoutePeeringUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat, AAZArgEnum - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.ip_version = AAZStrArg( - options=['--ip-version'], - arg_group="Microsoft Peering", - help="The IP version to update Microsoft Peering settings for. Allowed values: IPv4, IPv6. Default: IPv4.", - default='IPv4' - ) - args_schema.route_filter._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/routeFilters/{}", - ) - # taken from Xplat. No enums in SDK - args_schema.routing_registry_name.enum = AAZArgEnum({"ARIN": "ARIN", "APNIC": "APNIC", "AFRINIC": "AFRINIC", "LACNIC": "LACNIC", "RIPENCC": "RIPENCC", "RADB": "RADB", "ALTDB": "ALTDB", "LEVEL3": "LEVEL3"}) - args_schema.ipv6_peering_config._registered = False - args_schema.peering_type._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if args.ip_version.to_serialized_data().lower() == 'ipv6': - microsoft_config = {} - args.ipv6_peering_config = {} - if has_value(args.primary_peer_subnet): - args.ipv6_peering_config['primary_peer_address_prefix'] = args.primary_peer_subnet - args.primary_peer_subnet = None - if has_value(args.secondary_peer_subnet): - args.ipv6_peering_config['secondary_peer_address_prefix'] = args.secondary_peer_subnet - args.secondary_peer_subnet = None - if has_value(args.advertised_public_prefixes): - microsoft_config['advertised_public_prefixes'] = args.advertised_public_prefixes - args.advertised_public_prefixes = None - if has_value(args.customer_asn): - microsoft_config['customer_asn'] = args.customer_asn - args.customer_asn = None - if has_value(args.routing_registry_name): - microsoft_config['routing_registry_name'] = args.routing_registry_name - args.routing_registry_name = None - if has_value(args.route_filter): - args.ipv6_peering_config['route_filter'] = args.route_filter - args.route_filter = None - if microsoft_config is not None: - args.ipv6_peering_config['microsoft_peering_config'] = microsoft_config - - -class ExpressRoutePeeringConnectionCreate(_ExpressRoutePeeringConnectionCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.peer_circuit._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{peering_name}", - ) - args_schema.source_circuit._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{circuit_name}/peerings/{peering_name}", - ) - - return args_schema # endregion # region ExpressRoute Connection # pylint: disable=unused-argument -class ExpressRouteGatewayCreate(_ExpressRouteGatewayCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.virtual_hub._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", - ) - - return args_schema - - -class ExpressRouteGatewayUpdate(_ExpressRouteGatewayUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.virtual_hub._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", - ) - - return args_schema - - -class ExpressRouteConnectionCreate(_ExpressRouteConnectionCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.associated_route_table = AAZStrArg( - options=['--associated-route-table', '--associated'], - arg_group="Routing Configuration", - help="The resource id of route table associated with this routing configuration.", - is_preview=True) - args_schema.propagated_route_tables = AAZListArg( - options=['--propagated-route-tables', '--propagated'], - arg_group="Routing Configuration", - help="Space-separated list of resource id of propagated route tables.", - is_preview=True) - args_schema.propagated_route_tables.Element = AAZStrArg() - args_schema.circuit_name = AAZStrArg( - options=['--circuit-name'], - arg_group="Peering", - help="ExpressRoute circuit name." - ) - args_schema.peering._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{circuit_name}/peerings/{}" - ) - args_schema.associated_id._registered = False - args_schema.propagated_ids._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - - if has_value(args.associated_route_table): - args.associated_id = {"id": args.associated_route_table} - if has_value(args.propagated_route_tables): - args.propagated_ids = [{"id": propagated_route_table} for propagated_route_table in args.propagated_route_tables] # pylint: disable=unused-argument -class ExpressRouteConnectionUpdate(_ExpressRouteConnectionUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.associated_route_table = AAZStrArg( - options=['--associated-route-table', '--associated'], - arg_group="Routing Configuration", - help="The resource id of route table associated with this routing configuration.", - is_preview=True, - nullable=True) - args_schema.propagated_route_tables = AAZListArg( - options=['--propagated-route-tables', '--propagated'], - arg_group="Routing Configuration", - help="Space-separated list of resource id of propagated route tables.", - is_preview=True, - nullable=True) - args_schema.propagated_route_tables.Element = AAZStrArg(nullable=True) - args_schema.circuit_name = AAZStrArg( - options=['--circuit-name'], - arg_group="Peering", - help="ExpressRoute circuit name.", - nullable=True - ) - args_schema.peering._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{circuit_name}/peerings/{}" - ) - args_schema.associated_id._registered = False - args_schema.propagated_ids._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - - if has_value(args.associated_route_table): - args.associated_id = {"id": args.associated_route_table} - - args.propagated_ids = assign_aaz_list_arg( - args.propagated_ids, - args.propagated_route_tables, - element_transformer=lambda _, propagated_route_table: {"id": propagated_route_table} - ) # endregion # region ExpressRoute ports -class ExpressRoutePortCreate(_ExpressRoutePortCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.bandwidth = AAZListArg( - options=["--bandwidth"], - help="Bandwidth of the circuit. Usage: INT {Mbps,Gbps}. Defaults to Mbps." - ) - args_schema.bandwidth.Element = AAZStrArg() - args_schema.bandwidth_in_gbps._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.bandwidth): - converted_bandwidth = _validate_bandwidth(args.bandwidth, mbps=False) - args.bandwidth_in_gbps = int(converted_bandwidth) def _validate_bandwidth(bandwidth, mbps=True): @@ -3717,308 +1785,18 @@ def download_generated_loa_as_pdf(cmd, logger.warning("The generated letter of authorization is saved at %s", file_path) -class ExpressRoutePortIdentityAssign(_ExpressRoutePortIdentityAssign): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.identity = AAZResourceIdArg( - options=['--identity'], - arg_group="Identity", - help="Name or ID of the ManagedIdentity Resource.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}" - ) - ) - - args_schema.user_assigned_identities._registered = False - args_schema.type._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - identity = args.identity.to_serialized_data() - args.user_assigned_identities = {identity: {}} - - -class ExpressRoutePortLinkUpdate(_ExpressRoutePortLinkUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.admin_state._blank = "Enabled" - - return args_schema - - def pre_operations(self): - args = self.ctx.args - # TODO https://github.com/Azure/azure-rest-api-specs/issues/7569 - # need to remove this conversion when the issue is fixed. - if has_value(args.macsec_cipher): - macsec_cipher = args.macsec_cipher.to_serialized_data() - macsec_ciphers_tmp = {'gcm-aes-128': 'GcmAes128', 'gcm-aes-256': 'GcmAes256'} - macsec_cipher = macsec_ciphers_tmp.get(macsec_cipher, macsec_cipher) - args.macsec_cipher = macsec_cipher # endregion # region PrivateEndpoint -class PrivateEndpointCreate(_PrivateEndpointCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.private_connection_resource_id = AAZStrArg( - options=['--private-connection-resource-id'], - help="The resource id of the private endpoint to connect to.", - required=True) - args_schema.group_ids = AAZListArg( - options=["--group-ids", "--group-id"], - help="The ID of the group obtained from the remote resource that this private endpoint should connect to. You can use \"az network private-link-resource list\" to obtain the supported group ids. You must provide this except for PrivateLinkService.," - ) - args_schema.group_ids.Element = AAZStrArg() - args_schema.request_message = AAZStrArg( - options=['--request-message'], - help="A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars.") - args_schema.connection_name = AAZStrArg( - options=['--connection-name'], - help="Name of the private link service connection.", - required=True) - args_schema.manual_request = AAZBoolArg( - options=['--manual-request'], - help="Use manual request to establish the connection. Configure it as 'true' when you don't have access to the subscription of private link service.") - args_schema.vnet_name = AAZStrArg( - options=['--vnet-name'], - help="The virtual network (VNet) associated with the subnet (Omit if supplying a subnet id).") - args_schema.subnet = AAZResourceIdArg( - options=['--subnet'], - help="Name or ID of an existing subnet. If name specified, also specify --vnet-name. " - "If you want to use an existing subnet in other resource group or subscription, please provide the ID instead of the name of the subnet and do not specify the--vnet-name.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}" - ) - ) - args_schema.manual_private_link_service_connections._registered = False - args_schema.private_link_service_connections._registered = False - args_schema.edge_zone_type._registered = False - args_schema.subnet_id._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - pls_connection = {'name': args.connection_name, - 'group_ids': args.group_ids, - 'request_message': args.request_message, - 'private_link_service_id': args.private_connection_resource_id} - - if args.manual_request: - args.manual_private_link_service_connections = [pls_connection] - else: - args.private_link_service_connections = [pls_connection] - - if has_value(args.subnet): - args.subnet_id = args.subnet - - if has_value(args.edge_zone): - args.edge_zone_type = 'EdgeZone' - - -class PrivateEndpointUpdate(_PrivateEndpointUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.request_message = AAZStrArg( - options=['--request-message'], - help="A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars.") - - args_schema.manual_private_link_service_connections._registered = False - args_schema.private_link_service_connections._registered = False - - return args_schema - - def pre_instance_update(self, instance): - args = self.ctx.args - if has_value(args.request_message): - if has_value(instance.properties.private_link_service_connections): - instance.properties.private_link_service_connections[0].properties.request_message = args.request_message - elif has_value(instance.properties.manual_private_link_service_connections): - instance.properties.manual_private_link_service_connections[0].properties.request_message = args.request_message -class PrivateEndpointPrivateDnsZoneGroupCreate(_PrivateEndpointPrivateDnsZoneGroupCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.private_dns_zone = AAZResourceIdArg( - options=['--private-dns-zone'], - help="Name or ID of the private dns zone.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/privateDnsZones/{}" - ) - ) - args_schema.zone_name = AAZStrArg(options=['--zone-name'], help="Name of the private dns zone.", required=True) - args_schema.private_dns_zone_configs._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.private_dns_zone_configs = [{'name': args.zone_name, 'private_dns_zone_id': args.private_dns_zone}] - - -class PrivateEndpointPrivateDnsZoneAdd(_PrivateEndpointPrivateDnsZoneAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.private_dns_zone = AAZResourceIdArg( - options=['--private-dns-zone'], - help="Name or ID of the private dns zone.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/privateDnsZones/{}" - ) - ) - args_schema.private_dns_zone_id._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.private_dns_zone_id = args.private_dns_zone - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class PrivateEndpointIpConfigAdd(_PrivateEndpointIpConfigAdd): - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class PrivateEndpointAsgAdd(_PrivateEndpointAsgAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.asg_id._required = False - - return args_schema - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result # endregion # region PrivateLinkService -class PrivateLinkServiceCreate(_PrivateLinkServiceCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg(options=['--vnet-name'], arg_group="IP Configuration", help="The virtual network (VNet) name.") - args_schema.subnet = AAZResourceIdArg( - options=['--subnet'], - arg_group="IP Configuration", - help="Name or ID of subnet to use. If name provided, also supply `--vnet-name`.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}" - ) - ) - args_schema.private_ip_address = AAZStrArg(options=['--private-ip-address'], arg_group="IP Configuration", help="Static private IP address to use.") - args_schema.private_ip_address_version = AAZStrArg(options=['--private-ip-address-version'], arg_group="IP Configuration", help="IP version of the private IP address.", - default="IPv4", enum={"IPv4": "IPv4", "IPv6": "IPv6"}) - args_schema.private_ip_allocation_method = AAZStrArg(options=['--private-ip-allocation-method'], arg_group="IP Configuration", help="Private IP address allocation method.", - enum={"Dynamic": "Dynamic", "Static": "Static"}) - args_schema.lb_name = AAZStrArg(options=['--lb-name'], help="Name of the load balancer to retrieve frontend IP configs from. Ignored if a frontend IP configuration ID is supplied.") - args_schema.lb_frontend_ip_configs = AAZListArg(options=['--lb-frontend-ip-configs'], help="Space-separated list of names or IDs of load balancer frontend IP configurations to link to. If names are used, also supply `--lb-name`.") - args_schema.lb_frontend_ip_configs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIpConfigurations/{}" - ) - ) - - args_schema.load_balancer_frontend_ip_configurations._registered = False - args_schema.edge_zone_type._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - - if not has_value(args.ip_configurations): - args.ip_configurations = [{ - 'name': '{}_ipconfig_0'.format(args.name.to_serialized_data()), - 'private_ip_address': args.private_ip_address, - 'private_ip_allocation_method': args.private_ip_allocation_method, - 'private_ip_address_version': args.private_ip_address_version, - 'subnet': {'id': args.subnet} - }] - - args.load_balancer_frontend_ip_configurations = assign_aaz_list_arg( - args.load_balancer_frontend_ip_configurations, - args.lb_frontend_ip_configs, - element_transformer=lambda _, lb_frontend_ip_config: {"id": lb_frontend_ip_config} - ) - - if has_value(args.edge_zone): - args.edge_zone_type = 'EdgeZone' - if not has_value(args.lb_frontend_ip_configs) and not has_value(args.destination_ip_address): - raise CLIError("usage error: either --lb-frontend-ip-configs or --destination-ip-address is required") -class PrivateLinkServiceUpdate(_PrivateLinkServiceUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.lb_name = AAZStrArg(options=['--lb-name'], help="Name of the load balancer to retrieve frontend IP configs from. Ignored if a frontend IP configuration ID is supplied.") - args_schema.lb_frontend_ip_configs = AAZListArg(options=['--lb-frontend-ip-configs'], help="Space-separated list of names or IDs of load balancer frontend IP configurations to link to. If names are used, also supply `--lb-name`.", nullable=True) - args_schema.lb_frontend_ip_configs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIpConfigurations/{}" - ), - nullable=True - ) - args_schema.load_balancer_frontend_ip_configurations._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - - if has_value(args.lb_frontend_ip_configs): - args.load_balancer_frontend_ip_configurations = assign_aaz_list_arg( - args.load_balancer_frontend_ip_configurations, - args.lb_frontend_ip_configs, - element_transformer=lambda _, lb_frontend_ip_config: {"id": lb_frontend_ip_config} - ) - - -class PrivateEndpointConnectionUpdate(_PrivateEndpointConnectionUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZArgEnum - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.connection_status._required = True - args_schema.connection_status.enum = AAZArgEnum({"Approved": "Approved", "Rejected": "Rejected", "Removed": "Removed"}) - return args_schema # endregion @@ -4238,474 +2016,29 @@ def create_cross_region_load_balancer(cmd, load_balancer_name, resource_group_na if validate: _log_pprint_template(template) - if cmd.supported_api_version(min_api='2019-10-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES): - from azure.cli.core.commands import LongRunningOperation - validation_poller = client.begin_validate(resource_group_name, deployment_name, deployment) - return LongRunningOperation(cmd.cli_ctx)(validation_poller) - - return client.validate(resource_group_name, deployment_name, deployment) - - return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment) -# endregion - - -# region NetworkInterfaces (NIC) -class NICCreate(_NICCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - arg_group="IP Configuration", - help="Name of the virtual network.", - ) - args_schema.subnet = AAZResourceIdArg( - options=["--subnet"], - arg_group="IP Configuration", - help="Name or ID of an existing subnet. If name specified, please also specify `--vnet-name`; " - "If you want to use an existing subnet in other resource group, " - "please provide the ID instead of the name of the subnet.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/virtualNetworks/{vnet_name}/subnets/{}", - ), - ) - args_schema.application_security_groups = AAZListArg( - options=["--application-security-groups", "--asgs"], - arg_group="IP Configuration", - help="Space-separated list of application security groups.", - ) - args_schema.application_security_groups.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - ) - args_schema.private_ip_address = AAZStrArg( - options=["--private-ip-address"], - arg_group="IP Configuration", - help="Static private IP address to use.", - ) - args_schema.private_ip_address_version = AAZStrArg( - options=["--private-ip-address-version"], - arg_group="IP Configuration", - help="Version of private IP address to use.", - enum=["IPv4", "IPv6"], - default="IPv4", - ) - args_schema.public_ip_address = AAZResourceIdArg( - options=["--public-ip-address"], - arg_group="IP Configuration", - help="Name or ID of an existing public IP address.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" - "publicIPAddresses/{}" - ), - ) - args_schema.gateway_name = AAZStrArg( - options=["--gateway-name"], - arg_group="Application Gateway", - help="Name of the application gateway." - ) - args_schema.app_gateway_address_pools = AAZListArg( - options=["--app-gateway-address-pools", "--ag-address-pools"], - arg_group="Application Gateway", - help="Space-separated list of names or IDs of application gateway backend address pools to " - "associate with the NIC. If names are used, `--gateway-name` must be specified.", - ) - args_schema.app_gateway_address_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ), - ) - args_schema.lb_name = AAZStrArg( - options=["--lb-name"], - arg_group="Load Balancer", - help="Name of the load balancer", - ) - args_schema.lb_address_pools = AAZListArg( - options=["--lb-address-pools"], - arg_group="Load Balancer", - help="Space-separated list of names or IDs of load balancer address pools to associate with the NIC. " - "If names are used, `--lb-name` must be specified.", - ) - args_schema.lb_address_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/backendAddressPools/{}", - ), - ) - args_schema.lb_inbound_nat_rules = AAZListArg( - options=["--lb-inbound-nat-rules"], - arg_group="Load Balancer", - help="Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. " - "If names are used, `--lb-name` must be specified.", - ) - args_schema.lb_inbound_nat_rules.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/inboundNatRules/{}", - ), - ) - args_schema.edge_zone = AAZStrArg( - options=["--edge-zone"], - help="Name of edge zone." - ) - args_schema.network_security_group = AAZResourceIdArg( - options=["--network-security-group"], - help="Name or ID of an existing network security group", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/networkSecurityGroups/{}", - ), - ) - args_schema.extended_location._registered = False - args_schema.ip_configurations._registered = False - args_schema.nsg._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.network_security_group): - args.nsg.id = args.network_security_group - if has_value(args.edge_zone): - args.extended_location.name = args.edge_zone - args.extended_location.type = "EdgeZone" - ip_configuration = { - "name": "ipconfig1", - "private_ip_address": args.private_ip_address, - "private_ip_address_version": args.private_ip_address_version, # when address doesn't exist, version should be ipv4 (default) - "private_ip_allocation_method": "Static" if has_value(args.private_ip_address) else "Dynamic", - "subnet": {"id": args.subnet} if has_value(args.subnet) else None, - "public_ip_address": {"id": args.public_ip_address} if has_value(args.public_ip_address) else None, - "application_security_groups": [{"id": x} for x in args.application_security_groups] if has_value(args.application_security_groups) else None, - "application_gateway_backend_address_pools": [{"id": x} for x in args.app_gateway_address_pools] if has_value(args.app_gateway_address_pools) else None, - "load_balancer_backend_address_pools": [{"id": x} for x in args.lb_address_pools] if has_value(args.lb_address_pools) else None, - "load_balancer_inbound_nat_rules": [{"id": x} for x in args.lb_inbound_nat_rules] if has_value(args.lb_inbound_nat_rules) else None, - } - args.ip_configurations = [ip_configuration] - - def _output(self, *args, **kwargs): - result = super()._output(*args, **kwargs) - return {"NewNIC": result} - - -class NICUpdate(_NICUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_security_group = AAZResourceIdArg( - options=["--network-security-group"], - help="Name or ID of an existing network security group", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/networkSecurityGroups/{}", - ), - nullable=True, - ) - args_schema.nsg._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.network_security_group): - args.nsg.id = args.network_security_group - if has_value(args.internal_dns_name) and args.internal_dns_name == "": - args.internal_dns_name = None - - def post_instance_update(self, instance): - if not has_value(instance.properties.network_security_group.id): - instance.properties.network_security_group = None - - -def _get_nic_ip_config(nic, name): - if nic.ip_configurations: - ip_config = next( - (x for x in nic.ip_configurations if x.name.lower() == name.lower()), None) - else: - ip_config = None - if not ip_config: - raise CLIError('IP configuration {} not found.'.format(name)) - return ip_config - - -class NICIPConfigCreate(_NICIPConfigCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - arg_group="IP Configuration", - help="Name of the virtual network.", - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/virtualNetworks/{vnet_name}/subnets/{}", - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" - "publicIPAddresses/{}" - ) - args_schema.application_security_groups = AAZListArg( - options=["--application-security-groups", "--asgs"], - arg_group="IP Configuration", - help="Space-separated list of application security groups.", - ) - args_schema.application_security_groups.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - ) - args_schema.gateway_name = AAZStrArg( - options=["--gateway-name"], - arg_group="Application Gateway", - help="Name of the application gateway." - ) - args_schema.app_gateway_address_pools = AAZListArg( - options=["--app-gateway-address-pools", "--ag-address-pools"], - arg_group="Application Gateway", - help="Space-separated list of names or IDs of application gateway backend address pools to " - "associate with the NIC. If names are used, `--gateway-name` must be specified.", - ) - args_schema.app_gateway_address_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ), - ) - args_schema.lb_name = AAZStrArg( - options=["--lb-name"], - arg_group="Load Balancer", - help="Name of the load balancer", - ) - args_schema.lb_address_pools = AAZListArg( - options=["--lb-address-pools"], - arg_group="Load Balancer", - help="Space-separated list of names or IDs of load balancer address pools to associate with the NIC. " - "If names are used, `--lb-name` must be specified.", - ) - args_schema.lb_address_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/backendAddressPools/{}", - ), - ) - args_schema.lb_inbound_nat_rules = AAZListArg( - options=["--lb-inbound-nat-rules"], - arg_group="Load Balancer", - help="Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. " - "If names are used, `--lb-name` must be specified.", - ) - args_schema.lb_inbound_nat_rules.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/inboundNatRules/{}", - ), - ) - args_schema.application_gateway_backend_address_pools._registered = False - args_schema.load_balancer_backend_address_pools._registered = False - args_schema.load_balancer_inbound_nat_rules._registered = False - args_schema.private_ip_allocation_method._registered = False - args_schema.asgs_obj._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.private_ip_allocation_method = "Static" if has_value(args.private_ip_address) else "Dynamic" - if has_value(args.private_ip_address_prefix_length) and has_value(args.make_primary) and \ - args.make_primary.to_serialized_data() is True: - raise ArgumentUsageError( - 'usage error: When `--private-ip-address-prefix-length` is specified, `--make-primary` must be false') - - args.asgs_obj = assign_aaz_list_arg( - args.asgs_obj, - args.application_security_groups, - element_transformer=lambda _, asg_id: {"id": asg_id} - ) - args.application_gateway_backend_address_pools = assign_aaz_list_arg( - args.application_gateway_backend_address_pools, - args.app_gateway_address_pools, - element_transformer=lambda _, pool_id: {"id": pool_id} - ) - args.load_balancer_backend_address_pools = assign_aaz_list_arg( - args.load_balancer_backend_address_pools, - args.lb_address_pools, - element_transformer=lambda _, pool_id: {"id": pool_id} - ) - args.load_balancer_inbound_nat_rules = assign_aaz_list_arg( - args.load_balancer_inbound_nat_rules, - args.lb_inbound_nat_rules, - element_transformer=lambda _, rule_id: {"id": rule_id} - ) + if cmd.supported_api_version(min_api='2019-10-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES): + from azure.cli.core.commands import LongRunningOperation + validation_poller = client.begin_validate(resource_group_name, deployment_name, deployment) + return LongRunningOperation(cmd.cli_ctx)(validation_poller) - def pre_instance_create(self): - args = self.ctx.args - instance = self.ctx.vars.instance - if args.private_ip_address_version.to_serialized_data().lower() == "ipv4" and not has_value(args.subnet): - primary = next(x for x in instance.properties.ip_configurations if x.properties.primary) - args.subnet = primary.properties.subnet.id - if args.make_primary.to_serialized_data(): - for config in instance.properties.ip_configurations: - config.properties.primary = False + return client.validate(resource_group_name, deployment_name, deployment) + return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment) +# endregion -class NICIPConfigUpdate(_NICIPConfigUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - arg_group="IP Configuration", - help="Name of the virtual network.", - nullable=True, - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/virtualNetworks/{vnet_name}/subnets/{}", - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" - "publicIPAddresses/{}" - ) - args_schema.gateway_lb._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" - "loadBalancers/{}/frontendIPConfigurations/{}", - ) - args_schema.application_security_groups = AAZListArg( - options=["--application-security-groups", "--asgs"], - arg_group="IP Configuration", - help="Space-separated list of application security groups.", - nullable=True, - ) - args_schema.application_security_groups.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - nullable=True, - ) - args_schema.gateway_name = AAZStrArg( - options=["--gateway-name"], - arg_group="Application Gateway", - help="Name of the application gateway.", - nullable=True, - ) - args_schema.app_gateway_address_pools = AAZListArg( - options=["--app-gateway-address-pools", "--ag-address-pools"], - arg_group="Application Gateway", - help="Space-separated list of names or IDs of application gateway backend address pools to " - "associate with the NIC. If names are used, `--gateway-name` must be specified.", - nullable=True, - ) - args_schema.app_gateway_address_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationGateways/{gateway_name}/backendAddressPools/{}", - ), - nullable=True, - ) - args_schema.lb_name = AAZStrArg( - options=["--lb-name"], - arg_group="Load Balancer", - help="Name of the load balancer", - nullable=True, - ) - args_schema.lb_address_pools = AAZListArg( - options=["--lb-address-pools"], - arg_group="Load Balancer", - help="Space-separated list of names or IDs of load balancer address pools to associate with the NIC. " - "If names are used, `--lb-name` must be specified.", - nullable=True, - ) - args_schema.lb_address_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/backendAddressPools/{}", - ), - nullable=True, - ) - args_schema.lb_inbound_nat_rules = AAZListArg( - options=["--lb-inbound-nat-rules"], - arg_group="Load Balancer", - help="Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. " - "If names are used, `--lb-name` must be specified.", - nullable=True, - ) - args_schema.lb_inbound_nat_rules.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/inboundNatRules/{}", - ), - nullable=True, - ) - args_schema.application_gateway_backend_address_pools._registered = False - args_schema.load_balancer_backend_address_pools._registered = False - args_schema.load_balancer_inbound_nat_rules._registered = False - args_schema.private_ip_allocation_method._registered = False - args_schema.asgs_obj._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.private_ip_address): - if args.private_ip_address is None or args.private_ip_address == "": - # switch private IP address allocation to dynamic if empty string is used - args.private_ip_address = None - args.private_ip_allocation_method = "Dynamic" - args.private_ip_address_version = "IPv4" - else: - # if specific address provided, allocation is static - args.private_ip_allocation_method = "Static" - - if has_value(args.private_ip_address_prefix_length) and has_value(args.make_primary) and \ - args.make_primary.to_serialized_data() is True: - raise ArgumentUsageError( - 'usage error: When `--private-ip-address-prefix-length` is specified, `--make-primary` must be false') - - def pre_instance_update(self, instance): - args = self.ctx.args - instance = self.ctx.vars.instance - args.asgs_obj = assign_aaz_list_arg( - args.asgs_obj, - args.application_security_groups, - element_transformer=lambda _, asg_id: {"id": asg_id} - ) - args.application_gateway_backend_address_pools = assign_aaz_list_arg( - args.application_gateway_backend_address_pools, - args.app_gateway_address_pools, - element_transformer=lambda _, pool_id: {"id": pool_id} - ) - args.load_balancer_backend_address_pools = assign_aaz_list_arg( - args.load_balancer_backend_address_pools, - args.lb_address_pools, - element_transformer=lambda _, pool_id: {"id": pool_id} - ) - args.load_balancer_inbound_nat_rules = assign_aaz_list_arg( - args.load_balancer_inbound_nat_rules, - args.lb_inbound_nat_rules, - element_transformer=lambda _, rule_id: {"id": rule_id} - ) - # all ip configurations must belong to the same asgs - is_primary = args.make_primary.to_serialized_data() - for config in instance.properties.ip_configurations: - if is_primary: - config.properties.primary = False - config.properties.application_security_groups = args.asgs_obj - - def post_instance_update(self, instance): - if not has_value(instance.properties.subnet.id): - instance.properties.subnet = None - if not has_value(instance.properties.public_ip_address.id): - instance.properties.public_ip_address = None - if not has_value(instance.properties.gateway_load_balancer.id): - instance.properties.gateway_load_balancer = None + +# region NetworkInterfaces (NIC) + + +def _get_nic_ip_config(nic, name): + if nic.ip_configurations: + ip_config = next( + (x for x in nic.ip_configurations if x.name.lower() == name.lower()), None) + else: + ip_config = None + if not ip_config: + raise CLIError('IP configuration {} not found.'.format(name)) + return ip_config def add_nic_ip_config_address_pool(cmd, resource_group_name, network_interface_name, ip_config_name, @@ -4752,41 +2085,6 @@ def remove_nic_ip_config_address_pool(cmd, resource_group_name, network_interfac return AGPoolRemove(cli_ctx=cmd.cli_ctx)(command_args=arguments) -class NICIPConfigNATAdd(_NICIPConfigNATAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.lb_name = AAZStrArg( - options=["--lb-name"], - help="Name of the load balancer", - ) - args_schema.inbound_nat_rule._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/inboundNatRules/{}", - ) - return args_schema - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result["ipConfigurations"][0] - - -class NICIPConfigNATRemove(_NICIPConfigNATRemove): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.lb_name = AAZStrArg( - options=["--lb-name"], - help="Name of the load balancer", - ) - args_schema.inbound_nat_rule._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/loadBalancers/{lb_name}/inboundNatRules/{}", - ) - return args_schema # endregion @@ -4800,153 +2098,6 @@ def _handle_plural_or_singular(args, plural_name, singular_name): setattr(args, singular_name, values[0] if len(values) == 1 else None) -class NSGCreate(_NSGCreate): - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return {"NewNSG": result} - - -class NSGRuleCreate(_NSGRuleCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.priority._required = True - args_schema.destination_asgs = AAZListArg( - options=["--destination-asgs"], - arg_group="Destination", - help="Space-separated list of application security group names or IDs. Limited by backend server, " - "temporarily this argument only supports one application security group name or ID.", - ) - args_schema.destination_asgs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - ) - args_schema.source_asgs = AAZListArg( - options=["--source-asgs"], - arg_group="Source", - help="Space-separated list of application security group names or IDs. Limited by backend server, " - "temporarily this argument only supports one application security group name or ID.", - ) - args_schema.source_asgs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - ) - # filter arguments - args_schema.destination_address_prefix._registered = False - args_schema.destination_application_security_groups._registered = False - args_schema.destination_port_range._registered = False - args_schema.source_address_prefix._registered = False - args_schema.source_application_security_groups._registered = False - args_schema.source_port_range._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - _handle_plural_or_singular(args, "destination_address_prefixes", "destination_address_prefix") - _handle_plural_or_singular(args, "destination_port_ranges", "destination_port_range") - _handle_plural_or_singular(args, "source_address_prefixes", "source_address_prefix") - _handle_plural_or_singular(args, "source_port_ranges", "source_port_range") - # handle application security groups - if has_value(args.destination_asgs): - args.destination_application_security_groups = [{"id": asg_id} for asg_id in args.destination_asgs] - if has_value(args.destination_address_prefix): - args.destination_address_prefix = None - if has_value(args.source_asgs): - args.source_application_security_groups = [{"id": asg_id} for asg_id in args.source_asgs] - if has_value(args.source_address_prefix): - args.source_address_prefix = None - - -class NSGRuleUpdate(_NSGRuleUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.destination_asgs = AAZListArg( - options=["--destination-asgs"], - arg_group="Destination", - help="Space-separated list of application security group names or IDs. Limited by backend server, " - "temporarily this argument only supports one application security group name or ID.", - nullable=True, - ) - args_schema.destination_asgs.Element = AAZResourceIdArg( - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - ) - args_schema.source_asgs = AAZListArg( - options=["--source-asgs"], - arg_group="Source", - help="Space-separated list of application security group names or IDs. Limited by backend server, " - "temporarily this argument only supports one application security group name or ID.", - nullable=True, - ) - args_schema.source_asgs.Element = AAZResourceIdArg( - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/applicationSecurityGroups/{}", - ), - ) - # filter arguments - args_schema.destination_address_prefix._registered = False - args_schema.destination_application_security_groups._registered = False - args_schema.destination_port_range._registered = False - args_schema.source_address_prefix._registered = False - args_schema.source_application_security_groups._registered = False - args_schema.source_port_range._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - # handle application security groups - args.destination_application_security_groups = assign_aaz_list_arg( - args.destination_application_security_groups, - args.destination_asgs, - element_transformer=lambda _, asg_id: {"id": asg_id} - ) - args.source_application_security_groups = assign_aaz_list_arg( - args.source_application_security_groups, - args.source_asgs, - element_transformer=lambda _, asg_id: {"id": asg_id} - ) - - def pre_instance_update(self, instance): - if instance.properties.sourceAddressPrefix: - instance.properties.sourceAddressPrefixes = [instance.properties.sourceAddressPrefix] - instance.properties.sourceAddressPrefix = None - if instance.properties.destinationAddressPrefix: - instance.properties.destinationAddressPrefixes = [instance.properties.destinationAddressPrefix] - instance.properties.destinationAddressPrefix = None - if instance.properties.sourcePortRange: - instance.properties.sourcePortRanges = [instance.properties.sourcePortRange] - instance.properties.sourcePortRange = None - if instance.properties.destinationPortRange: - instance.properties.destinationPortRanges = [instance.properties.destinationPortRange] - instance.properties.destinationPortRange = None - - def post_instance_update(self, instance): - if instance.properties.sourceAddressPrefixes and len(instance.properties.sourceAddressPrefixes) == 1: - instance.properties.sourceAddressPrefix = instance.properties.sourceAddressPrefixes[0] - instance.properties.sourceAddressPrefixes = None - if instance.properties.destinationAddressPrefixes and len(instance.properties.destinationAddressPrefixes) == 1: - instance.properties.destinationAddressPrefix = instance.properties.destinationAddressPrefixes[0] - instance.properties.destinationAddressPrefixes = None - if instance.properties.sourcePortRanges and len(instance.properties.sourcePortRanges) == 1: - instance.properties.sourcePortRange = instance.properties.sourcePortRanges[0] - instance.properties.sourcePortRanges = None - if instance.properties.destinationPortRanges and len(instance.properties.destinationPortRanges) == 1: - instance.properties.destinationPortRange = instance.properties.destinationPortRanges[0] - instance.properties.destinationPortRanges = None - - def list_nsg_rules(cmd, resource_group_name, network_security_group_name, include_default=False): from .aaz.latest.network.nsg import Show nsg = Show(cli_ctx=cmd.cli_ctx)(command_args={ @@ -5292,86 +2443,6 @@ def create_public_ip(cmd, resource_group_name, public_ip_address_name, location= return PublicIPCreate(cli_ctx=cmd.cli_ctx)(command_args=public_ip_args) -class PublicIPCreate(_PublicIPCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/publicIPPrefixes/{}", - ) - args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ddosProtectionPlans/{}", - ) - return args_schema - - -class PublicIPUpdate(_PublicIPUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg, AAZDictArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/publicIPPrefixes/{}", - ) - args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ddosProtectionPlans/{}", - ) - args_schema.ip_tags = AAZDictArg( - options=["--ip-tags"], - help="Space-separated list of IP tags in `TYPE=VAL` format.", - nullable=True - ) - args_schema.ip_tags.Element = AAZStrArg() - args_schema.ip_tags_list._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.ip_tags): - if (ip_tags := args.ip_tags.to_serialized_data()) is None: - args.ip_tags_list = [] - else: - args.ip_tags_list = [{"ip_tag_type": k, "tag": v} for k, v in ip_tags.items()] - - def post_instance_update(self, instance): - if not has_value(instance.properties.ddos_settings.ddos_protection_plan.id): - instance.properties.ddos_settings.ddos_protection_plan = None - - -class PublicIpPrefixCreate(_PublicIpPrefixCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZDictArg, AAZStrArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.custom_ip_prefix_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/customIPPrefixes/{}" - ) - args_schema.ip_tags = AAZDictArg( - options=["--ip-tags"], - help="The list of tags associated with the public IP prefix in 'TYPE=VAL' format.", - ) - args_schema.ip_tags.Element = AAZStrArg() - args_schema.type._registered = False - args_schema.ip_tags_list._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.edge_zone): - args.type = 'EdgeZone' - if has_value(args.ip_tags): - ip_tags = [] - for k, v in args.ip_tags.to_serialized_data().items(): - ip_tags.append({"ip_tag_type": k, "tag": v}) - args.ip_tags_list = ip_tags # endregion @@ -5537,343 +2608,6 @@ def list_traffic_manager_endpoints(cmd, resource_group_name, profile_name, endpo # region VirtualNetworks -class VNetCreate(_VNetCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.edge_zone = AAZStrArg( - options=["--edge-zone"], - help="The name of edge zone.", - ) - # add subnet arguments - args_schema.subnet_name = AAZStrArg( - options=["--subnet-name"], - arg_group="Subnet", - help="Name of a new subnet to create within the VNet.", - ) - args_schema.subnet_prefixes = AAZListArg( - options=["--subnet-prefixes"], - arg_group="Subnet", - help="Space-separated list of address prefixes in CIDR format for the new subnet. If omitted, " - "automatically reserves a /24 (or as large as available) block within the VNet address space.", - ) - args_schema.subnet_prefixes.Element = AAZStrArg() - args_schema.subnet_nsg = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - arg_group="Subnet", - help="Name or ID of a network security group (NSG).", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/networkSecurityGroups/{}", - ), - ) - args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/ddosProtectionPlans/{}", - ) - # filter arguments - args_schema.extended_location._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.edge_zone): - args.extended_location.name = args.edge_zone - args.extended_location.type = "EdgeZone" - - if has_value(args.subnet_name): - subnet = {"name": args.subnet_name} - if not has_value(args.subnet_prefixes): - # set default value - address, bit_mask = str(args.address_prefixes[0]).split("/") - subnet_mask = 24 if int(bit_mask) < 24 else bit_mask - subnet["address_prefix"] = f"{address}/{subnet_mask}" - elif len(args.subnet_prefixes) == 1: - subnet["address_prefix"] = args.subnet_prefixes[0] - else: - subnet["address_prefixes"] = args.subnet_prefixes - if has_value(args.subnet_nsg): - subnet["network_security_group"] = {"id": args.subnet_nsg} - args.subnets = [subnet] - - if has_value(args.ipam_pool_prefix_allocations): - args.address_prefixes = [] - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return {"newVNet": result} - - -class VNetUpdate(_VNetUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - # handle detach logic - args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/ddosProtectionPlans/{}", - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - if args.ipam_pool_prefix_allocations.to_serialized_data(): - args.address_prefixes = [] - - def post_instance_update(self, instance): - if not has_value(instance.properties.ddos_protection_plan.id): - instance.properties.ddos_protection_plan = None - - -class VNetSubnetCreate(_VNetSubnetCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.delegations = AAZListArg( - options=["--delegations"], - help="Space-separated list of services to whom the subnet should be delegated, e.g., Microsoft.Sql/servers." - ) - args_schema.delegations.Element = AAZStrArg() - # add endpoint/policy arguments - args_schema.service_endpoints = AAZListArg( - options=["--service-endpoints"], - help="Space-separated list of services allowed private access to this subnet. " - "Values from: az network vnet list-endpoint-services.", - ) - args_schema.service_endpoints.Element = AAZStrArg() - args_schema.service_endpoint_policy = AAZListArg( - options=["--service-endpoint-policy"], - help="Space-separated list of names or IDs of service endpoint policies to apply.", - ) - args_schema.service_endpoint_policy.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/serviceEndpointPolicies/{}", - ), - ) - # add ple/pls arguments - args_schema.disable_private_endpoint_network_policies = AAZStrArg( - options=["--disable-private-endpoint-network-policies"], - help="Disable private endpoint network policies on the subnet. Please note that it will be replaced by `--private-endpoint-network-policies` soon.", - enum={ - "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", - "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", - }, - blank="Disabled", - ) - args_schema.disable_private_link_service_network_policies = AAZStrArg( - options=["--disable-private-link-service-network-policies"], - help="Disable private link service network policies on the subnet. Please note that it will be replaced by `--private-link-service-network-policies` soon.", - enum={ - "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", - "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", - }, - blank="Disabled", - ) - args_schema.nat_gateway._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/natGateways/{}", - ) - args_schema.network_security_group._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/networkSecurityGroups/{}", - ) - args_schema.route_table._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/routeTables/{}", - ) - # filter arguments - args_schema.policies._registered = False - args_schema.delegated_services._registered = False - args_schema.address_prefix._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - _handle_plural_or_singular(args, "address_prefixes", "address_prefix") - - def delegation_trans(index, service_name): - service_name = str(service_name) - # covert name to service name - if "/" not in service_name and len(service_name.split(".")) == 3: - _, service, resource_type = service_name.split(".") - service_name = f"Microsoft.{service}/{resource_type}" - return { - "name": str(index), - "service_name": service_name, - } - - if has_value(args.endpoints) and has_value(args.service_endpoints): - raise ArgumentUsageError("usage error: `--endpoints` and `--service-endpoints` cannot be used together, we prefer to use `endpoints` instead") - args.delegated_services = assign_aaz_list_arg( - args.delegated_services, - args.delegations, - element_transformer=delegation_trans - ) - args.endpoints = assign_aaz_list_arg( - args.endpoints, - args.service_endpoints, - element_transformer=lambda _, service_name: {"service": service_name} - ) - args.policies = assign_aaz_list_arg( - args.policies, - args.service_endpoint_policy, - element_transformer=lambda _, policy_id: {"id": policy_id} - ) - # use string instead of bool - if has_value(args.disable_private_endpoint_network_policies): - logger.warning(subnet_disable_ple_msg) - args.private_endpoint_network_policies = args.disable_private_endpoint_network_policies - if has_value(args.disable_private_link_service_network_policies): - logger.warning(subnet_disable_pls_msg) - args.private_link_service_network_policies = args.disable_private_link_service_network_policies - - if has_value(args.ipam_pool_prefix_allocations): - args.address_prefixes = [] - - -class VNetSubnetUpdate(_VNetSubnetUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.delegations = AAZListArg( - options=["--delegations"], - help="Space-separated list of services to whom the subnet should be delegated, e.g., Microsoft.Sql/servers.", - nullable=True, - ) - args_schema.delegations.Element = AAZStrArg( - nullable=True, - ) - # add endpoint/policy arguments - args_schema.service_endpoints = AAZListArg( - options=["--service-endpoints"], - help="Space-separated list of services allowed private access to this subnet. " - "Values from: az network vnet list-endpoint-services.", - nullable=True, - ) - args_schema.service_endpoints.Element = AAZStrArg( - nullable=True, - ) - args_schema.service_endpoint_policy = AAZListArg( - options=["--service-endpoint-policy"], - help="Space-separated list of names or IDs of service endpoint policies to apply.", - nullable=True, - ) - args_schema.service_endpoint_policy.Element = AAZResourceIdArg( - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/serviceEndpointPolicies/{}", - ), - ) - # add ple/pls arguments - args_schema.disable_private_endpoint_network_policies = AAZStrArg( - options=["--disable-private-endpoint-network-policies"], - help="Disable private endpoint network policies on the subnet. Please note that it will be replaced by `--private-endpoint-network-policies` soon.", - nullable=True, - enum={ - "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", - "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", - }, - blank="Disabled", - ) - args_schema.disable_private_link_service_network_policies = AAZStrArg( - options=["--disable-private-link-service-network-policies"], - help="Disable private link service network policies on the subnet. Please note that it will be replaced by `--private-link-service-network-policies` soon.", - nullable=True, - enum={ - "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", - "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", - }, - blank="Disabled", - ) - # filter arguments - args_schema.address_prefix._registered = False - args_schema.delegated_services._registered = False - args_schema.policies._registered = False - # handle detach logic - args_schema.nat_gateway._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/natGateways/{}", - ) - args_schema.network_security_group._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/networkSecurityGroups/{}", - ) - args_schema.route_table._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/routeTables/{}", - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - _handle_plural_or_singular(args, "address_prefixes", "address_prefix") - - def delegation_trans(index, service_name): - service_name = str(service_name) - # covert name to service name - if "/" not in service_name and len(service_name.split(".")) == 3: - _, service, resource_type = service_name.split(".") - service_name = f"Microsoft.{service}/{resource_type}" - return { - "name": str(index), - "service_name": service_name, - } - - if has_value(args.endpoints) and has_value(args.service_endpoints): - raise ArgumentUsageError("usage error: `--endpoints` and `--service-endpoints` cannot be used together, we prefer to use `endpoints` instead") - args.delegated_services = assign_aaz_list_arg( - args.delegated_services, - args.delegations, - element_transformer=delegation_trans - ) - args.endpoints = assign_aaz_list_arg( - args.endpoints, - args.service_endpoints, - element_transformer=lambda _, service_name: {"service": service_name} - ) - args.policies = assign_aaz_list_arg( - args.policies, - args.service_endpoint_policy, - element_transformer=lambda _, policy_id: {"id": policy_id} - ) - # use string instead of bool - if has_value(args.disable_private_endpoint_network_policies): - logger.warning(subnet_disable_ple_msg) - args.private_endpoint_network_policies = args.disable_private_endpoint_network_policies - if has_value(args.disable_private_link_service_network_policies): - logger.warning(subnet_disable_pls_msg) - args.private_link_service_network_policies = args.disable_private_link_service_network_policies - - if args.ipam_pool_prefix_allocations.to_serialized_data(): - args.address_prefixes = [] - - def post_instance_update(self, instance): - if not has_value(instance.properties.network_security_group.id): - instance.properties.network_security_group = None - if not has_value(instance.properties.route_table.id): - instance.properties.route_table = None - if not has_value(instance.properties.nat_gateway.id): - instance.properties.nat_gateway = None - - -class VNetPeeringCreate(_VNetPeeringCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sync_remote._registered = False - args_schema.remote_vnet._required = True - args_schema.remote_vnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}", - ) - return args_schema - - def list_available_ips(cmd, resource_group_name, virtual_network_name): from .aaz.latest.network.vnet import Show vnet = Show(cli_ctx=cmd.cli_ctx)(command_args={ @@ -5940,40 +2674,6 @@ def sync_vnet_peering(cmd, resource_group_name, virtual_network_name, virtual_ne # region VirtualNetworkGateways -class VnetGatewayRootCertCreate(_VnetGatewayRootCertCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_cert_data = AAZFileArg(options=['--public-cert-data'], - help="Base64 contents of the root certificate file or file path.", - required=True, - fmt=AAZFileArgBase64EncodeFormat()) - args_schema.root_cert_data._required = False - args_schema.root_cert_data._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.public_cert_data): - import os - path = os.path.expanduser(args.public_cert_data.to_serialized_data()) - else: - path = None - args.root_cert_data = path - - -class VnetGatewayRevokedCertCreate(_VnetGatewayRevokedCertCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.thumbprint._required = True - - return args_schema - - class RootCertFormat(AAZFileArgTextFormat): def read_file(self, file_path): with open(file_path, 'r', encoding=self._encoding) as cert_file: @@ -5983,249 +2683,6 @@ def read_file(self, file_path): return cert_data -class VnetGatewayCreate(_VnetGatewayCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZFileArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_addresses = AAZListArg(options=['--public-ip-addresses', '--public-ip-address'], - help="Specify a single public IP (name or ID) for an active-standby gateway. Specify two space-separated public IPs for an active-active gateway.") - args_schema.public_ip_addresses.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}" - ) - ) - args_schema.vnet = AAZResourceIdArg( - options=['--vnet'], - help="Name or ID of an existing virtual network which has a subnet named 'GatewaySubnet'.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - ) - args_schema.nat_rules.Element.external_mappings = AAZStrArg( - options=["external-mappings"], - help="Required.The private IP address external mapping for NAT.", - ) - args_schema.nat_rules.Element.internal_mappings = AAZStrArg( - options=["internal-mappings"], - help="Required.The private IP address internal mapping for NAT.", - ) - args_schema.root_cert_data = AAZFileArg(options=['--root-cert-data'], arg_group="Root Cert Authentication", - help="Base64 contents of the root certificate file or file path.", - fmt=RootCertFormat()) - args_schema.root_cert_name = AAZStrArg(options=['--root-cert-name'], arg_group="Root Cert Authentication", - help="Root certificate name.") - args_schema.gateway_default_site._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/localNetworkGateways/{}" - ) - args_schema.virtual_network_gateway_migration_status._registered = False - args_schema.ip_configurations._registered = False - args_schema.edge_zone_type._registered = False - args_schema.active._registered = False - args_schema.vpn_client_root_certificates._registered = False - args_schema.sku_tier._registered = False - args_schema.enable_bgp._registered = False - args_schema.nat_rules.Element.external_mappings_ip._registered = False - args_schema.nat_rules.Element.internal_mappings_ip._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - subnet = args.vnet.to_serialized_data() + '/subnets/GatewaySubnet' - args.sku_tier = args.sku - if has_value(args.gateway_type) and args.gateway_type != "LocalGateway": - args.active = len(args.public_ip_addresses) == 2 - else: - args.active = False - - args.ip_configurations = [] - if args.gateway_type != "LocalGateway": - if has_value(args.public_ip_addresses): - public_ip_addresses = args.public_ip_addresses.to_serialized_data() - ip_configuration = {} - for i, public_ip in enumerate(public_ip_addresses): - ip_configuration[i] = {'subnet': subnet, 'public_ip_address': public_ip, - 'private_ip_allocation_method': 'Dynamic', - 'name': 'vnetGatewayConfig{}'.format(i)} - args.ip_configurations.append(ip_configuration[i]) - else: - ip_configuration = {'subnet': subnet, - 'private_ip_allocation_method': 'Dynamic', - 'name': 'vnetGatewayConfig'} - args.ip_configurations.append(ip_configuration) - - else: - args.vpn_type = None - args.sku = None - args.sku_tier = None - - if has_value(args.asn) or has_value(args.bgp_peering_address) or has_value(args.peer_weight): - args.enable_bgp = True - else: - args.asn = None - args.bgp_peering_address = None - args.peer_weight = None - - if has_value(args.nat_rules): - rules = args.nat_rules.to_serialized_data() - for rule in rules: - if 'internal_mappings' in rule: - internal_mappings = rule['internal_mappings'].split(',') - rule['internal_mappings_ip'] = [{"address_space": internal_mapping} for internal_mapping in - internal_mappings] - if 'external_mappings' in rule: - external_mappings = rule['external_mappings'].split(',') - rule['external_mappings_ip'] = [{"address_space": external_mapping} for external_mapping in - external_mappings] - args.nat_rules = rules - - if has_value(args.address_prefixes) or has_value(args.client_protocol): - if has_value(args.root_cert_data): - data = args.root_cert_data.to_serialized_data() - else: - data = None - if has_value(args.root_cert_name): - args.vpn_client_root_certificates = [{'name': args.root_cert_name, 'public_cert_data': data}] - else: - args.vpn_client_root_certificates = [] - - if has_value(args.edge_zone): - args.edge_zone_type = 'EdgeZone' - - def _output(self, *args, **kwargs): - from azure.cli.core.aaz import AAZUndefined - if has_value(self.ctx.vars.instance.properties.nat_rules): - nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() - for nat_rule in nat_rules: - if 'type' in nat_rule['properties']: - # `properties.type` conflict with the `type` property when flatten `properties` - nat_rule['properties']['type'] = AAZUndefined - self.ctx.vars.instance.properties.nat_rules = nat_rules - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return {'vnetGateway': result} - - -class VnetGatewayUpdate(_VnetGatewayUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZFileArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_addresses = AAZListArg(options=['--public-ip-addresses', '--public-ip-address'], - help="Specify a single public IP (name or ID) for an active-standby gateway. Specify two space-separated public IPs for an active-active gateway.", - nullable=True) - args_schema.public_ip_addresses.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}" - ), - nullable=True, - ) - args_schema.vnet = AAZResourceIdArg( - options=['--vnet'], - help="Name or ID of an existing virtual network which has a subnet named 'GatewaySubnet'.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ), - ) - args_schema.root_cert_data = AAZFileArg(options=['--root-cert-data'], arg_group="Root Cert Authentication", - help="Base64 contents of the root certificate file or file path.", - fmt=RootCertFormat(), nullable=True) - args_schema.root_cert_name = AAZStrArg(options=['--root-cert-name'], arg_group="Root Cert Authentication", - help="Root certificate name.", nullable=True,) - args_schema.gateway_default_site._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/localNetworkGateways/{}" - ) - args_schema.enable_high_bandwidth_vpn_gateway._registered = False - args_schema.virtual_network_gateway_migration_status._registered = False - args_schema.ip_configurations._registered = False - args_schema.active._registered = False - args_schema.vpn_client_root_certificates._registered = False - args_schema.sku_tier._registered = False - args_schema.vpn_client_ipsec_policies._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - - if has_value(args.sku): - args.sku_tier = args.sku - - def pre_instance_update(self, instance): - args = self.ctx.args - if has_value(args.root_cert_data): - collection = instance.properties.vpn_client_configuration.vpn_client_root_certificates.to_serialized_data() - root_certificate = {'name': args.root_cert_name, 'public_cert_data': args.root_cert_data} - value = args.root_cert_name.to_serialized_data() - match = next((x for x in collection if getattr(x, 'name', None) == value), None) - if match: - collection.remove(match) - collection.append(root_certificate) - args.vpn_client_root_certificates = collection - - subnet_id = '{}/subnets/GatewaySubnet'.format(args.vnet) if has_value(args.vnet) else \ - instance.properties.ip_configurations[0].properties.subnet.id - - if has_value(args.vnet): - if has_value(instance.properties.ip_configurations): - for config in instance.properties.ip_configurations: - config.properties.subnet.id = subnet_id - - if has_value(args.public_ip_addresses): - instance.properties.ip_configurations = [] - public_ip_addresses = args.public_ip_addresses.to_serialized_data() - args.ip_configurations = [] - ip_configuration = {} - for i, public_ip in enumerate(public_ip_addresses): - ip_configuration[i] = {'subnet': subnet_id, 'public_ip_address': {'id': public_ip}, - 'private_ip_allocation_method': 'Dynamic', - 'name': 'vnetGatewayConfig{}'.format(i)} - args.ip_configurations.append(ip_configuration[i]) - - # Update active-active/active-standby status - active = len(args.public_ip_addresses) == 2 - if instance.properties.active_active and not active: - logger.info('Placing gateway in active-standby mode.') - elif not instance.properties.active_active and active: - logger.info('Placing gateway in active-active mode.') - args.active = active - - -class VNetGatewayShow(_VNetGatewayShow): - def _output(self, *args, **kwargs): - from azure.cli.core.aaz import AAZUndefined - - # resolve flatten conflict - # when the type field conflicts, the type in inner layer is ignored and the outer layer is applied - props = self.ctx.vars.instance.properties - if has_value(props.nat_rules): - for rule in props.nat_rules: - if has_value(rule.properties) and has_value(rule.properties.type): - rule.properties.type = AAZUndefined - - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - - return result - - -class VNetGatewayList(_VNetGatewayList): - def _output(self, *args, **kwargs): - from azure.cli.core.aaz import AAZUndefined - - # resolve flatten conflict - # when the type field conflicts, the type in inner layer is ignored and the outer layer is applied - for item in self.ctx.vars.instance.value: - props = item.properties - if has_value(props.nat_rules): - for rule in props.nat_rules: - if has_value(rule.properties) and has_value(rule.properties.type): - rule.properties.type = AAZUndefined - - result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - - return result, next_link - - def generate_vpn_client(cmd, resource_group_name, virtual_network_gateway_name, processor_architecture=None, authentication_method=None, radius_server_auth_certificate=None, client_root_certificates=None, use_legacy=False): @@ -6239,18 +2696,6 @@ def generate_vpn_client(cmd, resource_group_name, virtual_network_gateway_name, return _VpnProfileGenerate(cli_ctx=cmd.cli_ctx)(command_args=generate_args) # legacy implementation return _VpnClientPackageGenerate(cli_ctx=cmd.cli_ctx)(command_args=generate_args) - - -class VnetGatewayVpnConnectionsDisconnect(_VnetGatewayVpnConnectionsDisconnect): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vpn_connections.Element._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/connections/{}" - ) - - return args_schema # endregion @@ -6316,56 +2761,16 @@ def create_vpn_connection(cmd, resource_group_name, connection_name, vnet_gatewa return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment) -class VpnConnectionUpdate(_VpnConnectionUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.ipsec_policies._registered = False - - return args_schema - - def list_vpn_connections(cmd, resource_group_name, virtual_network_gateway_name=None): from .aaz.latest.network.vpn_connection import List, ListConnection if virtual_network_gateway_name: return ListConnection(cli_ctx=cmd.cli_ctx)(command_args={"resource_group": resource_group_name, "vnet_gateway": virtual_network_gateway_name}) return List(cli_ctx=cmd.cli_ctx)(command_args={"resource_group": resource_group_name}) - - -class VpnConnPackageCaptureStop(_VpnConnPackageCaptureStop): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sas_url._required = True - return args_schema - - -class VpnConnectionDeviceConfigScriptShow(_VpnConnectionDeviceConfigScriptShow): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.device_family._required = True - args_schema.firmware_version._required = True - args_schema.vendor._required = True - - return args_schema # endregion # region IPSec Policy Commands -class VnetGatewayIpsecPolicyAdd(_VnetGatewayIpsecPolicyAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vpn_client_ipsec_policy_index._registered = False - - return args_schema - - def clear_vnet_gateway_ipsec_policies(cmd, resource_group_name, gateway_name, no_wait=False): class VnetGatewayIpsecPoliciesClear(_VnetGatewayUpdate): @@ -6389,14 +2794,6 @@ def pre_instance_update(self, instance): return VnetGatewayIpsecPoliciesClear(cli_ctx=cmd.cli_ctx)(command_args=ipsec_policies_args) -class VpnConnIpsecPolicyAdd(_VpnConnIpsecPolicyAdd): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.ipsec_policy_index._registered = False - return args_schema - - def clear_vpn_conn_ipsec_policies(cmd, resource_group_name, connection_name, no_wait=False): class VpnConnIpsecPoliciesClear(_VpnConnectionUpdate): @@ -6417,18 +2814,6 @@ def pre_operations(self): return VpnConnIpsecPoliciesClear(cli_ctx=cmd.cli_ctx)(command_args=ipsec_policies_args) -class VnetGatewayAadAssign(_VnetGatewayAadAssign): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.audience._required = True - args_schema.issuer._required = True - args_schema.tenant._required = True - - return args_schema - - def remove_vnet_gateway_aad(cmd, resource_group_name, gateway_name, no_wait=False): class VnetGatewayAadRemove(_VnetGatewayUpdate): def pre_operations(self): @@ -6446,88 +2831,6 @@ def pre_operations(self): return LongRunningOperation(cmd.cli_ctx)(poller)['vpnClientConfiguration'] -class VnetGatewayNatRuleAdd(_VnetGatewayNatRuleAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.external_mappings = AAZListArg( - options=["--external-mappings"], - help="The private IP address external mapping for NAT.", - required=True - ) - args_schema.external_mappings.Element = AAZStrArg() - args_schema.internal_mappings = AAZListArg( - options=["--internal-mappings"], - help="The private IP address internal mapping for NAT.", - required=True - ) - args_schema.internal_mappings.Element = AAZStrArg() - - args_schema.external_mappings_ip._registered = False - args_schema.internal_mappings_ip._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.external_mappings): - args.external_mappings_ip = assign_aaz_list_arg( - args.external_mappings_ip, - args.external_mappings, - element_transformer=lambda _, external_mapping: {"address_space": external_mapping} - ) - - if has_value(args.internal_mappings): - args.internal_mappings_ip = assign_aaz_list_arg( - args.internal_mappings_ip, - args.internal_mappings, - element_transformer=lambda _, internal_mapping: {"address_space": internal_mapping} - ) - - def _output(self, *args, **kwargs): - from azure.cli.core.aaz import AAZUndefined - if has_value(self.ctx.vars.instance.properties.nat_rules): - nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() - for nat_rule in nat_rules: - if 'type' in nat_rule['properties']: - nat_rule['properties']['type'] = AAZUndefined - self.ctx.vars.instance.properties.nat_rules = nat_rules - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class VnetGatewayNatRuleShow(_VnetGatewayNatRuleShow): - - def _output(self, *args, **kwargs): - from azure.cli.core.aaz import AAZUndefined - if has_value(self.ctx.vars.instance.properties.nat_rules): - nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() - for nat_rule in nat_rules: - if 'type' in nat_rule['properties']: - nat_rule['properties']['type'] = AAZUndefined - self.ctx.vars.instance.properties.nat_rules = nat_rules - result = self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True) - return result - - -class VnetGatewayNatRuleRemove(_VnetGatewayNatRuleRemove): - - def _handler(self, command_args): - lro_poller = super()._handler(command_args) - lro_poller._result_callback = self._output - return lro_poller - - def _output(self, *args, **kwargs): - from azure.cli.core.aaz import AAZUndefined - if has_value(self.ctx.vars.instance.properties.nat_rules): - nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() - for nat_rule in nat_rules: - if 'type' in nat_rule['properties']: - nat_rule['properties']['type'] = AAZUndefined - self.ctx.vars.instance.properties.nat_rules = nat_rules - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result # endregion @@ -6615,38 +2918,13 @@ def delete_virtual_hub(cmd, resource_group_name, virtual_hub_name): # endregion -# region network gateway connection -class VpnConnSharedKeyUpdate(_VpnConnSharedKeyUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.value._required = True - return args_schema -# endregion - - -# region usages -class UsagesList(_UsagesList): - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - result = list(result) - for item in result: - item['currentValue'] = str(item['currentValue']) - item['limit'] = str(item['limit']) - item['localName'] = item['name']['localizedValue'] - return result, next_link -# endregion - - def remove_nw_connection_monitor_output(cmd, connection_monitor_name, location): update_args = { 'connection_monitor_name': connection_monitor_name, 'location': location } - from .operations.watcher import WatcherConnectionMonitorOutputRemove + from .operations.latest.network.watcher._helpers import WatcherConnectionMonitorOutputRemove return WatcherConnectionMonitorOutputRemove(cli_ctx=cmd.cli_ctx)(command_args=update_args) @@ -6656,93 +2934,10 @@ def remove_nw_connection_monitor_test_group(cmd, connection_monitor_name, locati 'location': location, 'test_group_name': name } - from .operations.watcher import WatcherConnectionMonitorTestGroupRemove + from .operations.latest.network.watcher._helpers import WatcherConnectionMonitorTestGroupRemove return WatcherConnectionMonitorTestGroupRemove(cli_ctx=cmd.cli_ctx)(command_args=update_args) -class SecurityPartnerProviderCreate(_SecurityPartnerProviderCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vhub._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", - ) - - return args_schema - - -class SecurityPartnerProviderUpdate(_SecurityPartnerProviderUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vhub._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", - ) - - return args_schema - - -class VirtualApplianceCreate(_VirtualApplianceCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vhub._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", - ) - - return args_schema - - -class VirtualApplianceUpdate(_VirtualApplianceUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vhub._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", - ) - - return args_schema - - -class CustomIpPrefixCreate(_CustomIpPrefixCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.is_parent = AAZBoolArg( - options=["--is-parent"], - help="Denotes that resource is being created as a Parent CustomIpPrefix", - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - if args.is_parent: - args.prefix_type = "Parent" - elif has_value(args.cip_prefix_parent): - args.prefix_type = "Child" - - -class CustomIpPrefixUpdate(_CustomIpPrefixUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZArgEnum - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.state.enum = AAZArgEnum({"commission": "Commissioning", "decommission": "Decommissioning", "deprovision": "Deprovisioning", "provision": "Provisioning"}) - - return args_schema - - def create_ddos_custom_policy(cmd, ddos_custom_policy_name, resource_group_name, location=None, tags=None, detection_rule_name=None, detection_mode=None, traffic_type=None, packets_per_second=None, no_wait=None): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/dns.py b/src/azure-cli/azure/cli/command_modules/network/operations/dns.py deleted file mode 100644 index f7d025baa75..00000000000 --- a/src/azure-cli/azure/cli/command_modules/network/operations/dns.py +++ /dev/null @@ -1,897 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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, protected-access, too-few-public-methods -from knack.log import get_logger - -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg -from azure.cli.core.aaz.utils import assign_aaz_list_arg -from ..aaz.latest.network.dns.record_set._update import Update as _RecordSetUpdate -from ..aaz.latest.network.dns.record_set._show import Show as _RecordSetShow -from ..aaz.latest.network.dns.record_set._list_by_type import ListByType as _RecordSetListByType -from ..aaz.latest.network.dns.record_set._delete import Delete as _RecordSetDelete -from ..aaz.latest.network.dns.record_set._create import Create as _RecordSetCreate -from ..aaz.latest.network.dns._list_references import ListReferences as _DNSListReferences - -logger = get_logger(__name__) - - -@register_command("network dns list-references") -class DNSListReferences(_DNSListReferences): - """ Returns the DNS records specified by the referencing targetResourceIds. - - :example: Returns the DNS records specified by the referencing targetResourceIds. - az network dns list-references --parameters "/subscriptions/**921/resourceGroups/MyResourceGroup/providers/Microsoft.Network/trafficManagerProfiles/MyTrafficManager" - """ - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.target_resources._registered = False - - args_schema.parameters = AAZListArg( - options=["--parameters"], - help="A space-separated list of resource IDs for which referencing dns records need to be queried.", - ) - - parameters = args_schema.parameters - parameters.Element = AAZResourceIdArg() - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.target_resources = assign_aaz_list_arg( - args.target_resources, - args.parameters, - element_transformer=lambda _, x: {"id": x}) - - -# region RecordSetUpdate -class RecordSetUpdate(_RecordSetUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.target_resource._fmt = AAZResourceIdArgFormat() - - args_schema.record_type._required = False - args_schema.record_type._registered = False - - args_schema.ttl._registered = False - args_schema.a_records._registered = False - args_schema.aaaa_records._registered = False - args_schema.caa_records._registered = False - args_schema.cname_record._registered = False - args_schema.ds_records._registered = False - args_schema.mx_records._registered = False - args_schema.naptr_records._registered = False - args_schema.ns_records._registered = False - args_schema.ptr_records._registered = False - args_schema.soa_record._registered = False - args_schema.srv_records._registered = False - args_schema.tlsa_records._registered = False - args_schema.txt_records._registered = False - - args_schema.naptr_records._registered = False - return args_schema - - def post_instance_update(self, instance): - if not has_value(instance.properties.target_resource.id): - instance.properties.target_resource = None - - -@register_command("network dns record-set a update") -class RecordSetAUpdate(RecordSetUpdate): - """ Update an A record set. - - :example: Update an A record set. - az network dns record-set a update -g MyResourceGroup -n MyRecordSet -z www.mysite.com --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network dns record-set aaaa update") -class RecordSetAAAAUpdate(RecordSetUpdate): - """ Update an AAAA record set. - - :example: Update an AAAA record set. - az network dns record-set aaaa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network dns record-set ds update") -class RecordSetDSUpdate(RecordSetUpdate): - """ Update an DS record set. - - :example: Update an DS record set. - az network dns record-set ds update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "DS" - - -@register_command("network dns record-set mx update") -class RecordSetMXUpdate(RecordSetUpdate): - """ Update an MX record set. - - :example: Update an MX record set. - az network dns record-set mx update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network dns record-set naptr update") -class RecordSetNAPTRUpdate(RecordSetUpdate): - """ Update an NAPTR record set. - - :example: Update an NAPTR record set. - az network dns record-set naptr update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NAPTR" - - -@register_command("network dns record-set ns update") -class RecordSetNSUpdate(RecordSetUpdate): - """ Update an NS record set. - - :example: Update an NS record set. - az network dns record-set ns update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NS" - - -@register_command("network dns record-set ptr update") -class RecordSetPTRUpdate(RecordSetUpdate): - """ Update a PTR record set. - - :example: Update a PTR record set. - az network dns record-set ptr update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network dns record-set srv update") -class RecordSetSRVUpdate(RecordSetUpdate): - """ Update an SRV record set. - - :example: Update an SRV record set. - az network dns record-set srv update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network dns record-set tlsa update") -class RecordSetTLSAUpdate(RecordSetUpdate): - """ Update a TLSA record set. - - :example: Update a TLSA record set. - az network dns record-set tlsa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TLSA" - - -@register_command("network dns record-set txt update") -class RecordSetTXTUpdate(RecordSetUpdate): - """ Update a TXT record set. - - :example: Update a TXT record set. - az network dns record-set txt update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" - - -@register_command("network dns record-set caa update") -class RecordSetCAAUpdate(RecordSetUpdate): - """ Update a CAA record set. - - :example: Update a CAA record set. - az network dns record-set caa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CAA" - - -@register_command("network dns record-set cname update") -class RecordSetCNAMEUpdate(RecordSetUpdate): - """ Update a CNAME record set. - - :example: Update a CNAME record set. - az network dns record-set cname update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" -# endregion RecordSetUpdate - - -# region RecordSetShow -class RecordSetShow(_RecordSetShow): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.record_type._required = False - args_schema.record_type._registered = False - - return args_schema - - -@register_command("network dns record-set a show") -class RecordSetAShow(RecordSetShow): - """ Get an A record set. - - :example: Get an A record set. - az network dns record-set a show -g MyResourceGroup -n MyRecordSet -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network dns record-set aaaa show") -class RecordSetAAAAShow(RecordSetShow): - """ Get an AAAA record set. - - :example: Get an AAAA record set. - az network dns record-set aaaa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network dns record-set ds show") -class RecordSetDSShow(RecordSetShow): - """ Get an DS record set. - - :example: Get an DS record set. - az network dns record-set ds show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "DS" - - -@register_command("network dns record-set mx show") -class RecordSetMXShow(RecordSetShow): - """ Get an MX record set. - - :example: Get an MX record set. - az network dns record-set mx show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network dns record-set naptr show") -class RecordSetNAPTRShow(RecordSetShow): - """ Get an NAPTR record set. - - :example: Get an NAPTR record set. - az network dns record-set naptr show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NAPTR" - - -@register_command("network dns record-set ns show") -class RecordSetNSShow(RecordSetShow): - """ Get an NS record set. - - :example: Get an NS record set. - az network dns record-set ns show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NS" - - -@register_command("network dns record-set ptr show") -class RecordSetPTRShow(RecordSetShow): - """ Get a PTR record set. - - :example: Get a PTR record set. - az network dns record-set ptr show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network dns record-set srv show") -class RecordSetSRVShow(RecordSetShow): - """ Get an SRV record set. - - :example: Get an SRV record set. - az network dns record-set srv show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network dns record-set tlsa show") -class RecordSetTLSAShow(RecordSetShow): - """ Get a TLSA record set. - - :example: Get a TLSA record set. - az network dns record-set tlsa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TLSA" - - -@register_command("network dns record-set txt show") -class RecordSetTXTShow(RecordSetShow): - """ Get a TXT record set. - - :example: Get a TXT record set. - az network dns record-set txt show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" - - -@register_command("network dns record-set caa show") -class RecordSetCAAShow(RecordSetShow): - """ Get a CAA record set. - - :example: Get a CAA record set. - az network dns record-set caa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CAA" - - -@register_command("network dns record-set cname show") -class RecordSetCNAMEShow(RecordSetShow): - """ Get a CNAME record set. - - :example: Get a CNAME record set. - az network dns record-set cname show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - - -@register_command("network dns record-set soa show") -class RecordSetSOAShow(RecordSetShow): - """ Get a SOA record set. - - :example: Get a SOA record set. - az network dns record-set soa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.name._required = False - args_schema.name._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.record_type = "SOA" - args.name = "@" -# endregion RecordSetShow - - -# region RecordSetList -class RecordSetList(_RecordSetListByType): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.record_type._required = False - args_schema.record_type._registered = False - - return args_schema - - -@register_command("network dns record-set a list") -class RecordSetAList(RecordSetList): - """ List A record sets in a zone. - - :example: List A record sets in a zone. - az network dns record-set a list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network dns record-set aaaa list") -class RecordSetAAAAList(RecordSetList): - """ List AAAA record sets in a zone. - - :example: List AAAA record sets in a zone. - az network dns record-set aaaa list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network dns record-set ds list") -class RecordSetDSList(RecordSetList): - """ List DS record sets in a zone. - - :example: List DS record sets in a zone. - az network dns record-set ds list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "DS" - - -@register_command("network dns record-set mx list") -class RecordSetMXList(RecordSetList): - """ List MX record sets in a zone. - - :example: List MX record sets in a zone. - az network dns record-set mx list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network dns record-set naptr list") -class RecordSetNAPTRList(RecordSetList): - """ List NAPTR record sets in a zone. - - :example: List NAPTR record sets in a zone. - az network dns record-set naptr list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NAPTR" - - -@register_command("network dns record-set ns list") -class RecordSetNSList(RecordSetList): - """ List NS record sets in a zone. - - :example: List NS record sets in a zone. - az network dns record-set ns list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NS" - - -@register_command("network dns record-set ptr list") -class RecordSetPTRList(RecordSetList): - """ List PTR record sets in a zone. - - :example: List PTR record sets in a zone. - az network dns record-set ptr list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network dns record-set srv list") -class RecordSetSRVList(RecordSetList): - """ List SRV record sets in a zone. - - :example: List SRV record sets in a zone. - az network dns record-set srv list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network dns record-set tlsa list") -class RecordSetTLSAList(RecordSetList): - """ List TLSA record sets in a zone. - - :example: List TLSA record sets in a zone. - az network dns record-set tlsa list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TLSA" - - -@register_command("network dns record-set txt list") -class RecordSetTXTList(RecordSetList): - """ List TXT record sets in a zone. - - :example: List TXT record sets in a zone. - az network dns record-set txt list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" - - -@register_command("network dns record-set caa list") -class RecordSetCAAList(RecordSetList): - """ List CAA record sets in a zone. - - :example: List CAA record sets in a zone. - az network dns record-set caa list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CAA" - - -@register_command("network dns record-set cname list") -class RecordSetCNAMEList(RecordSetList): - """ List CNAME record sets in a zone. - - :example: List CNAME record sets in a zone. - az network dns record-set cname list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" -# endregion RecordSetList - - -# region RecordSetDelete -class RecordSetDelete(_RecordSetDelete): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.record_type._required = False - args_schema.record_type._registered = False - - return args_schema - - -@register_command("network dns record-set a delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetADelete(RecordSetDelete): - """ Delete an A record set. - - :example: Delete an A record set. - az network dns record-set a delete -g MyResourceGroup -n MyRecordSet -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network dns record-set aaaa delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetAAAADelete(RecordSetDelete): - """ Delete an AAAA record set. - - :example: Delete an AAAA record set. - az network dns record-set aaaa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network dns record-set ds delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetDSDelete(RecordSetDelete): - """ Delete an DS record set. - - :example: Delete an DS record set. - az network dns record-set ds delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "DS" - - -@register_command("network dns record-set mx delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetMXDelete(RecordSetDelete): - """ Delete an MX record set. - - :example: Delete an MX record set. - az network dns record-set mx delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network dns record-set naptr delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetNAPTRDelete(RecordSetDelete): - """ Delete an NAPTR record set. - - :example: Delete an NAPTR record set. - az network dns record-set naptr delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NAPTR" - - -@register_command("network dns record-set ns delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetNSDelete(RecordSetDelete): - """ Delete an NS record set. - - :example: Delete an NS record set. - az network dns record-set ns delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NS" - - -@register_command("network dns record-set ptr delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetPTRDelete(RecordSetDelete): - """ Delete a PTR record set. - - :example: Delete a PTR record set. - az network dns record-set ptr delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network dns record-set srv delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetSRVDelete(RecordSetDelete): - """ Delete an SRV record set. - - :example: Delete an SRV record set. - az network dns record-set srv delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network dns record-set tlsa delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetTLSADelete(RecordSetDelete): - """ Delete a TLSA record set. - - :example: Delete a TLSA record set. - az network dns record-set tlsa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TLSA" - - -@register_command("network dns record-set txt delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetTXTDelete(RecordSetDelete): - """ Delete a TXT record set. - - :example: Delete a TXT record set. - az network dns record-set txt delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" - - -@register_command("network dns record-set caa delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetCAADelete(RecordSetDelete): - """ Delete a CAA record set. - - :example: Delete a CAA record set. - az network dns record-set caa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CAA" - - -@register_command("network dns record-set cname delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetCNAMEDelete(RecordSetDelete): - """ Delete a CNAME record set. - - :example: Delete a CNAME record set. - az network dns record-set cname delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" -# endregion RecordSetDelete - - -# region RecordSetCreate -class RecordSetCreate(_RecordSetCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.target_resource._fmt = AAZResourceIdArgFormat() - - args_schema.record_type._required = False - args_schema.record_type._registered = False - - args_schema.a_records._registered = False - args_schema.aaaa_records._registered = False - args_schema.caa_records._registered = False - args_schema.cname_record._registered = False - args_schema.ds_records._registered = False - args_schema.mx_records._registered = False - args_schema.ns_records._registered = False - args_schema.ptr_records._registered = False - args_schema.soa_record._registered = False - args_schema.srv_records._registered = False - args_schema.tlsa_records._registered = False - args_schema.txt_records._registered = False - - args_schema.naptr_records._registered = False - return args_schema - - -@register_command("network dns record-set a create") -class RecordSetACreate(RecordSetCreate): - """ Create an A record set. - - :example: Create an A record set. - az network dns record-set a create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network dns record-set aaaa create") -class RecordSetAAAACreate(RecordSetCreate): - """ Create an AAAA record set. - - :example: Create an AAAA record set. - az network dns record-set aaaa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network dns record-set ds create") -class RecordSetDSCreate(RecordSetCreate): - """ Create an DS record set. - - :example: Create an DS record set. - az network dns record-set ds create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "DS" - - -@register_command("network dns record-set mx create") -class RecordSetMXCreate(RecordSetCreate): - """ Create an MX record set. - - :example: Create an MX record set. - az network dns record-set mx create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network dns record-set naptr create") -class RecordSetNAPTRCreate(RecordSetCreate): - """ Create an NAPTR record set. - - :example: Create an NAPTR record set. - az network dns record-set naptr create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NAPTR" - - -@register_command("network dns record-set ns create") -class RecordSetNSCreate(RecordSetCreate): - """ Create an NS record set. - - :example: Create an NS record set. - az network dns record-set ns create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "NS" - - -@register_command("network dns record-set ptr create") -class RecordSetPTRCreate(RecordSetCreate): - """ Create a PTR record set. - - :example: Create a PTR record set. - az network dns record-set ptr create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network dns record-set srv create") -class RecordSetSRVCreate(RecordSetCreate): - """ Create an SRV record set. - - :example: Create an SRV record set. - az network dns record-set srv create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network dns record-set tlsa create") -class RecordSetTLSACreate(RecordSetCreate): - """ Create a TLSA record set. - - :example: Create a TLSA record set. - az network dns record-set tlsa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TLSA" - - -@register_command("network dns record-set txt create") -class RecordSetTXTCreate(RecordSetCreate): - """ Create a TXT record set. - - :example: Create a TXT record set. - az network dns record-set txt create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" - - -@register_command("network dns record-set caa create") -class RecordSetCAACreate(RecordSetCreate): - """ Create a CAA record set. - - :example: Create a CAA record set. - az network dns record-set caa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CAA" - - -@register_command("network dns record-set cname create") -class RecordSetCNAMECreate(RecordSetCreate): - """ Create a CNAME record set. - - :example: Create a CNAME record set. - az network dns record-set cname create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - - -class RecordSetSOACreate(RecordSetCreate): - def pre_operations(self): - args = self.ctx.args - args.record_type = "SOA" -# endregion RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/_list_usages.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/_list_usages.py new file mode 100644 index 00000000000..d882b66dd1e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/_list_usages.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network._list_usages import ListUsages as _UsagesList +from azure.cli.command_modules.network._format import transform_network_usage_table + + +class UsagesList(_UsagesList): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_network_usage_table + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + result = list(result) + for item in result: + item['currentValue'] = str(item['currentValue']) + item['limit'] = str(item['limit']) + item['localName'] = item['name']['localizedValue'] + return result, next_link diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py new file mode 100644 index 00000000000..f281934b6b0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py @@ -0,0 +1,41 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate + + +class ApplicationGatewayUpdate(_ApplicationGatewayUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZDictArg, AAZStrArg, AAZArgEnum + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.custom_error_pages = AAZDictArg( + options=["--custom-error-pages"], + help="Space-separated list of custom error pages in `STATUS_CODE=URL` format.", + nullable=True, + ) + args_schema.custom_error_pages.Element = AAZStrArg( + nullable=True, + ) + args_schema.http2.enum = AAZArgEnum({"Enabled": True, "Disabled": False}) + args_schema.custom_error_configurations._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.custom_error_pages): + configurations = [] + for code, url in args.custom_error_pages.items(): + configurations.append({ + "status_code": code, + "custom_error_page_url": url, + }) + args.custom_error_configurations = configurations + if has_value(args.sku): + sku = str(args.sku) + args.sku.tier = sku.split("_", 1)[0] if not _is_v2_sku(sku) else sku diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_create.py new file mode 100644 index 00000000000..25571be504d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_create.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +import socket +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.address_pool._create import Create as _AddressPoolCreate + + +class AddressPoolCreate(_AddressPoolCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.servers = AAZListArg( + options=["--servers"], + help="Space-separated list of IP addresses or DNS names corresponding to backend servers." + ) + args_schema.servers.Element = AAZStrArg() + args_schema.backend_addresses._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + + def server_trans(_, server): + try: + socket.inet_aton(str(server)) # pylint:disable=no-member + return {"ip_address": server} + except OSError: # pylint:disable=no-member + return {"fqdn": server} + + args.backend_addresses = assign_aaz_list_arg( + args.backend_addresses, + args.servers, + element_transformer=server_trans + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_update.py new file mode 100644 index 00000000000..79374c1f11b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/address_pool/_update.py @@ -0,0 +1,56 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +import socket +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.address_pool._update import Update as _AddressPoolUpdate + + +class AddressPoolUpdate(_AddressPoolUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.servers = AAZListArg( + options=["--servers"], + help="Space-separated list of IP addresses or DNS names corresponding to backend servers.", + nullable=True, + ) + args_schema.servers.Element = AAZStrArg( + nullable=True, + ) + args_schema.backend_addresses._registered = False + return args_schema + + class NonRetryableCreateOrUpdate(_AddressPoolUpdate.ApplicationGatewaysCreateOrUpdate): + CLIENT_TYPE = "NonRetryableClient" + + def _execute_operations(self): + self.pre_operations() + self.ApplicationGatewaysGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.selectors.subresource.required()) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.selectors.subresource.required()) + yield self.NonRetryableCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + def pre_operations(self): + args = self.ctx.args + + def server_trans(_, server): + try: + socket.inet_aton(str(server)) # pylint:disable=no-member + return {"ip_address": server} + except OSError: # pylint:disable=no-member + return {"fqdn": server} + + args.backend_addresses = assign_aaz_list_arg( + args.backend_addresses, + args.servers, + element_transformer=server_trans + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py new file mode 100644 index 00000000000..7363e9d2ee2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.auth_cert._create import Create as _AuthCertCreate + + +class AuthCertCreate(_AuthCertCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.cert_file = AAZFileArg( + options=["--cert-file"], + help="Path to the certificate file.", + required=True, + fmt=AAZFileArgBase64EncodeFormat(), + ) + args_schema.data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.cert_file): + args.data = args.cert_file diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py new file mode 100644 index 00000000000..0a4ba14d8b6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.auth_cert._update import Update as _AuthCertUpdate + + +class AuthCertUpdate(_AuthCertUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.cert_file = AAZFileArg( + options=["--cert-file"], + help="Path to the certificate file.", + required=True, + fmt=AAZFileArgBase64EncodeFormat(), + nullable=True, + ) + args_schema.data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.cert_file): + args.data = args.cert_file diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py new file mode 100644 index 00000000000..b6f8d10d6fa --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.client_cert._add import Add as _ClientCertAdd + + +class ClientCertAdd(_ClientCertAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.data = AAZFileArg( + options=["--data"], + help="Path to the certificate file.", + required=True, + fmt=AAZFileArgBase64EncodeFormat(), + ) + args_schema.cert_data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.data): + args.cert_data = args.data + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py new file mode 100644 index 00000000000..3dfbef4c0f2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.client_cert._update import Update as _ClientCertUpdate + + +class ClientCertUpdate(_ClientCertUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.data = AAZFileArg( + options=["--data"], + help="Path to the certificate file.", + required=True, + fmt=AAZFileArgBase64EncodeFormat(), + nullable=True, + ) + args_schema.cert_data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.data): + args.cert_data = args.data diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py new file mode 100644 index 00000000000..07847a262e0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.frontend_ip._create import Create as _FrontendIPCreate + + +class FrontedIPCreate(_FrontendIPCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + options=["--vnet-name"], + help="Name of the virtual network corresponding to the subnet." + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/publicIpAddresses/{}", + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/virtualNetworks/{vnet_name}/subnets/{}", + ) + args_schema.private_ip_allocation_method._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.private_ip_allocation_method = "Static" if has_value(args.private_ip_address) else "Dynamic" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py new file mode 100644 index 00000000000..420c9d86595 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.frontend_ip._update import Update as _FrontendIPUpdate + + +class FrontedIPUpdate(_FrontendIPUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + options=["--vnet-name"], + help="Name of the virtual network corresponding to the subnet." + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/virtualNetworks/{vnet_name}/subnets/{}", + ) + args_schema.private_ip_allocation_method._registered = False + return args_schema + + def post_instance_update(self, instance): + instance.properties.private_ip_allocation_method = "Static" if has_value(instance.properties.private_ip_address) else "Dynamic" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py new file mode 100644 index 00000000000..1f0b3440278 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py @@ -0,0 +1,60 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_listener._create import Create as _HTTPListenerCreate + + +class HTTPListenerCreate(_HTTPListenerCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", + ) + args_schema.frontend_port._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendPorts/{}", + ) + args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslCertificates/{}", + ) + args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslProfiles/{}", + ) + args_schema.waf_policy._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ApplicationGatewayWebApplicationFirewallPolicies/{}", + ) + args_schema.frontend_port._required = True + args_schema.protocol._registered = False + args_schema.require_server_name_indication._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.ssl_cert): + args.protocol = "Https" + args.require_server_name_indication = True if has_value(args.host_name) else None + else: + args.protocol = "Http" + + def pre_instance_create(self): + args = self.ctx.args + if not has_value(args.frontend_ip): + instance = self.ctx.vars.instance + frontend_ip_configurations = instance.properties.frontend_ip_configurations + if len(frontend_ip_configurations) == 1: + args.frontend_ip = instance.properties.frontend_ip_configurations[0].id + elif len(frontend_ip_configurations) > 1: + err_msg = "Multiple frontend IP configurations found. Specify --frontend-ip explicitly." + raise ArgumentUsageError(err_msg) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py new file mode 100644 index 00000000000..2162fe2c53f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py @@ -0,0 +1,54 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_listener._update import Update as _HTTPListenerUpdate + + +class HTTPListenerUpdate(_HTTPListenerUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", + ) + args_schema.frontend_port._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendPorts/{}", + ) + args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslCertificates/{}", + ) + args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslProfiles/{}", + ) + args_schema.waf_policy._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ApplicationGatewayWebApplicationFirewallPolicies/{}", + ) + args_schema.frontend_port._nullable = False + args_schema.protocol._registered = False + args_schema.require_server_name_indication._registered = False + return args_schema + + def post_instance_update(self, instance): + instance.properties.protocol = "Https" if has_value(instance.properties.ssl_certificate) else "Http" + cond1 = instance.properties.host_name + cond2 = instance.properties.protocol.to_serialized_data().lower() == "https" + instance.properties.require_server_name_indication = cond1 and cond2 + if not has_value(instance.properties.frontend_ip_configuration.id): + instance.properties.frontend_ip_configuration = None + if not has_value(instance.properties.ssl_certificate.id): + instance.properties.ssl_certificate = None + if not has_value(instance.properties.ssl_profile.id): + instance.properties.ssl_profile = None + if not has_value(instance.properties.firewall_policy.id): + instance.properties.firewall_policy = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_create.py new file mode 100644 index 00000000000..8401905e267 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_create.py @@ -0,0 +1,73 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_settings._create import Create as _HTTPSettingsCreate + + +class HTTPSettingsCreate(_HTTPSettingsCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZIntArg, AAZIntArgFormat, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.auth_certs = AAZListArg( + options=["--auth-certs"], + help="Space-separated list of authentication certificates (Names and IDs) to associate with the HTTP settings.", + ) + args_schema.auth_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/authenticationCertificates/{}", + ), + ) + args_schema.root_certs = AAZListArg( + options=["--root-certs"], + help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " + "`--host-name` or `--host-name-from-backend-pool` is required when this field is set.", + ) + args_schema.root_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", + ), + ) + args_schema.connection_draining_timeout = AAZIntArg( + options=["--connection-draining-timeout"], + help="Time in seconds after a backend server is removed during which on open connection remains active. " + "Range from 0 (Disabled) to 3600.", + default=0, + fmt=AAZIntArgFormat( + maximum=3600, + minimum=0, + ), + ) + args_schema.probe._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/probes/{}", + ) + args_schema.cookie_based_affinity._blank = "Enabled" + args_schema.port._required = True + args_schema.authentication_certificates._registered = False + args_schema.trusted_root_certificates._registered = False + args_schema.connection_draining._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.authentication_certificates = assign_aaz_list_arg( + args.authentication_certificates, + args.auth_certs, + element_transformer=lambda _, auth_cert_id: {"id": auth_cert_id} + ) + args.trusted_root_certificates = assign_aaz_list_arg( + args.trusted_root_certificates, + args.root_certs, + element_transformer=lambda _, root_cert_id: {"id": root_cert_id} + ) + timeout = args.connection_draining_timeout.to_serialized_data() + args.connection_draining.enabled = bool(timeout) + args.connection_draining.drain_timeout_in_sec = timeout or 1 diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py new file mode 100644 index 00000000000..8f67e062a66 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py @@ -0,0 +1,83 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_settings._update import Update as _HTTPSettingsUpdate + + +class HTTPSettingsUpdate(_HTTPSettingsUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZIntArg, AAZIntArgFormat, AAZResourceIdArg, AAZResourceIdArgFormat + + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.auth_certs = AAZListArg( + options=["--auth-certs"], + help="Space-separated list of authentication certificates (Names and IDs) to associate with the HTTP settings.", + nullable=True, + ) + args_schema.auth_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/authenticationCertificates/{}", + ), + nullable=True, + ) + args_schema.root_certs = AAZListArg( + options=["--root-certs"], + help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " + "`--host-name` or `--host-name-from-backend-pool` is required when this field is set.", + nullable=True, + ) + args_schema.root_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", + ), + nullable=True, + ) + args_schema.connection_draining_timeout = AAZIntArg( + options=["--connection-draining-timeout"], + help="Time in seconds after a backend server is removed during which on open connection remains active. " + "Range from 0 (Disabled) to 3600.", + fmt=AAZIntArgFormat( + maximum=3600, + minimum=0, + ), + nullable=True, + ) + args_schema.probe._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/probes/{}", + ) + args_schema.cookie_based_affinity._blank = "Enabled" + args_schema.authentication_certificates._registered = False + args_schema.trusted_root_certificates._registered = False + args_schema.connection_draining._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.authentication_certificates = assign_aaz_list_arg( + args.authentication_certificates, + args.auth_certs, + element_transformer=lambda _, auth_cert_id: {"id": auth_cert_id} + ) + args.trusted_root_certificates = assign_aaz_list_arg( + args.trusted_root_certificates, + args.root_certs, + element_transformer=lambda _, root_cert_id: {"id": root_cert_id} + ) + if has_value(args.connection_draining_timeout): + timeout = args.connection_draining_timeout.to_serialized_data() + args.connection_draining.enabled = bool(timeout) + args.connection_draining.drain_timeout_in_sec = timeout or 1 + + def post_instance_update(self, instance): + if not has_value(instance.properties.probe.id): + instance.properties.probe = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/_assign.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/_assign.py new file mode 100644 index 00000000000..abaf46e3623 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/identity/_assign.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.identity._assign import Assign as _IdentityAssign + + +class IdentityAssign(_IdentityAssign): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.identity = AAZResourceIdArg( + options=["--identity"], + help="Name or ID of the ManagedIdentity Resource.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.ManagedIdentity" + "/userAssignedIdentities/{}", + ), + ) + args_schema.type._registered = False + args_schema.user_assigned_identities._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.type = "UserAssigned" + args.user_assigned_identities = {args.identity.to_serialized_data(): {}} + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py new file mode 100644 index 00000000000..257bac90236 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py @@ -0,0 +1,55 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.listener._create import Create as _ListenerCreate + + +class ListenerCreate(_ListenerCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", + ) + args_schema.frontend_port._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendPorts/{}", + ) + args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslCertificates/{}", + ) + args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslProfiles/{}", + ) + args_schema.frontend_port._required = True + args_schema.protocol._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.protocol = "Tls" if has_value(args.ssl_cert) else "Tcp" + + def pre_instance_create(self): + args = self.ctx.args + if not has_value(args.frontend_ip): + instance = self.ctx.vars.instance + frontend_ip_configurations = instance.properties.frontend_ip_configurations + if len(frontend_ip_configurations) == 1: + args.frontend_ip = instance.properties.frontend_ip_configurations[0].id + elif len(frontend_ip_configurations) > 1: + err_msg = "Multiple frontend IP configurations found. Specify --frontend-ip explicitly." + raise ArgumentUsageError(err_msg) + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py new file mode 100644 index 00000000000..1cf84df05a0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.listener._update import Update as _ListenerUpdate + + +class ListenerUpdate(_ListenerUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendIPConfigurations/{}", + ) + args_schema.frontend_port._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/frontendPorts/{}", + ) + args_schema.ssl_cert._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslCertificates/{}", + ) + args_schema.ssl_profile_id._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/sslProfiles/{}", + ) + args_schema.frontend_port._nullable = False + args_schema.protocol._registered = False + return args_schema + + def post_instance_update(self, instance): + instance.properties.protocol = "Tls" if has_value(instance.properties.ssl_certificate) else "Tcp" + if not has_value(instance.properties.frontend_ip_configuration.id): + instance.properties.frontend_ip_configuration = None + if not has_value(instance.properties.ssl_certificate.id): + instance.properties.ssl_certificate = None + if not has_value(instance.properties.ssl_profile.id): + instance.properties.ssl_profile = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py new file mode 100644 index 00000000000..8dc672ff38b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py @@ -0,0 +1,120 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.mgmt.core.tools import parse_resource_id, is_valid_resource_id, resource_id +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.private_link._add import Add as _AGPrivateLinkAdd + + +class AGPrivateLinkAdd(_AGPrivateLinkAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZBoolArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip = AAZStrArg( + options=["--frontend-ip"], + help="Frontend IP that the private link will associate to.", + required=True, + ) + args_schema.subnet = AAZStrArg( + options=["--subnet"], + help="Name or ID of a subnet within the same vnet of an application gateway.", + arg_group="Properties", + required=True, + ) + args_schema.subnet_prefix = AAZStrArg( + options=["--subnet-prefix"], + help="CIDR prefix to use when creating a new subnet.", + arg_group="Properties", + ) + args_schema.ip_address = AAZStrArg( + options=["--ip-address"], + help="Static private IP address of a subnet for private link. If omitting, a dynamic one will be created.", + arg_group="Properties", + ) + args_schema.primary = AAZBoolArg( + options=["--primary"], + help="Whether the IP configuration is primary or not.", + arg_group="Properties", + ) + args_schema.ip_configurations._registered = False + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + instance = self.ctx.vars.instance + if not any(fic for fic in instance.properties.frontend_ip_configurations if fic.name == args.frontend_ip): + err_msg = "Frontend IP doesn't exist." + raise ValidationError(err_msg) + + private_link_id = resource_id( + subscription=self.ctx.subscription_id, + resource_group=args.resource_group, + namespace="Microsoft.Network", + type="applicationGateways", + name=args.gateway_name, + child_type_1="privateLinkConfigurations", + child_name_1=args.name + ) + for fic in instance.properties.frontend_ip_configurations: + if has_value(fic.properties.private_link_configuration) \ + and fic.properties.private_link_configuration.id == private_link_id: + err_msg = "Frontend IP already reference an existing private link." + raise ValidationError(err_msg) + # associate private link with frontend IP configuration + for fic in instance.properties.frontend_ip_configurations: + if fic.name == args.frontend_ip: + fic.properties.private_link_configuration = {"id": private_link_id} + + if has_value(instance.properties.private_link_configurations): + for plc in instance.properties.private_link_configurations: + if plc.name == args.name: + err_msg = "Private link name duplicates." + raise ValidationError(err_msg) + # prepare subnet for new private link + rid = instance.properties.gateway_ip_configurations[0].properties.subnet.id.to_serialized_data() + metadata = parse_resource_id(rid) + if not is_valid_resource_id(args.subnet.to_serialized_data()): + args.subnet = resource_id( + subscription=metadata["subscription"], + resource_group=metadata["resource_group"], + namespace="Microsoft.Network", + type="virtualNetworks", + name=metadata["name"], + child_type_1="subnets", + child_name_1=args.subnet + ) + + from .aaz.latest.network.vnet import Show + vnet = Show(cli_ctx=self.cli_ctx)(command_args={ + "name": metadata["name"], + "resource_group": metadata["resource_group"] + }) + for subnet in vnet["subnets"]: + if subnet["id"] == args.subnet: + break + else: + subnet_name = parse_resource_id(args.subnet.to_serialized_data())["child_name_1"] + + from azure.cli.core.commands import LongRunningOperation + poller = VNetSubnetCreate(cli_ctx=self.cli_ctx)(command_args={ + "name": subnet_name, + "vnet_name": metadata["name"], + "resource_group": metadata["resource_group"], + "address_prefix": args.subnet_prefix, + "private_link_service_network_policies": "Disabled" + }) + LongRunningOperation(self.cli_ctx)(poller) + + args.ip_configurations = [{ + "name": "PrivateLinkDefaultIPConfiguration", + "private_ip_address": args.ip_address, + "private_ip_allocation_method": "Static" if has_value(args.ip_address) else "Dynamic", + "subnet": {"id": args.subnet}, + "primary": args.primary + }] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py new file mode 100644 index 00000000000..77cba53fcf1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.private_link._remove import Remove as _AGPrivateLinkRemove + + +class AGPrivateLinkRemove(_AGPrivateLinkRemove): + def pre_instance_delete(self): + args = self.ctx.args + instance = self.ctx.vars.instance + for plc in instance.properties.private_link_configurations: + if plc.name == args.name: + to_be_removed = plc + break + else: + err_msg = "Private link doesn't exist." + raise ValidationError(err_msg) + + for fic in instance.properties.frontend_ip_configurations: + if has_value(fic.properties.private_link_configuration) \ + and fic.properties.private_link_configuration.id == to_be_removed.id: + fic.properties.private_link_configuration = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py new file mode 100644 index 00000000000..c02eff033d0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.private_link.ip_config._add import Add as _AGPrivateLinkIPConfigAdd + + +class AGPrivateLinkIPConfigAdd(_AGPrivateLinkIPConfigAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.private_ip_allocation_method._registered = False + args_schema.subnet._registered = False + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + instance = self.ctx.vars.instance + for plc in instance.properties.private_link_configurations: + if plc.name == args.private_link: + target_private_link = plc + break + else: + err_msg = "Private link doesn't exist." + raise ValidationError(err_msg) + + args.private_ip_allocation_method = "Static" if has_value(args.ip_address) else "Dynamic" + subnet_id = target_private_link.properties.ip_configurations[0].properties.subnet.id + args.subnet.id = subnet_id diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_create.py new file mode 100644 index 00000000000..ab66bab49aa --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.redirect_config._create import Create as _RedirectConfigCreate + + +class RedirectConfigCreate(_RedirectConfigCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.target_listener._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/httpListeners/{}", + ) + args_schema.type._required = True + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py new file mode 100644 index 00000000000..824a6178c79 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.redirect_config._update import Update as _RedirectConfigUpdate + + +class RedirectConfigUpdate(_RedirectConfigUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.target_listener._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/httpListeners/{}", + ) + return args_schema + + def post_instance_update(self, instance): + if not has_value(instance.properties.target_listener.id): + instance.properties.target_listener = None + if has_value(instance.properties.target_listener): + instance.properties.target_url = None + if has_value(instance.properties.target_url): + instance.properties.target_listener = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py new file mode 100644 index 00000000000..871fb9825d4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rewrite_rule._create import Create as _AGRewriteRuleCreate + + +class AGRewriteRuleCreate(_AGRewriteRuleCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZDictArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.request_headers = AAZDictArg( + options=["--request-headers"], + help="Space-separated list of HEADER=VALUE pairs. " + "Values from: `az network application-gateway rewrite-rule list-request-headers`.", + ) + args_schema.request_headers.Element = AAZStrArg() + args_schema.response_headers = AAZDictArg( + options=["--response-headers"], + help="Space-separated list of HEADER=VALUE pairs. " + "Values from: `az network application-gateway rewrite-rule list-response-headers`.", + ) + args_schema.response_headers.Element = AAZStrArg() + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.request_headers): + configurations = [] + for k, v in args.request_headers.items(): + configurations.append({"header_name": k, "header_value": v}) + args.request_header_configurations = configurations + if has_value(args.response_headers): + configurations = [] + for k, v in args.response_headers.items(): + configurations.append({"header_name": k, "header_value": v}) + args.response_header_configurations = configurations diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py new file mode 100644 index 00000000000..87e727c42f2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py @@ -0,0 +1,54 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rewrite_rule._update import Update as _AGRewriteRuleUpdate + + +class AGRewriteRuleUpdate(_AGRewriteRuleUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZDictArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.request_headers = AAZDictArg( + options=["--request-headers"], + help="Space-separated list of HEADER=VALUE pairs. " + "Values from: `az network application-gateway rewrite-rule list-request-headers`.", + nullable=True, + ) + args_schema.request_headers.Element = AAZStrArg( + nullable=True, + ) + args_schema.response_headers = AAZDictArg( + options=["--response-headers"], + help="Space-separated list of HEADER=VALUE pairs. " + "Values from: `az network application-gateway rewrite-rule list-response-headers`.", + nullable=True, + ) + args_schema.response_headers.Element = AAZStrArg( + nullable=True, + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.request_headers): + if args.request_headers.to_serialized_data() is None: + args.request_header_configurations = None + else: + configurations = [] + for k, v in args.request_headers.items(): + configurations.append({"header_name": k, "header_value": v}) + args.request_header_configurations = configurations + if has_value(args.response_headers): + if args.response_headers.to_serialized_data() is None: + args.response_header_configurations = None + else: + configurations = [] + for k, v in args.response_headers.items(): + configurations.append({"header_name": k, "header_value": v}) + args.response_header_configurations = configurations diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py new file mode 100644 index 00000000000..bf3a2839a7e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.root_cert._create import Create as _RootCertCreate + + +class RootCertCreate(_RootCertCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.cert_file = AAZFileArg( + options=["--cert-file"], + help="Path to the certificate file.", + fmt=AAZFileArgBase64EncodeFormat(), + ) + args_schema.data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.cert_file): + args.data = args.cert_file + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py new file mode 100644 index 00000000000..30d1a5e81e5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.root_cert._update import Update as _RootCertUpdate + + +class RootCertUpdate(_RootCertUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.cert_file = AAZFileArg( + options=["--cert-file"], + help="Path to the certificate file.", + fmt=AAZFileArgBase64EncodeFormat(), + nullable=True, + ) + args_schema.data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.cert_file): + args.data = args.cert_file diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py new file mode 100644 index 00000000000..84debe85eb8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py @@ -0,0 +1,59 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.routing_rule._create import Create as _RoutingRuleCreate + + +class RoutingRuleCreate(_RoutingRuleCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.listener._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/listeners/{}", + ) + args_schema.settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendSettingsCollection/{}", + ) + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + instance = self.ctx.vars.instance + if not has_value(args.address_pool): + address_pools = instance.properties.backend_address_pools + if len(address_pools) == 1: + args.address_pool = instance.properties.backend_address_pools[0].id + elif len(address_pools) > 1: + err_msg = "Multiple backend address pools found. Specify --address-pool explicitly." + raise ArgumentUsageError(err_msg) + if not has_value(args.listener): + listeners = instance.properties.listeners + if len(listeners) == 1: + args.listener = instance.properties.listeners[0].id + elif len(listeners) > 1: + err_msg = "Multiple listeners found. Specify --listener explicitly." + raise ArgumentUsageError(err_msg) + if not has_value(args.settings): + settings = instance.properties.backend_settings_collection + if len(settings) == 1: + args.settings = instance.properties.backend_settings_collection[0].id + elif len(settings) > 1: + err_msg = "Multiple backend settings found. Specify --settings explicitly." + raise ArgumentUsageError(err_msg) + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py new file mode 100644 index 00000000000..ead8c7b3ea8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py @@ -0,0 +1,37 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.routing_rule._update import Update as _RoutingRuleUpdate + + +class RoutingRuleUpdate(_RoutingRuleUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.listener._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/listeners/{}", + ) + args_schema.settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendSettingsCollection/{}", + ) + return args_schema + + def post_instance_update(self, instance): + if not has_value(instance.properties.backend_address_pool.id): + instance.properties.backend_address_pool = None + if not has_value(instance.properties.backend_settings.id): + instance.properties.backend_settings = None + if not has_value(instance.properties.listener.id): + instance.properties.listener = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py new file mode 100644 index 00000000000..973f5f1f8ad --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py @@ -0,0 +1,71 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rule._create import Create as _RuleCreate + + +class RuleCreate(_RuleCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.http_listener._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/httpListeners/{}", + ) + args_schema.http_settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", + ) + args_schema.redirect_config._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/redirectConfigurations/{}", + ) + args_schema.rewrite_rule_set._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", + ) + args_schema.url_path_map._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/urlPathMaps/{}", + ) + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + instance = self.ctx.vars.instance + if not has_value(args.address_pool) and not has_value(args.redirect_config): + address_pools = instance.properties.backend_address_pools + if len(address_pools) == 1: + args.address_pool = instance.properties.backend_address_pools[0].id + elif len(address_pools) > 1: + err_msg = "Multiple backend address pools found. Specify --address-pool explicitly." + raise ArgumentUsageError(err_msg) + if not has_value(args.http_settings) and not has_value(args.redirect_config): + settings = instance.properties.backend_http_settings_collection + if len(settings) == 1: + args.http_settings = instance.properties.backend_http_settings_collection[0].id + elif len(settings) > 1: + err_msg = "Multiple backend settings found. Specify --http-settings explicitly." + raise ArgumentUsageError(err_msg) + if not has_value(args.http_listener): + listeners = instance.properties.http_listeners + if len(listeners) == 1: + args.http_listener = instance.properties.http_listeners[0].id + elif len(listeners) > 1: + err_msg = "Multiple HTTP listeners found. Specify --http-listener explicitly." + raise ArgumentUsageError(err_msg) + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py new file mode 100644 index 00000000000..8e41f7e0f60 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py @@ -0,0 +1,55 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rule._update import Update as _RuleUpdate + + +class RuleUpdate(_RuleUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.http_listener._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/httpListeners/{}", + ) + args_schema.http_settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", + ) + args_schema.redirect_config._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/redirectConfigurations/{}", + ) + args_schema.rewrite_rule_set._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", + ) + args_schema.url_path_map._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/urlPathMaps/{}", + ) + return args_schema + + def post_instance_update(self, instance): + if not has_value(instance.properties.backend_address_pool.id): + instance.properties.backend_address_pool = None + if not has_value(instance.properties.backend_http_settings.id): + instance.properties.backend_http_settings = None + if not has_value(instance.properties.http_listener.id): + instance.properties.http_listener = None + if not has_value(instance.properties.redirect_configuration.id): + instance.properties.redirect_configuration = None + if not has_value(instance.properties.rewrite_rule_set.id): + instance.properties.rewrite_rule_set = None + if not has_value(instance.properties.url_path_map.id): + instance.properties.url_path_map = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_create.py new file mode 100644 index 00000000000..1791978eda7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_create.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.settings._create import Create as _SettingsCreate + + +class SettingsCreate(_SettingsCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.root_certs = AAZListArg( + options=["--root-certs"], + help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " + "`--host-name` or `--backend-pool-host-name` is required when this field is set.", + ) + args_schema.root_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", + ), + ) + args_schema.probe._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/probes/{}", + ) + args_schema.port._required = True + args_schema.trusted_root_certificates._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.trusted_root_certificates = assign_aaz_list_arg( + args.trusted_root_certificates, + args.root_certs, + element_transformer=lambda _, root_cert_id: {"id": root_cert_id} + ) + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py new file mode 100644 index 00000000000..98d875564ad --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.settings._update import Update as _SettingsUpdate + + +class SettingsUpdate(_SettingsUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.root_certs = AAZListArg( + options=["--root-certs"], + help="Space-separated list of trusted root certificates (Names and IDs) to associate with the HTTP settings. " + "`--host-name` or `--backend-pool-host-name` is required when this field is set.", + nullable=True, + ) + args_schema.root_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/trustedRootCertificates/{}", + ), + nullable=True, + ) + args_schema.probe._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/probes/{}", + ) + args_schema.trusted_root_certificates._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.trusted_root_certificates = assign_aaz_list_arg( + args.trusted_root_certificates, + args.root_certs, + element_transformer=lambda _, root_cert_id: {"id": root_cert_id} + ) + + def post_instance_update(self, instance): + if not has_value(instance.properties.probe.id): + instance.properties.probe = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py new file mode 100644 index 00000000000..17c9219000d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_cert._create import Create as _SSLCertCreate + + +class SSLCertCreate(_SSLCertCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.cert_file = AAZFileArg( + options=["--cert-file"], + help="Path to the pfx certificate file.", + fmt=AAZFileArgBase64EncodeFormat(), + ) + args_schema.data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.cert_file): + args.data = args.cert_file diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py new file mode 100644 index 00000000000..a643f08ad4b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_cert._update import Update as _SSLCertUpdate + + +class SSLCertUpdate(_SSLCertUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.cert_file = AAZFileArg( + options=["--cert-file"], + help="Path to the pfx certificate file.", + fmt=AAZFileArgBase64EncodeFormat(), + nullable=True, + ) + args_schema.data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.cert_file): + args.data = args.cert_file diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py new file mode 100644 index 00000000000..b3c664ba24d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_policy._set import Set as _SSLPolicySet + + +class SSLPolicySet(_SSLPolicySet): + def pre_operations(self): + args = self.ctx.args + if has_value(args.name): + args.policy_type = "Predefined" + elif not has_value(args.policy_type) \ + and (has_value(args.cipher_suites) or has_value(args.min_protocol_version)): + args.policy_type = "Custom" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py new file mode 100644 index 00000000000..d85ab5588db --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_profile._add import Add as _SSLProfileAdd + + +class SSLProfileAdd(_SSLProfileAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.client_auth_config = AAZBoolArg( + options=["--client-auth-configuration", "--client-auth-config"], + help="Client authentication configuration of the application gateway resource.", + ) + args_schema.trusted_client_certs = AAZListArg( + options=["--trusted-client-certificates", "--trusted-client-cert"], + help="Array of references to application gateway trusted client certificates.", + ) + args_schema.trusted_client_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/trustedClientCertificates/{}", + ), + ) + args_schema.auth_configuration._registered = False + args_schema.client_certificates._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.client_auth_config): + args.auth_configuration.verify_client_cert_issuer_dn = args.client_auth_config + args.client_certificates = assign_aaz_list_arg( + args.client_certificates, + args.trusted_client_certs, + element_transformer=lambda _, cert_id: {"id": cert_id} + ) + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py new file mode 100644 index 00000000000..72ad6833660 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py @@ -0,0 +1,51 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_profile._update import Update as _SSLProfileUpdate + + +class SSLProfileUpdate(_SSLProfileUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.client_auth_config = AAZBoolArg( + options=["--client-auth-configuration", "--client-auth-config"], + help="Client authentication configuration of the application gateway resource.", + nullable=True, + ) + args_schema.trusted_client_certs = AAZListArg( + options=["--trusted-client-certificates", "--trusted-client-cert"], + help="Array of references to application gateway trusted client certificates.", + nullable=True, + ) + args_schema.trusted_client_certs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/trustedClientCertificates/{}", + ), + nullable=True, + ) + args_schema.auth_configuration._registered = False + args_schema.client_certificates._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.client_auth_config): + args.auth_configuration.verify_client_cert_issuer_dn = args.client_auth_config + args.client_certificates = assign_aaz_list_arg( + args.client_certificates, + args.trusted_client_certs, + element_transformer=lambda _, cert_id: {"id": cert_id} + ) + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py new file mode 100644 index 00000000000..dc527ef2549 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py @@ -0,0 +1,106 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.url_path_map._create import Create as _URLPathMapCreate + + +class URLPathMapCreate(_URLPathMapCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.rule_name = AAZStrArg( + options=["--rule-name"], + arg_group="First Rule", + help="Name of the rule for a URL path map.", + default="default", + ) + args_schema.paths = AAZListArg( + options=["--paths"], + arg_group="First Rule", + help="Space-separated list of paths to associate with the rule. " + "Valid paths start and end with \"/\", e.g, \"/bar/\".", + required=True, + ) + args_schema.paths.Element = AAZStrArg() + args_schema.address_pool = AAZResourceIdArg( + options=["--address-pool"], + arg_group="First Rule", + help="Name or ID of the backend address pool to use with the created rule.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ), + ) + args_schema.http_settings = AAZResourceIdArg( + options=["--http-settings"], + arg_group="First Rule", + help="Name or ID of the HTTP settings to use with the created rule.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", + ), + ) + args_schema.redirect_config = AAZResourceIdArg( + options=["--redirect-config"], + arg_group="First Rule", + help="Name or ID of the redirect configuration to use with the created rule.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/redirectConfigurations/{}", + ), + ) + args_schema.rewrite_rule_set = AAZResourceIdArg( + options=["--rewrite-rule-set"], + arg_group="First Rule", + help="Name or ID of the rewrite rule set. If not specified, the default for the map will be used.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", + ), + ) + args_schema.waf_policy = AAZResourceIdArg( + options=["--waf-policy"], + arg_group="First Rule", + help="Name or ID of a web application firewall policy resource.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ApplicationGatewayWebApplicationFirewallPolicies/{}", + ), + ) + # add templates for resource id + args_schema.default_address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.default_http_settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", + ) + args_schema.default_redirect_config._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/redirectConfigurations/{}", + ) + args_schema.default_rewrite_rule_set._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + rules = [{ + "name": args.rule_name, + "paths": args.paths, + "backend_address_pool": {"id": args.address_pool} if has_value(args.address_pool) else None, + "backend_http_settings": {"id": args.http_settings} if has_value(args.http_settings) else None, + "redirect_configuration": {"id": args.redirect_config} if has_value(args.redirect_config) else None, + "rewrite_rule_set": {"id": args.rewrite_rule_set} if has_value(args.rewrite_rule_set) else None, + "firewall_policy": {"id": args.waf_policy} if has_value(args.waf_policy) else None, + }] + args.rules = rules diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_update.py new file mode 100644 index 00000000000..f2632d2d0df --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_update.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.url_path_map._update import Update as _URLPathMapUpdate + + +class URLPathMapUpdate(_URLPathMapUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + # apply templates for resource id + args_schema.default_address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.default_http_settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", + ) + args_schema.default_redirect_config._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/redirectConfigurations/{}", + ) + args_schema.default_rewrite_rule_set._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", + ) + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py new file mode 100644 index 00000000000..cb362a6e6e1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.url_path_map.rule._create import Create as _URLPathMapRuleCreate + + +class URLPathMapRuleCreate(_URLPathMapRuleCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.paths._required = True + # add templates for resource id + args_schema.address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ) + args_schema.http_settings._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendHttpSettingsCollection/{}", + ) + args_schema.redirect_config._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/redirectConfigurations/{}", + ) + args_schema.rewrite_rule_set._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/rewriteRuleSets/{}", + ) + args_schema.waf_policy._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ApplicationGatewayWebApplicationFirewallPolicies/{}", + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.address_pool) and has_value(args.redirect_config): + err_msg = "Cannot reference a BackendAddressPool when Redirect Configuration is specified." + raise ArgumentUsageError(err_msg) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/_create.py new file mode 100644 index 00000000000..7df260819be --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/_create.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.waf_policy._create import Create as _WAFCreate + + +class WAFCreate(_WAFCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.rule_set_type = AAZStrArg( + options=["--type"], + help="Type of the web application firewall rule set.", + default="Microsoft_DefaultRuleSet", + enum={ + "Microsoft_BotManagerRuleSet": "Microsoft_BotManagerRuleSet", + "Microsoft_DefaultRuleSet": "Microsoft_DefaultRuleSet", + "OWASP": "OWASP", + "Microsoft_HTTPDDoSRuleSet": "Microsoft_HTTPDDoSRuleSet" + }, + ) + args_schema.rule_set_version = AAZStrArg( + options=["--version"], + help="Version of the web application firewall rule set type. " + "0.1, 1.0, and 1.1 are used for Microsoft_BotManagerRuleSet", + default="2.1" + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + managed_rule_set = { + "rule_set_type": args.rule_set_type, + "rule_set_version": args.rule_set_version + } + managed_rule_definition = { + "managed_rule_sets": [managed_rule_set] + } + args.managed_rules = managed_rule_definition diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py new file mode 100644 index 00000000000..6f183d47d33 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py @@ -0,0 +1,47 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.waf_policy.custom_rule.match_condition._add import Add as _WAFCustomRuleMatchConditionAdd + + +class WAFCustomRuleMatchConditionAdd(_WAFCustomRuleMatchConditionAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.match_variables = AAZListArg( + options=["--match-variables"], + help="Space-separated list of variables to use when matching. Variable values: RemoteAddr, RequestMethod, " + "QueryString, PostArgs, RequestUri, RequestHeaders, RequestBody, RequestCookies.", + required=True, + ) + args_schema.match_variables.Element = AAZStrArg() + # filter arguments + args_schema.variables._required = False + args_schema.variables._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + variables = [] + for variable in args.match_variables: + try: + name, selector = str(variable).split(".", 1) + except ValueError: + name, selector = variable, None + variables.append({ + "variable_name": name, + "selector": selector, + }) + args.variables = variables + # validate + if str(args.operator).lower() == "any" and has_value(args.values): + raise ArgumentUsageError("\"Any\" operator does not require --values.") + if str(args.operator).lower() != "any" and not has_value(args.values): + raise ArgumentUsageError("Non-any operator requires --values.") diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/_update.py new file mode 100644 index 00000000000..cce02163fa9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/policy_setting/_update.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.application_gateway.waf_policy.policy_setting._update import Update as _WAFPolicySettingUpdate + + +class WAFPolicySettingUpdate(_WAFPolicySettingUpdate): + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__cmd_group.py new file mode 100644 index 00000000000..ffb75e7a166 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__cmd_group.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "network cross-region-lb", +) +class __CMDGroup(AAZCommandGroup): + """Manage and configure cross-region load balancers. + + To learn more about Azure Load Balancer visit https://learn.microsoft.com/en-us/azure/load-balancer/tutorial-cross-region-cli. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py new file mode 100644 index 00000000000..f122454d539 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb._delete import Delete as _LBDelete + + +@register_command("network cross-region-lb delete") +class CrossRegionLoadBalancerDelete(_LBDelete): + """Delete the specified load balancer. + + :example: Delete a load balancer. + az network cross-region-lb delete -g MyResourceGroup -n MyLb + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py new file mode 100644 index 00000000000..c9d041a7802 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb._list import List as _LBList + + +@register_command("network cross-region-lb list") +class CrossRegionLoadBalancerList(_LBList): + """List load balancers. + + :example: List load balancers. + az network cross-region-lb list -g MyResourceGroup + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py new file mode 100644 index 00000000000..470c2b3739c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb._show import Show as _LBShow + + +@register_command("network cross-region-lb show") +class CrossRegionLoadBalancerShow(_LBShow): + """Get the details of a load balancer. + + :example: Get the details of a load balancer. + az network cross-region-lb show -g MyResourceGroup -n MyLb + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py new file mode 100644 index 00000000000..d02213dc4fc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb._update import Update as _LBUpdate + + +@register_command("network cross-region-lb update") +class CrossRegionLoadBalancerUpdate(_LBUpdate): + """Update a load balancer. + + This command can only be used to update the tags for a load balancer. + Name and resource group are immutable and cannot be updated. + + :example: Update the tags of a load balancer. + az network cross-region-lb update -g MyResourceGroup -n MyLB --tags CostCenter=MyTestGroup + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_wait.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_wait.py new file mode 100644 index 00000000000..38dcd02a67b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_wait.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command +from azure.cli.command_modules.network.aaz.latest.network.lb._wait import Wait as _LBWait + + +@register_command("network cross-region-lb wait") +class CrossRegionLoadBalancerWait(_LBWait): + """Place the CLI in a waiting state until a condition of the cross-region load balancer is met. + + :example: Wait for load balancer to return as created. + az network cross-region-lb wait -g MyResourceGroup -n MyLb --created + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__cmd_group.py new file mode 100644 index 00000000000..45609d96457 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__cmd_group.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "network cross-region-lb address-pool", +) +class __CMDGroup(AAZCommandGroup): + """Manage address pools of a cross-region load balancer. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py new file mode 100644 index 00000000000..b4072cbbbed --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py @@ -0,0 +1,55 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._create import Create as _LBAddressPoolCreate + + +@register_command("network cross-region-lb address-pool create") +class CrossRegionLoadBalancerAddressPoolCreate(_LBAddressPoolCreate): + """Create load balancer backend address pool. + + :example: Create an address pool. + az network cross-region-lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool + + :example: Create an address pool with several backend addresses using shorthand syntax arguments. + az network cross-region-lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses "[{name:addr1,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb1'},{name:addr2,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2'}]" + + :example: Create an address pool with several backend addresses using config file + az network cross-region-lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses config_file.json + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.admin_state = AAZStrArg( + options=["--admin-state"], + arg_group="Properties", + help="Default administrative state to backend addresses in `--backend-addresses`.", + ) + args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum + # not support name, the frontend id should belong to a regional load balance + args_schema.backend_addresses.Element.frontend_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" + ) + args_schema.backend_addresses.Element.name._required = True + args_schema.backend_addresses.Element.frontend_ip_address._required = True + + args_schema.tunnel_interfaces._registered = False + args_schema.backend_addresses.Element.ip_address._registered = False + args_schema.backend_addresses.Element.subnet._registered = False + args_schema.backend_addresses.Element.virtual_network._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.backend_addresses): + for backend_address in args.backend_addresses: + if not has_value(backend_address.admin_state) and has_value(args.admin_state): + # use the command level argument --admin-state + backend_address.admin_state = args.admin_state diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py new file mode 100644 index 00000000000..8c4817ea3b6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._delete import Delete as _LBAddressPoolDelete + + +@register_command("network cross-region-lb address-pool delete") +class CrossRegionLoadBalancerAddressPoolDelete(_LBAddressPoolDelete): + """Delete the specified load balancer backend address pool. + + :example: Delete an address pool. + az network cross-region-lb address-pool delete -g MyResourceGroup --lb-name MyLb -n MyAddressPool + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py new file mode 100644 index 00000000000..a1b9eabb2b3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._list import List as _LBAddressPoolList + + +@register_command("network cross-region-lb address-pool list") +class CrossRegionLoadBalancerAddressPoolList(_LBAddressPoolList): + """List all the load balancer backed address pools. + + :example: List address pools. + az network cross-region-lb address-pool list -g MyResourceGroup --lb-name MyLb -o table + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py new file mode 100644 index 00000000000..5b482c9ee84 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._show import Show as _LBAddressPoolShow + + +@register_command("network cross-region-lb address-pool show") +class CrossRegionLoadBalancerAddressPoolShow(_LBAddressPoolShow): + """Get load balancer backend address pool. + + :example: Get the details of an address pool. + az network cross-region-lb address-pool show -g MyResourceGroup --lb-name MyLb -n MyAddressPool + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py new file mode 100644 index 00000000000..73035c51cb1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py @@ -0,0 +1,56 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._update import Update as _LBAddressPoolUpdate + + +@register_command("network cross-region-lb address-pool update") +class CrossRegionLoadBalancerAddressPoolUpdate(_LBAddressPoolUpdate): + """Update a load balancer backend address pool. + + :example: Update all backend addresses in the address pool using shorthand syntax + az network cross-region-lb address-pool update -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses "[{name:addr1,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb1'},{name:addr2,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2'}]" + + :example: Update the frontend-ip-address of the first backend address in the address pool using shorthand syntax + az network cross-region-lb address-pool update -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses [0].frontend-ip-address=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb1 + + :example: Remove the first backend address in the address pool using shorthand syntax + az network cross-region-lb address-pool update -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses [0]=null + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.admin_state = AAZStrArg( + options=["--admin-state"], + arg_group="Properties", + help="Default administrative state to backend addresses in `--backend-addresses`.", + ) + args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum + # not support name, the frontend id should belong to a regional load balance + args_schema.backend_addresses.Element.frontend_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" + ) + args_schema.backend_addresses.Element.name._nullable = False + args_schema.backend_addresses.Element.frontend_ip_address._nullable = False + args_schema.backend_addresses.Element.admin_state._nullable = False + + args_schema.tunnel_interfaces._registered = False + args_schema.backend_addresses.Element.ip_address._registered = False + args_schema.backend_addresses.Element.subnet._registered = False + args_schema.backend_addresses.Element.virtual_network._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.backend_addresses): + for backend_address in args.backend_addresses: + if not has_value(backend_address.admin_state) and has_value(args.admin_state): + # use the command level argument --admin-state + backend_address.admin_state = args.admin_state diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__cmd_group.py new file mode 100644 index 00000000000..e4df104cd3d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__cmd_group.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "network cross-region-lb address-pool address", +) +class __CMDGroup(AAZCommandGroup): + """Manage backend addresses of the cross-region load balance backend address pool. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py new file mode 100644 index 00000000000..9511922cc99 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._add import Add as _LBAddressPoolAddressAdd + + +@register_command("network cross-region-lb address-pool address add") +class CrossRegionLoadBalancerAddressPoolAddressAdd(_LBAddressPoolAddressAdd): + """Add one backend address into the load balance backend address pool. + + :example: Add one backend address into the load balance backend address pool. + az network cross-region-lb address-pool address add -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress --frontend-ip-address /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2 + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" + ) + + args_schema.frontend_ip_address._required = True + args_schema.ip_address._registered = False + args_schema.subnet._registered = False + args_schema.virtual_network._registered = False + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py new file mode 100644 index 00000000000..46bbbe32b5f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._list import List as _LBAddressPoolAddressList + + +@register_command("network cross-region-lb address-pool address list") +class CrossRegionLoadBalancerAddressPoolAddressList(_LBAddressPoolAddressList): + """List all backend addresses of the load balance backend address pool. + + :example: List all backend addresses of the load balance backend address pool. + az network cross-region-lb address-pool address list -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py new file mode 100644 index 00000000000..3f1f6a4f4c2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._remove import Remove as _LBAddressPoolAddressRemove + + +@register_command("network cross-region-lb address-pool address remove") +class CrossRegionLoadBalancerAddressPoolAddressRemove(_LBAddressPoolAddressRemove): + """Remove one backend address from the load balance backend address pool. + :example: Remove one backend address from the load balance backend address pool. + az network cross-region-lb address-pool address remove -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py new file mode 100644 index 00000000000..087c43b6cac --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._show import Show as _LBAddressPoolAddressShow + + +@register_command("network cross-region-lb address-pool address show") +class CrossRegionLoadBalancerAddressPoolAddressShow(_LBAddressPoolAddressShow): + """Show the backend address from the load balance backend address pool. + + :example: Show the backend address from the load balance backend address pool. + az network cross-region-lb address-pool address show -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py new file mode 100644 index 00000000000..d6a50b074d8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._update import Update as _LBAddressPoolAddressUpdate + + +@register_command("network cross-region-lb address-pool address update") +class CrossRegionLoadBalancerAddressPoolAddressUpdate(_LBAddressPoolAddressUpdate): + """Update the backend address into the load balance backend address pool. + + :example: Update the frontend ip of the backend address into the load balance backend address pool. + az network cross-region-lb address-pool address update -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress --frontend-ip-address /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2 + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" + ) + + args_schema.frontend_ip_address._nullable = False + args_schema.ip_address._registered = False + args_schema.subnet._registered = False + args_schema.virtual_network._registered = False + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__cmd_group.py new file mode 100644 index 00000000000..7116c90a06f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__cmd_group.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "network cross-region-lb frontend-ip", +) +class __CMDGroup(AAZCommandGroup): + """Manage frontend IP addresses of a cross-region load balancer. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py new file mode 100644 index 00000000000..6b0be4ef043 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate + + +@register_command("network cross-region-lb frontend-ip create") +class CrossRegionLoadBalancerFrontendIPCreate(_LBFrontendIPCreate): + """Create a frontend IP address. + + :example: Create a frontend ip address for a public load balancer. + az network cross-region-lb frontend-ip create -g MyResourceGroup --lb-name MyLb -n MyFrontendIp --public-ip-address MyFrontendIp + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", + ) + args_schema.zones.Element.enum = AAZArgEnum({ + "1": "1", + "2": "2", + "3": "3", + }) + + args_schema.private_ip_address._registered = False + args_schema.private_ip_address_version._registered = False + args_schema.private_ip_allocation_method._registered = False + args_schema.subnet._registered = False + args_schema.gateway_lb._registered = False + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py new file mode 100644 index 00000000000..ddf914ac0dd --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._delete import Delete as _LBFrontendIPDelete + + +@register_command("network cross-region-lb frontend-ip delete") +class CrossRegionLoadBalancerFrontendIPDelete(_LBFrontendIPDelete): + """Delete a frontend IP address. + + :example: Delete a frontend IP address. + az network cross-region-lb frontend-ip delete -g MyResourceGroup --lb-name MyLb -n MyFrontendIp + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py new file mode 100644 index 00000000000..4927c31bd53 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._list import List as _LBFrontendIPList + + +@register_command("network cross-region-lb frontend-ip list") +class CrossRegionLoadBalancerFrontendIPList(_LBFrontendIPList): + """List frontend IP addresses. + + :example: List frontend IP addresses. + az network cross-region-lb frontend-ip list -g MyResourceGroup --lb-name MyLb + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py new file mode 100644 index 00000000000..9670bb8b14a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._show import Show as _LBFrontendIPShow + + +@register_command("network cross-region-lb frontend-ip show") +class CrossRegionLoadBalancerFrontendIPShow(_LBFrontendIPShow): + """Get the details of a frontend IP address. + + :example: Get the details of a frontend IP address. + az network cross-region-lb frontend-ip show -g MyResourceGroup --lb-name MyLb -n MyFrontendIp + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py new file mode 100644 index 00000000000..963f5249663 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._update import Update as _LBFrontendIPUpdate + + +@register_command("network cross-region-lb frontend-ip update") +class CrossRegionLoadBalancerFrontendIPUpdate(_LBFrontendIPUpdate): + """Update a frontend IP address. + + :example: Update the frontend IP address of a public load balancer. + az network cross-region-lb frontend-ip update -g MyResourceGroup --lb-name MyLb -n MyFrontendIp --public-ip-address MyFrontendIp + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", + ) + args_schema.zones.Element.enum = AAZArgEnum({ + "1": "1", + "2": "2", + "3": "3", + }) + + args_schema.private_ip_address._registered = False + args_schema.private_ip_address_version._registered = False + args_schema.private_ip_allocation_method._registered = False + args_schema.subnet._registered = False + args_schema.gateway_lb._registered = False + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__cmd_group.py new file mode 100644 index 00000000000..790eaabae0d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__cmd_group.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "network cross-region-lb rule", +) +class __CMDGroup(AAZCommandGroup): + """Manage cross-region load balancing rules. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py new file mode 100644 index 00000000000..d344528a3fe --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._create import Create as _LBRuleCreate + + +@register_command("network cross-region-lb rule create") +class CrossRegionLoadBalancerRuleCreate(_LBRuleCreate): + """Create a load balancing rule. + + :example: Create a load balancing rule that assigns a front-facing IP configuration and port to an address pool and port. + az network cross-region-lb rule create -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Tcp --frontend-ip-name MyFrontEndIp --frontend-port 80 --backend-pool-name MyAddressPool --backend-port 80 + + :example: Create a load balancing rule that assigns a front-facing IP configuration and port to an address pool and port with the floating ip feature. + az network cross-region-lb rule create -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Tcp --frontend-ip-name MyFrontEndIp --frontend-port 80 --backend-pool-name MyAddressPool --backend-port 80 --floating-ip true + + :example: Create an HA ports load balancing rule that assigns a frontend IP and port to use all available backend IPs in a pool on the same port. + az network cross-region-lb rule create -g MyResourceGroup --lb-name MyLb -n MyHAPortsRule --protocol All --frontend-port 0 --backend-port 0 --frontend-ip-name MyFrontendIp --backend-pool-name MyAddressPool + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + args_schema.probe_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" + ) + # not support multi backend pools because the loadbalance SKU is not Gateway + args_schema.backend_pool = AAZResourceIdArg( + options=["--backend-pool-name"], + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ), + arg_group="Properties", + help="ID or name of the backend address pools. If only one exists, omit to use as default." + ) + args_schema.idle_timeout_in_minutes._default = 4 + args_schema.enable_tcp_reset._default = False + args_schema.protocol._required = True + args_schema.frontend_port._required = True + args_schema.backend_port._required = True + args_schema.backend_address_pools._registered = False + args_schema.disable_outbound_snat._registered = False # it's not required for cross-region-lb + args_schema.idle_timeout_in_minutes._registered = False + args_schema.enable_tcp_reset._registered = False + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + if not has_value(args.frontend_ip_name): + instance = self.ctx.vars.instance + frontend_ip_configurations = instance.properties.frontend_ip_configurations + if len(frontend_ip_configurations) == 1: + args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id + elif len(frontend_ip_configurations) > 1: + raise ArgumentUsageError( + "Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") + if not has_value(args.backend_pool): + instance = self.ctx.vars.instance + backend_address_pools = instance.properties.backend_address_pools + if len(backend_address_pools) == 1: + args.backend_pool = instance.properties.backend_address_pools[0].id + elif len(backend_address_pools) > 1: + raise ArgumentUsageError( + "Multiple BackendAddressPools found in loadbalancer. Specify --backend-pool-name explicitly.") + if has_value(args.backend_pool): + args.backend_address_pools = [{"id": args.backend_pool.to_serialized_data()}] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py new file mode 100644 index 00000000000..be5c560253f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._delete import Delete as _LBRuleDelete + + +@register_command("network cross-region-lb rule delete") +class CrossRegionLoadBalancerRuleDelete(_LBRuleDelete): + """Delete a load balancing rule. + + :example: Delete a load balancing rule. + az network cross-region-lb rule delete -g MyResourceGroup --lb-name MyLb -n MyLbRule + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py new file mode 100644 index 00000000000..73484e09b1b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._list import List as _LBRuleList + + +@register_command("network cross-region-lb rule list") +class CrossRegionLoadBalancerRuleList(_LBRuleList): + """List load balancing rules. + + :example: List load balancing rules. + az network cross-region-lb rule list -g MyResourceGroup --lb-name MyLb -o table + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py new file mode 100644 index 00000000000..95d808aad99 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._show import Show as _LBRuleShow + + +@register_command("network cross-region-lb rule show") +class CrossRegionLoadBalancerRuleShow(_LBRuleShow): + """Get the details of a load balancing rule. + + :example: Get the details of a load balancing rule. + az network cross-region-lb rule show -g MyResourceGroup --lb-name MyLb -n MyLbRule + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py new file mode 100644 index 00000000000..c088b9e21a2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py @@ -0,0 +1,67 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._update import Update as _LBRuleUpdate + + +@register_command("network cross-region-lb rule update") +class CrossRegionLoadBalancerRuleUpdate(_LBRuleUpdate): + """Update a load balancing rule. + + :example: Update a load balancing rule to change the protocol to UDP. + az network cross-region-lb rule update -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Udp + + :example: Update a load balancing rule to support HA ports. + az network cross-region-lb rule update -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol All --frontend-port 0 --backend-port 0 + """ + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + args_schema.probe_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" + ) + # not support multi backend pools because the loadbalance SKU is not Gateway + args_schema.backend_pool = AAZResourceIdArg( + options=["--backend-pool-name"], + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ), + arg_group="Properties", + nullable=True, + help="ID or name of the backend address pools. If only one exists, omit to use as default." + ) + + args_schema.protocol._nullable = False + args_schema.frontend_port._nullable = False + args_schema.backend_port._nullable = False + args_schema.backend_address_pools._registered = False + args_schema.disable_outbound_snat._registered = False # it's not required for cross-region-lb + args_schema.idle_timeout_in_minutes._registered = False + args_schema.enable_tcp_reset._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.backend_pool): + backend_pool = args.backend_pool.to_serialized_data() + if backend_pool is None: + args.backend_address_pools = [] # remove backend pool + else: + args.backend_address_pools = [{"id": backend_pool}] + + def post_instance_update(self, instance): + if not has_value(instance.properties.frontend_ip_configuration.id): + instance.properties.frontend_ip_configuration = None + if not has_value(instance.properties.probe.id): + instance.properties.probe = None + # always remove backend_address_pool in update request, service will fill this property based on backend_address_pools property. + instance.properties.backend_address_pool = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py new file mode 100644 index 00000000000..c15a86dd4e3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.custom_ip.prefix._create import Create as _CustomIpPrefixCreate + + +class CustomIpPrefixCreate(_CustomIpPrefixCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.is_parent = AAZBoolArg( + options=["--is-parent"], + help="Denotes that resource is being created as a Parent CustomIpPrefix", + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + if args.is_parent: + args.prefix_type = "Parent" + elif has_value(args.cip_prefix_parent): + args.prefix_type = "Child" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_update.py new file mode 100644 index 00000000000..24fa68d43b5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_update.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.custom_ip.prefix._update import Update as _CustomIpPrefixUpdate + + +class CustomIpPrefixUpdate(_CustomIpPrefixUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZArgEnum + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.state.enum = AAZArgEnum({"commission": "Commissioning", "decommission": "Decommissioning", "deprovision": "Deprovisioning", "provision": "Provisioning"}) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py new file mode 100644 index 00000000000..2f5acea06bd --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.dns._list_references import ListReferences as _DNSListReferences + + +@register_command("network dns list-references") +class DNSListReferences(_DNSListReferences): + """ Returns the DNS records specified by the referencing targetResourceIds. + + :example: Returns the DNS records specified by the referencing targetResourceIds. + az network dns list-references --parameters "/subscriptions/**921/resourceGroups/MyResourceGroup/providers/Microsoft.Network/trafficManagerProfiles/MyTrafficManager" + """ + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.target_resources._registered = False + + args_schema.parameters = AAZListArg( + options=["--parameters"], + help="A space-separated list of resource IDs for which referencing dns records need to be queried.", + ) + + parameters = args_schema.parameters + parameters.Element = AAZResourceIdArg() + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.target_resources = assign_aaz_list_arg( + args.target_resources, + args.parameters, + element_transformer=lambda _, x: {"id": x}) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py new file mode 100644 index 00000000000..24601cdcf6a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py @@ -0,0 +1,111 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._update import Update as _RecordSetUpdate +from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._show import Show as _RecordSetShow +from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._list_by_type import ListByType as _RecordSetListByType +from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._delete import Delete as _RecordSetDelete +from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._create import Create as _RecordSetCreate + + +class RecordSetUpdate(_RecordSetUpdate): + AZ_NAME = None # Base class + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.target_resource._fmt = AAZResourceIdArgFormat() + + args_schema.record_type._required = False + args_schema.record_type._registered = False + + args_schema.ttl._registered = False + args_schema.a_records._registered = False + args_schema.aaaa_records._registered = False + args_schema.caa_records._registered = False + args_schema.cname_record._registered = False + args_schema.ds_records._registered = False + args_schema.mx_records._registered = False + args_schema.naptr_records._registered = False + args_schema.ns_records._registered = False + args_schema.ptr_records._registered = False + args_schema.soa_record._registered = False + args_schema.srv_records._registered = False + args_schema.tlsa_records._registered = False + args_schema.txt_records._registered = False + + args_schema.naptr_records._registered = False + return args_schema + + def post_instance_update(self, instance): + if not has_value(instance.properties.target_resource.id): + instance.properties.target_resource = None + + +class RecordSetShow(_RecordSetShow): + AZ_NAME = None # Base class + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.record_type._required = False + args_schema.record_type._registered = False + + return args_schema + + +class RecordSetList(_RecordSetListByType): + AZ_NAME = None # Base class + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.record_type._required = False + args_schema.record_type._registered = False + + return args_schema + + +class RecordSetDelete(_RecordSetDelete): + AZ_NAME = None # Base class + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.record_type._required = False + args_schema.record_type._registered = False + + return args_schema + + +class RecordSetCreate(_RecordSetCreate): + AZ_NAME = None # Base class + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.target_resource._fmt = AAZResourceIdArgFormat() + + args_schema.record_type._required = False + args_schema.record_type._registered = False + + args_schema.a_records._registered = False + args_schema.aaaa_records._registered = False + args_schema.caa_records._registered = False + args_schema.cname_record._registered = False + args_schema.ds_records._registered = False + args_schema.mx_records._registered = False + args_schema.ns_records._registered = False + args_schema.ptr_records._registered = False + args_schema.soa_record._registered = False + args_schema.srv_records._registered = False + args_schema.tlsa_records._registered = False + args_schema.txt_records._registered = False + + args_schema.naptr_records._registered = False + return args_schema + + diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py new file mode 100644 index 00000000000..83b9d667eca --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set a create") +class RecordSetACreate(RecordSetCreate): + """ Create an A record set. + + :example: Create an A record set. + az network dns record-set a create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py new file mode 100644 index 00000000000..caba5ed718e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set a delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetADelete(RecordSetDelete): + """ Delete an A record set. + + :example: Delete an A record set. + az network dns record-set a delete -g MyResourceGroup -n MyRecordSet -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py new file mode 100644 index 00000000000..48e5f21daf5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set a list") +class RecordSetAList(RecordSetList): + """ List A record sets in a zone. + + :example: List A record sets in a zone. + az network dns record-set a list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py new file mode 100644 index 00000000000..2825a70e4c3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set a show") +class RecordSetAShow(RecordSetShow): + """ Get an A record set. + + :example: Get an A record set. + az network dns record-set a show -g MyResourceGroup -n MyRecordSet -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py new file mode 100644 index 00000000000..5f042bbd6d7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set a update") +class RecordSetAUpdate(RecordSetUpdate): + """ Update an A record set. + + :example: Update an A record set. + az network dns record-set a update -g MyResourceGroup -n MyRecordSet -z www.mysite.com --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py new file mode 100644 index 00000000000..497796b650a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set aaaa create") +class RecordSetAAAACreate(RecordSetCreate): + """ Create an AAAA record set. + + :example: Create an AAAA record set. + az network dns record-set aaaa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py new file mode 100644 index 00000000000..d7fac29e69a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set aaaa delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetAAAADelete(RecordSetDelete): + """ Delete an AAAA record set. + + :example: Delete an AAAA record set. + az network dns record-set aaaa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py new file mode 100644 index 00000000000..485837ef6d1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set aaaa list") +class RecordSetAAAAList(RecordSetList): + """ List AAAA record sets in a zone. + + :example: List AAAA record sets in a zone. + az network dns record-set aaaa list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py new file mode 100644 index 00000000000..2e0439c01cb --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set aaaa show") +class RecordSetAAAAShow(RecordSetShow): + """ Get an AAAA record set. + + :example: Get an AAAA record set. + az network dns record-set aaaa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py new file mode 100644 index 00000000000..9b22e3cb869 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set aaaa update") +class RecordSetAAAAUpdate(RecordSetUpdate): + """ Update an AAAA record set. + + :example: Update an AAAA record set. + az network dns record-set aaaa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py new file mode 100644 index 00000000000..fdc5e089bea --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set caa create") +class RecordSetCAACreate(RecordSetCreate): + """ Create a CAA record set. + + :example: Create a CAA record set. + az network dns record-set caa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py new file mode 100644 index 00000000000..b2a26761703 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set caa delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetCAADelete(RecordSetDelete): + """ Delete a CAA record set. + + :example: Delete a CAA record set. + az network dns record-set caa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py new file mode 100644 index 00000000000..f912963702c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set caa list") +class RecordSetCAAList(RecordSetList): + """ List CAA record sets in a zone. + + :example: List CAA record sets in a zone. + az network dns record-set caa list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py new file mode 100644 index 00000000000..4f8c43fe2fa --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set caa show") +class RecordSetCAAShow(RecordSetShow): + """ Get a CAA record set. + + :example: Get a CAA record set. + az network dns record-set caa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py new file mode 100644 index 00000000000..629f6ce0a9c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set caa update") +class RecordSetCAAUpdate(RecordSetUpdate): + """ Update a CAA record set. + + :example: Update a CAA record set. + az network dns record-set caa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CAA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py new file mode 100644 index 00000000000..f9a05d95f59 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set cname create") +class RecordSetCNAMECreate(RecordSetCreate): + """ Create a CNAME record set. + + :example: Create a CNAME record set. + az network dns record-set cname create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py new file mode 100644 index 00000000000..3549ed89b2a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set cname delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetCNAMEDelete(RecordSetDelete): + """ Delete a CNAME record set. + + :example: Delete a CNAME record set. + az network dns record-set cname delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py new file mode 100644 index 00000000000..8c810616f8f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set cname list") +class RecordSetCNAMEList(RecordSetList): + """ List CNAME record sets in a zone. + + :example: List CNAME record sets in a zone. + az network dns record-set cname list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py new file mode 100644 index 00000000000..8aad10c8fbb --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set cname show") +class RecordSetCNAMEShow(RecordSetShow): + """ Get a CNAME record set. + + :example: Get a CNAME record set. + az network dns record-set cname show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py new file mode 100644 index 00000000000..6c07eb5970d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set cname update") +class RecordSetCNAMEUpdate(RecordSetUpdate): + """ Update a CNAME record set. + + :example: Update a CNAME record set. + az network dns record-set cname update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py new file mode 100644 index 00000000000..528593759ef --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set ds create") +class RecordSetDSCreate(RecordSetCreate): + """ Create an DS record set. + + :example: Create an DS record set. + az network dns record-set ds create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "DS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py new file mode 100644 index 00000000000..00fb3008c3a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set ds delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetDSDelete(RecordSetDelete): + """ Delete an DS record set. + + :example: Delete an DS record set. + az network dns record-set ds delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "DS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py new file mode 100644 index 00000000000..0336388b341 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set ds list") +class RecordSetDSList(RecordSetList): + """ List DS record sets in a zone. + + :example: List DS record sets in a zone. + az network dns record-set ds list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "DS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py new file mode 100644 index 00000000000..4f56ea1f6f7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set ds show") +class RecordSetDSShow(RecordSetShow): + """ Get an DS record set. + + :example: Get an DS record set. + az network dns record-set ds show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "DS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py new file mode 100644 index 00000000000..9f65a95118c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set ds update") +class RecordSetDSUpdate(RecordSetUpdate): + """ Update an DS record set. + + :example: Update an DS record set. + az network dns record-set ds update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "DS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py new file mode 100644 index 00000000000..802f031d9a6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set mx create") +class RecordSetMXCreate(RecordSetCreate): + """ Create an MX record set. + + :example: Create an MX record set. + az network dns record-set mx create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py new file mode 100644 index 00000000000..d34b51f1278 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set mx delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetMXDelete(RecordSetDelete): + """ Delete an MX record set. + + :example: Delete an MX record set. + az network dns record-set mx delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py new file mode 100644 index 00000000000..e53f6e8588b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set mx list") +class RecordSetMXList(RecordSetList): + """ List MX record sets in a zone. + + :example: List MX record sets in a zone. + az network dns record-set mx list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py new file mode 100644 index 00000000000..e3490b30264 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set mx show") +class RecordSetMXShow(RecordSetShow): + """ Get an MX record set. + + :example: Get an MX record set. + az network dns record-set mx show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py new file mode 100644 index 00000000000..24461d84fc8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set mx update") +class RecordSetMXUpdate(RecordSetUpdate): + """ Update an MX record set. + + :example: Update an MX record set. + az network dns record-set mx update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py new file mode 100644 index 00000000000..c1200e36bf8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set naptr create") +class RecordSetNAPTRCreate(RecordSetCreate): + """ Create an NAPTR record set. + + :example: Create an NAPTR record set. + az network dns record-set naptr create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NAPTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py new file mode 100644 index 00000000000..82a29436339 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set naptr delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetNAPTRDelete(RecordSetDelete): + """ Delete an NAPTR record set. + + :example: Delete an NAPTR record set. + az network dns record-set naptr delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NAPTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py new file mode 100644 index 00000000000..9b3b31d0dcc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set naptr list") +class RecordSetNAPTRList(RecordSetList): + """ List NAPTR record sets in a zone. + + :example: List NAPTR record sets in a zone. + az network dns record-set naptr list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NAPTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py new file mode 100644 index 00000000000..a00565b0130 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set naptr show") +class RecordSetNAPTRShow(RecordSetShow): + """ Get an NAPTR record set. + + :example: Get an NAPTR record set. + az network dns record-set naptr show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NAPTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py new file mode 100644 index 00000000000..26652618792 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set naptr update") +class RecordSetNAPTRUpdate(RecordSetUpdate): + """ Update an NAPTR record set. + + :example: Update an NAPTR record set. + az network dns record-set naptr update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NAPTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py new file mode 100644 index 00000000000..07316f88406 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set ns create") +class RecordSetNSCreate(RecordSetCreate): + """ Create an NS record set. + + :example: Create an NS record set. + az network dns record-set ns create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py new file mode 100644 index 00000000000..a9babac46c1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set ns delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetNSDelete(RecordSetDelete): + """ Delete an NS record set. + + :example: Delete an NS record set. + az network dns record-set ns delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py new file mode 100644 index 00000000000..62519686aa4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set ns list") +class RecordSetNSList(RecordSetList): + """ List NS record sets in a zone. + + :example: List NS record sets in a zone. + az network dns record-set ns list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py new file mode 100644 index 00000000000..e6d2a61dd53 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set ns show") +class RecordSetNSShow(RecordSetShow): + """ Get an NS record set. + + :example: Get an NS record set. + az network dns record-set ns show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py new file mode 100644 index 00000000000..81ed682f5b3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set ns update") +class RecordSetNSUpdate(RecordSetUpdate): + """ Update an NS record set. + + :example: Update an NS record set. + az network dns record-set ns update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "NS" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py new file mode 100644 index 00000000000..470b75c501b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set ptr create") +class RecordSetPTRCreate(RecordSetCreate): + """ Create a PTR record set. + + :example: Create a PTR record set. + az network dns record-set ptr create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py new file mode 100644 index 00000000000..1c42a686940 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set ptr delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetPTRDelete(RecordSetDelete): + """ Delete a PTR record set. + + :example: Delete a PTR record set. + az network dns record-set ptr delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py new file mode 100644 index 00000000000..2c043cd34d4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set ptr list") +class RecordSetPTRList(RecordSetList): + """ List PTR record sets in a zone. + + :example: List PTR record sets in a zone. + az network dns record-set ptr list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py new file mode 100644 index 00000000000..9f1b324ccbe --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set ptr show") +class RecordSetPTRShow(RecordSetShow): + """ Get a PTR record set. + + :example: Get a PTR record set. + az network dns record-set ptr show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py new file mode 100644 index 00000000000..2ace8d5af7c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set ptr update") +class RecordSetPTRUpdate(RecordSetUpdate): + """ Update a PTR record set. + + :example: Update a PTR record set. + az network dns record-set ptr update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py new file mode 100644 index 00000000000..671fd2b8339 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set soa show") +class RecordSetSOAShow(RecordSetShow): + """ Get a SOA record set. + + :example: Get a SOA record set. + az network dns record-set soa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.name._required = False + args_schema.name._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.record_type = "SOA" + args.name = "@" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py new file mode 100644 index 00000000000..0c28845540e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set srv create") +class RecordSetSRVCreate(RecordSetCreate): + """ Create an SRV record set. + + :example: Create an SRV record set. + az network dns record-set srv create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py new file mode 100644 index 00000000000..326a6f4ae28 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set srv delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetSRVDelete(RecordSetDelete): + """ Delete an SRV record set. + + :example: Delete an SRV record set. + az network dns record-set srv delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py new file mode 100644 index 00000000000..3e8316af61a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set srv list") +class RecordSetSRVList(RecordSetList): + """ List SRV record sets in a zone. + + :example: List SRV record sets in a zone. + az network dns record-set srv list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py new file mode 100644 index 00000000000..7ba9eee3b9a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set srv show") +class RecordSetSRVShow(RecordSetShow): + """ Get an SRV record set. + + :example: Get an SRV record set. + az network dns record-set srv show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py new file mode 100644 index 00000000000..6dc5bd7b298 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set srv update") +class RecordSetSRVUpdate(RecordSetUpdate): + """ Update an SRV record set. + + :example: Update an SRV record set. + az network dns record-set srv update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py new file mode 100644 index 00000000000..c1f77e078f2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set tlsa create") +class RecordSetTLSACreate(RecordSetCreate): + """ Create a TLSA record set. + + :example: Create a TLSA record set. + az network dns record-set tlsa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TLSA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py new file mode 100644 index 00000000000..16a4b2ac9df --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set tlsa delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetTLSADelete(RecordSetDelete): + """ Delete a TLSA record set. + + :example: Delete a TLSA record set. + az network dns record-set tlsa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TLSA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py new file mode 100644 index 00000000000..a0f6d8ec29a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set tlsa list") +class RecordSetTLSAList(RecordSetList): + """ List TLSA record sets in a zone. + + :example: List TLSA record sets in a zone. + az network dns record-set tlsa list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TLSA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py new file mode 100644 index 00000000000..c631e24036d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set tlsa show") +class RecordSetTLSAShow(RecordSetShow): + """ Get a TLSA record set. + + :example: Get a TLSA record set. + az network dns record-set tlsa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TLSA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py new file mode 100644 index 00000000000..2eb9529fb77 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set tlsa update") +class RecordSetTLSAUpdate(RecordSetUpdate): + """ Update a TLSA record set. + + :example: Update a TLSA record set. + az network dns record-set tlsa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TLSA" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py new file mode 100644 index 00000000000..5e8d04415b5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +@register_command("network dns record-set txt create") +class RecordSetTXTCreate(RecordSetCreate): + """ Create a TXT record set. + + :example: Create a TXT record set. + az network dns record-set txt create -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py new file mode 100644 index 00000000000..29b49f4d406 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete + + +@register_command("network dns record-set txt delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetTXTDelete(RecordSetDelete): + """ Delete a TXT record set. + + :example: Delete a TXT record set. + az network dns record-set txt delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py new file mode 100644 index 00000000000..b0de125bb96 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList + + +@register_command("network dns record-set txt list") +class RecordSetTXTList(RecordSetList): + """ List TXT record sets in a zone. + + :example: List TXT record sets in a zone. + az network dns record-set txt list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py new file mode 100644 index 00000000000..8b6827e8ece --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow + + +@register_command("network dns record-set txt show") +class RecordSetTXTShow(RecordSetShow): + """ Get a TXT record set. + + :example: Get a TXT record set. + az network dns record-set txt show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py new file mode 100644 index 00000000000..808b5e166ba --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate + + +@register_command("network dns record-set txt update") +class RecordSetTXTUpdate(RecordSetUpdate): + """ Update a TXT record set. + + :example: Update a TXT record set. + az network dns record-set txt update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py new file mode 100644 index 00000000000..e3849a64837 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route._create import Create as _ExpressRouteCreate + + +class ExpressRouteCreate(_ExpressRouteCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.bandwidth = AAZListArg( + options=["--bandwidth"], + help="Bandwidth of the circuit. Usage: INT {Mbps,Gbps}. Defaults to Mbps." + ) + args_schema.bandwidth.Element = AAZStrArg() + args_schema.bandwidth_in_mbps._registered = False + args_schema.bandwidth_in_gbps._registered = False + args_schema.sku_name._registered = False + args_schema.express_route_port._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRoutePorts/{}", + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.bandwidth): + converted_bandwidth = _validate_bandwidth(args.bandwidth) + args.sku_name = '{}_{}'.format(args.sku_tier, args.sku_family) + + if has_value(args.express_route_port): + args.provider = None + args.peering_location = None + args.bandwidth_in_gbps = converted_bandwidth / 1000.0 + else: + args.bandwidth_in_mbps = int(converted_bandwidth) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py new file mode 100644 index 00000000000..71b85e45bf1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route._update import Update as _ExpressRouteUpdate + + +class ExpressRouteUpdate(_ExpressRouteUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.bandwidth = AAZListArg( + options=["--bandwidth"], + help="Bandwidth of the circuit. Usage: INT {Mbps,Gbps}. Defaults to Mbps.", + nullable=True + ) + args_schema.bandwidth.Element = AAZStrArg(nullable=True) + args_schema.bandwidth_in_mbps._registered = False + args_schema.bandwidth_in_gbps._registered = False + args_schema.sku_name._registered = False + args_schema.express_route_port._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/expressRoutePorts/{}" + ) + + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.sku_tier) and has_value(args.sku_family): + args.sku_name = f"{args.sku_tier}_{args.sku_family}" + + if has_value(args.bandwidth): + converted_bandwidth = _validate_bandwidth(args.bandwidth) + args.bandwidth_in_gbps = converted_bandwidth / 1000 + args.bandwidth_in_mbps = int(converted_bandwidth) + + def post_instance_update(self, instance): + if not has_value(instance.properties.express_route_port.id): + instance.properties.express_route_port = None + + if has_value(instance.properties.express_route_port): + instance.properties.service_provider_properties = None + else: + instance.properties.bandwidth_in_gbps = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_create.py new file mode 100644 index 00000000000..17bb0ccaf68 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_create.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.express_route.gateway._create import Create as _ExpressRouteGatewayCreate + + +class ExpressRouteGatewayCreate(_ExpressRouteGatewayCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.virtual_hub._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_update.py new file mode 100644 index 00000000000..db15352b987 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.express_route.gateway._update import Update as _ExpressRouteGatewayUpdate + + +class ExpressRouteGatewayUpdate(_ExpressRouteGatewayUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.virtual_hub._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py new file mode 100644 index 00000000000..655bb4877b2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py @@ -0,0 +1,47 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route.gateway.connection._create import Create as _ExpressRouteConnectionCreate + + +class ExpressRouteConnectionCreate(_ExpressRouteConnectionCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.associated_route_table = AAZStrArg( + options=['--associated-route-table', '--associated'], + arg_group="Routing Configuration", + help="The resource id of route table associated with this routing configuration.", + is_preview=True) + args_schema.propagated_route_tables = AAZListArg( + options=['--propagated-route-tables', '--propagated'], + arg_group="Routing Configuration", + help="Space-separated list of resource id of propagated route tables.", + is_preview=True) + args_schema.propagated_route_tables.Element = AAZStrArg() + args_schema.circuit_name = AAZStrArg( + options=['--circuit-name'], + arg_group="Peering", + help="ExpressRoute circuit name." + ) + args_schema.peering._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{circuit_name}/peerings/{}" + ) + args_schema.associated_id._registered = False + args_schema.propagated_ids._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + + if has_value(args.associated_route_table): + args.associated_id = {"id": args.associated_route_table} + if has_value(args.propagated_route_tables): + args.propagated_ids = [{"id": propagated_route_table} for propagated_route_table in args.propagated_route_tables] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py new file mode 100644 index 00000000000..2b20930a5a3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py @@ -0,0 +1,55 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.express_route.gateway.connection._update import Update as _ExpressRouteConnectionUpdate + + +class ExpressRouteConnectionUpdate(_ExpressRouteConnectionUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.associated_route_table = AAZStrArg( + options=['--associated-route-table', '--associated'], + arg_group="Routing Configuration", + help="The resource id of route table associated with this routing configuration.", + is_preview=True, + nullable=True) + args_schema.propagated_route_tables = AAZListArg( + options=['--propagated-route-tables', '--propagated'], + arg_group="Routing Configuration", + help="Space-separated list of resource id of propagated route tables.", + is_preview=True, + nullable=True) + args_schema.propagated_route_tables.Element = AAZStrArg(nullable=True) + args_schema.circuit_name = AAZStrArg( + options=['--circuit-name'], + arg_group="Peering", + help="ExpressRoute circuit name.", + nullable=True + ) + args_schema.peering._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{circuit_name}/peerings/{}" + ) + args_schema.associated_id._registered = False + args_schema.propagated_ids._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + + if has_value(args.associated_route_table): + args.associated_id = {"id": args.associated_route_table} + + args.propagated_ids = assign_aaz_list_arg( + args.propagated_ids, + args.propagated_route_tables, + element_transformer=lambda _, propagated_route_table: {"id": propagated_route_table} + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py new file mode 100644 index 00000000000..0de5ffe15cd --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py @@ -0,0 +1,62 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route.peering._create import Create as _ExpressRoutePeeringCreate + + +class ExpressRoutePeeringCreate(_ExpressRoutePeeringCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat, AAZArgEnum + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.ip_version = AAZStrArg( + options=['--ip-version'], + arg_group="Microsoft Peering", + help="The IP version to update Microsoft Peering settings for. Allowed values: IPv4, IPv6. Default: IPv4.", + default='IPv4' + ) + args_schema.route_filter._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/routeFilters/{}", + ) + # taken from Xplat. No enums in SDK + args_schema.routing_registry_name.enum = AAZArgEnum({"ARIN": "ARIN", "APNIC": "APNIC", "AFRINIC": "AFRINIC", "LACNIC": "LACNIC", "RIPENCC": "RIPENCC", "RADB": "RADB", "ALTDB": "ALTDB", "LEVEL3": "LEVEL3"}) + args_schema.ipv6_peering_config._registered = False + args_schema.peering_name._required = False + args_schema.peering_name._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.peering_name = args.peering_type + if args.ip_version.to_serialized_data().lower() == 'ipv6': + if args.peering_type.to_serialized_data().lower() == 'microsoftpeering': + microsoft_config = {'advertised_public_prefixes': args.advertised_public_prefixes, + 'customer_asn': args.customer_asn, + 'routing_registry_name': args.routing_registry_name} + else: + microsoft_config = None + args.ipv6_peering_config = { + 'primary_peer_address_prefix': args.primary_peer_subnet, + 'secondary_peer_address_prefix': args.secondary_peer_subnet, + 'microsoft_peering_config': microsoft_config, + 'route_filter': args.route_filter + } + args.primary_peer_subnet = None + args.secondary_peer_subnet = None + args.route_filter = None + args.advertised_public_prefixes = None + args.customer_asn = None + args.routing_registry_name = None + + else: + if has_value(args.peering_type) and args.peering_type.to_serialized_data().lower() != 'microsoftpeering': + args.advertised_public_prefixes = None + args.customer_asn = None + args.routing_registry_name = None + args.legacy_mode = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py new file mode 100644 index 00000000000..120c6d761f1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py @@ -0,0 +1,57 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route.peering._update import Update as _ExpressRoutePeeringUpdate + + +class ExpressRoutePeeringUpdate(_ExpressRoutePeeringUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat, AAZArgEnum + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.ip_version = AAZStrArg( + options=['--ip-version'], + arg_group="Microsoft Peering", + help="The IP version to update Microsoft Peering settings for. Allowed values: IPv4, IPv6. Default: IPv4.", + default='IPv4' + ) + args_schema.route_filter._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/routeFilters/{}", + ) + # taken from Xplat. No enums in SDK + args_schema.routing_registry_name.enum = AAZArgEnum({"ARIN": "ARIN", "APNIC": "APNIC", "AFRINIC": "AFRINIC", "LACNIC": "LACNIC", "RIPENCC": "RIPENCC", "RADB": "RADB", "ALTDB": "ALTDB", "LEVEL3": "LEVEL3"}) + args_schema.ipv6_peering_config._registered = False + args_schema.peering_type._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if args.ip_version.to_serialized_data().lower() == 'ipv6': + microsoft_config = {} + args.ipv6_peering_config = {} + if has_value(args.primary_peer_subnet): + args.ipv6_peering_config['primary_peer_address_prefix'] = args.primary_peer_subnet + args.primary_peer_subnet = None + if has_value(args.secondary_peer_subnet): + args.ipv6_peering_config['secondary_peer_address_prefix'] = args.secondary_peer_subnet + args.secondary_peer_subnet = None + if has_value(args.advertised_public_prefixes): + microsoft_config['advertised_public_prefixes'] = args.advertised_public_prefixes + args.advertised_public_prefixes = None + if has_value(args.customer_asn): + microsoft_config['customer_asn'] = args.customer_asn + args.customer_asn = None + if has_value(args.routing_registry_name): + microsoft_config['routing_registry_name'] = args.routing_registry_name + args.routing_registry_name = None + if has_value(args.route_filter): + args.ipv6_peering_config['route_filter'] = args.route_filter + args.route_filter = None + if microsoft_config is not None: + args.ipv6_peering_config['microsoft_peering_config'] = microsoft_config diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/_create.py new file mode 100644 index 00000000000..81896786d70 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/connection/_create.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.express_route.peering.connection._create import Create as _ExpressRoutePeeringConnectionCreate + + +class ExpressRoutePeeringConnectionCreate(_ExpressRoutePeeringConnectionCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.peer_circuit._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{peering_name}", + ) + args_schema.source_circuit._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/expressRouteCircuits/{circuit_name}/peerings/{peering_name}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py new file mode 100644 index 00000000000..2645f7c3e55 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route.port._create import Create as _ExpressRoutePortCreate + + +class ExpressRoutePortCreate(_ExpressRoutePortCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.bandwidth = AAZListArg( + options=["--bandwidth"], + help="Bandwidth of the circuit. Usage: INT {Mbps,Gbps}. Defaults to Mbps." + ) + args_schema.bandwidth.Element = AAZStrArg() + args_schema.bandwidth_in_gbps._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.bandwidth): + converted_bandwidth = _validate_bandwidth(args.bandwidth, mbps=False) + args.bandwidth_in_gbps = int(converted_bandwidth) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/_assign.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/_assign.py new file mode 100644 index 00000000000..cd31370471d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/identity/_assign.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.express_route.port.identity._assign import Assign as _ExpressRoutePortIdentityAssign + + +class ExpressRoutePortIdentityAssign(_ExpressRoutePortIdentityAssign): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.identity = AAZResourceIdArg( + options=['--identity'], + arg_group="Identity", + help="Name or ID of the ManagedIdentity Resource.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}" + ) + ) + + args_schema.user_assigned_identities._registered = False + args_schema.type._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + identity = args.identity.to_serialized_data() + args.user_assigned_identities = {identity: {}} diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py new file mode 100644 index 00000000000..80c5c1cfaf7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.express_route.port.link._update import Update as _ExpressRoutePortLinkUpdate + + +class ExpressRoutePortLinkUpdate(_ExpressRoutePortLinkUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.admin_state._blank = "Enabled" + + return args_schema + + def pre_operations(self): + args = self.ctx.args + # TODO https://github.com/Azure/azure-rest-api-specs/issues/7569 + # need to remove this conversion when the issue is fixed. + if has_value(args.macsec_cipher): + macsec_cipher = args.macsec_cipher.to_serialized_data() + macsec_ciphers_tmp = {'gcm-aes-128': 'GcmAes128', 'gcm-aes-256': 'GcmAes256'} + macsec_cipher = macsec_ciphers_tmp.get(macsec_cipher, macsec_cipher) + args.macsec_cipher = macsec_cipher diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py new file mode 100644 index 00000000000..13dc7089ee4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py @@ -0,0 +1,125 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._create import Create as _LBAddressPoolCreate +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.basic._create import Create as _LBAddressPoolBasicCreate + + +@register_command("network lb address-pool create") +class LBAddressPoolCreate(_LBAddressPoolBasicCreate): + """Create load balancer backend address pool. + + :example: Create an address pool. + az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool + + :example: Create an address pool with several backend addresses using shorthand syntax arguments. + az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --vnet MyVnetResource --backend-addresses "[{name:addr1,ip-address:10.0.0.1},{name:addr2,ip-address:10.0.0.2,subnet:subnetName}]" + + :example: Create an address pool with several backend addresses using config file + az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses config_file.json + + :example: Create an address pool with one backend address using key-value arguments. + az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-address name=addr1 ip-address=10.0.0.1 subnet=/subscriptions/000/resourceGroups/MyRg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet1 + """ + + # inherient the BackendAddressPoolsCreateOrUpdate operation + class LoadBalancerBackendAddressPoolsCreateOrUpdate(_LBAddressPoolCreate.LoadBalancerBackendAddressPoolsCreateOrUpdate): + + def on_200_201(self, session): + # ignore the response data. + pass + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet = AAZResourceIdArg( + options=["--vnet"], + arg_group="Properties", + help="Name or Id of the default virtual network applied to backend addresses in `--backend-addresses`.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + ) + + args_schema.admin_state = AAZStrArg( + options=["--admin-state"], + arg_group="Properties", + help="Default administrative state to backend addresses in `--backend-addresses`.", + ) + args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum + + args_schema.backend_addresses.Element.virtual_network._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + + args_schema.backend_addresses.Element.name._required = True + args_schema.backend_addresses.Element.ip_address._required = True + args_schema.backend_addresses.Element.frontend_ip_address._registered = False + args_schema.vnet_id._registered = False + return args_schema + + def _execute_operations(self): + self.pre_operations() + self.LoadBalancersGet(ctx=self.ctx)() + self.pre_instance_create() + sku = self.ctx.vars.instance.sku.name.to_serialized_data() + if sku.lower() == "basic": + self.InstanceCreateByJson(ctx=self.ctx)() + self.post_instance_create(self.ctx.selectors.subresource.required()) + yield self.LoadBalancersCreateOrUpdate(ctx=self.ctx)() + else: + # use AddressPoolsCreateOrUpdate API to update Standarded or Geteway lb + yield self.LoadBalancerBackendAddressPoolsCreateOrUpdate(ctx=self.ctx)() + self.LoadBalancersGet(ctx=self.ctx)() + self.post_operations() + + def pre_operations(self): + from azure.cli.core.aaz import AAZUndefined + + args = self.ctx.args + if has_value(args.sync_mode) and has_value(args.vnet): + args.vnet_id = args.vnet + args.vnet = AAZUndefined + if has_value(args.backend_addresses): + for backend_address in args.backend_addresses: + if not has_value(backend_address.admin_state) and has_value(args.admin_state): + # use the command level argument --admin-state + backend_address.admin_state = args.admin_state + + virtual_network = backend_address.virtual_network.to_serialized_data() + if not virtual_network and has_value(args.vnet): + # use the command level argument --vnet + virtual_network = args.vnet.to_serialized_data() + backend_address.virtual_network = virtual_network + + subnet = backend_address.subnet.to_serialized_data() + if subnet and not is_valid_resource_id(subnet): + if not virtual_network: + raise ArgumentUsageError( + "Invalid backend address `{}`: vnet name or vnet ID is required when using subnet name only.".format( + backend_address.name) + ) + # convert subnet name to subnet id + subnet = f"{virtual_network}/subnets/{subnet}" + backend_address.subnet = subnet + + if not virtual_network and not subnet: + raise ArgumentUsageError( + "Invalid backend address `{}`: vnet or subnet is required.".format( + backend_address.name) + ) + + def pre_instance_create(self): + args = self.ctx.args + if not has_value(args.tunnel_interfaces): + instance = self.ctx.vars.instance + if has_value(instance.sku.name) and instance.sku.name.to_serialized_data().lower() == 'gateway': + # when sku is 'gateway', 'tunnelInterfaces' can't be None. Otherwise, service will respond error + args.tunnel_interfaces = [{"identifier": 900, "type": 'Internal', "protocol": 'VXLAN'}] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py new file mode 100644 index 00000000000..e2608ec637b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.basic._delete import Delete as _LBAddressPoolBasicDelete + + +@register_command("network lb address-pool delete") +class LBAddressPoolDelete(_LBAddressPoolBasicDelete): + """Delete the specified load balancer backend address pool. + + :example: Delete an address pool. + az network lb address-pool delete -g MyResourceGroup --lb-name MyLb -n MyAddressPool + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py new file mode 100644 index 00000000000..c05a4df3def --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._update import Update as _LBAddressPoolUpdate + + +class LBAddressPoolUpdate(_LBAddressPoolUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet = AAZResourceIdArg( + options=["--vnet"], + arg_group="Properties", + help="Name or Id of the default virtual network applied to backend addresses in `--backend-addresses`.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + ) + args_schema.admin_state = AAZStrArg( + options=["--admin-state"], + arg_group="Properties", + help="Default administrative state to backend addresses in `--backend-addresses`.", + ) + args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum + + args_schema.backend_addresses.Element.virtual_network._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + + args_schema.backend_addresses.Element.name._nullable = False + args_schema.backend_addresses.Element.ip_address._nullable = False + args_schema.backend_addresses.Element.frontend_ip_address._registered = False + args_schema.vnet_id._registered = False + return args_schema + + def pre_operations(self): + from azure.cli.core.aaz import AAZUndefined + + args = self.ctx.args + if has_value(args.sync_mode) and has_value(args.vnet): + args.vnet_id = args.vnet + args.vnet = AAZUndefined + if has_value(args.backend_addresses) and args.backend_addresses.to_serialized_data() is not None: + for backend_address in args.backend_addresses: + if not has_value(backend_address.admin_state) and has_value(args.admin_state): + # use the command level argument --admin-state + backend_address.admin_state = args.admin_state + if not has_value(backend_address.virtual_network) and has_value(args.vnet): + # use the command level argument --vnet + backend_address.virtual_network = args.vnet + subnet = backend_address.subnet.to_serialized_data() + if subnet and not is_valid_resource_id(subnet): + virtual_network = backend_address.virtual_network.to_serialized_data() + if not virtual_network: + raise ArgumentUsageError( + "Invalid backend address: vnet name or vnet ID is required when using subnet name only." + ) + # convert subnet name to subnet id + subnet = f"{virtual_network}/subnets/{subnet}" + backend_address.subnet = subnet + + def post_instance_update(self, instance): + if has_value(instance.properties.load_balancer_backend_addresses): + for backend_address in instance.properties.load_balancer_backend_addresses: + if not has_value(backend_address.properties.virtual_network.id): + backend_address.properties.virtual_network = None + if not has_value(backend_address.properties.subnet.id): + backend_address.properties.subnet = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py new file mode 100644 index 00000000000..e3dee11c2af --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._add import Add as _LBAddressPoolAddressAdd + + +class LBAddressPoolAddressAdd(_LBAddressPoolAddressAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.virtual_network._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + args_schema.ip_address._required = True + args_schema.frontend_ip_address._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + virtual_network = args.virtual_network.to_serialized_data() + subnet = args.subnet.to_serialized_data() + if subnet and not is_valid_resource_id(subnet): + if not virtual_network: + raise ArgumentUsageError( + "vnet name or vnet ID is required when using subnet name only." + ) + # convert subnet name to subnet id + subnet = f"{virtual_network}/subnets/{subnet}" + args.subnet = subnet + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py new file mode 100644 index 00000000000..f21db11911f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._update import Update as _LBAddressPoolAddressUpdate + + +class LBAddressPoolAddressUpdate(_LBAddressPoolAddressUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.virtual_network._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + args_schema.ip_address._nullable = False + args_schema.frontend_ip_address._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + virtual_network = args.virtual_network.to_serialized_data() + subnet = args.subnet.to_serialized_data() + if subnet and not is_valid_resource_id(subnet): + if not virtual_network: + raise ArgumentUsageError( + "vnet name or vnet ID is required when using subnet name only." + ) + # convert subnet name to subnet id + subnet = f"{virtual_network}/subnets/{subnet}" + args.subnet = subnet + + def post_instance_update(self, instance): + if not has_value(instance.properties.virtual_network.id): + instance.properties.virtual_network = None + if not has_value(instance.properties.subnet.id): + instance.properties.subnet = None + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_add.py new file mode 100644 index 00000000000..64ae120d1ba --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_add.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.tunnel_interface._add import Add as _LBAddressPoolTunnelInterfaceAdd + + +class LBAddressPoolTunnelInterfaceAdd(_LBAddressPoolTunnelInterfaceAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.identifier._required = True + args_schema.type._required = True + args_schema.protocol._required = True + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_update.py new file mode 100644 index 00000000000..a93cdb77d85 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/tunnel_interface/_update.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.tunnel_interface._update import Update as _LBAddressPoolTunnelInterfaceUpdate + + +class LBAddressPoolTunnelInterfaceUpdate(_LBAddressPoolTunnelInterfaceUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.identifier._nullable = False + args_schema.type._nullable = False + args_schema.protocol._nullable = False + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py new file mode 100644 index 00000000000..e97971095e9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py @@ -0,0 +1,60 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate + + +class LBFrontendIPCreate(_LBFrontendIPCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + arg_group="Properties", + options=['--vnet-name'], + help="The virtual network (VNet) associated with the subnet (Omit if supplying a subnet id)." + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}", + ) + args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", + ) + args_schema.gateway_lb._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" + ) + + args_schema.zones.Element.enum = AAZArgEnum({ + "1": "1", + "2": "2", + "3": "3", + }) + args_schema.private_ip_allocation_method._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.subnet) and has_value(args.public_ip_address): + raise ArgumentUsageError( + 'incorrect usage: --subnet NAME --vnet-name NAME | ' + '--subnet ID | --public-ip-address NAME_OR_ID') + + if not has_value(args.public_ip_address): + logger.warning( + "Please note that the default public IP used for LB frontend will be changed from Basic to Standard " + "in the future." + ) + + if has_value(args.private_ip_address): + args.private_ip_allocation_method = 'Static' + else: + args.private_ip_allocation_method = 'Dynamic' diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py new file mode 100644 index 00000000000..ad8c41bbf1d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py @@ -0,0 +1,61 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._update import Update as _LBFrontendIPUpdate + + +class LBFrontendIPUpdate(_LBFrontendIPUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + arg_group="Properties", + options=['--vnet-name'], + help="The virtual network (VNet) associated with the subnet (Omit if supplying a subnet id)." + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}", + ) + args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", + ) + args_schema.gateway_lb._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" + ) + + args_schema.zones.Element.enum = AAZArgEnum({ + "1": "1", + "2": "2", + "3": "3", + }) + args_schema.private_ip_allocation_method._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.private_ip_address): + # update private_ip_address + if args.private_ip_address: + args.private_ip_allocation_method = 'Static' + else: + # set private_ip_address as null value + args.private_ip_allocation_method = 'Dynamic' + + def post_instance_update(self, instance): + if not has_value(instance.properties.subnet.id): + instance.properties.subnet = None + if not has_value(instance.properties.public_ip_address.id): + instance.properties.public_ip_address = None + if not has_value(instance.properties.public_ip_prefix.id): + instance.properties.public_ip_prefix = None + if not has_value(instance.properties.gateway_load_balancer.id): + instance.properties.gateway_load_balancer = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py new file mode 100644 index 00000000000..1b302793545 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_pool._create import Create as _LBInboundNatPoolCreate + + +class LBInboundNatPoolCreate(_LBInboundNatPoolCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + if not has_value(args.frontend_ip_name): + instance = self.ctx.vars.instance + frontend_ip_configurations = instance.properties.frontend_ip_configurations + if len(frontend_ip_configurations) == 1: + args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id + elif len(frontend_ip_configurations) > 1: + raise ArgumentUsageError("Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py new file mode 100644 index 00000000000..673122cc0db --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_pool._update import Update as _LBInboundNatPoolUpdate + + +class LBInboundNatPoolUpdate(_LBInboundNatPoolUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + return args_schema + + def post_instance_update(self, instance): + if not has_value(instance.properties.frontend_ip_configuration.id): + instance.properties.frontend_ip_configuration = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py new file mode 100644 index 00000000000..67ddd1dd443 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py @@ -0,0 +1,39 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_rule._create import Create as _LBInboundNatRuleCreate + + +class LBInboundNatRuleCreate(_LBInboundNatRuleCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ) + + # required for a public load balancer + args_schema.protocol._required = True + args_schema.backend_port._required = True + return args_schema + + def pre_instance_create(self): + args = self.ctx.args + if not has_value(args.frontend_ip_name): + instance = self.ctx.vars.instance + frontend_ip_configurations = instance.properties.frontend_ip_configurations + if len(frontend_ip_configurations) == 1: + args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id + elif len(frontend_ip_configurations) > 1: + raise ArgumentUsageError("Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py new file mode 100644 index 00000000000..5f254823a34 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_rule._update import Update as _LBInboundNatRuleUpdate + + +class LBInboundNatRuleUpdate(_LBInboundNatRuleUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ) + return args_schema + + def post_instance_update(self, instance): + if not has_value(instance.properties.frontend_ip_configuration.id): + instance.properties.frontend_ip_configuration = None + if not has_value(instance.properties.backend_address_pool.id): + instance.properties.backend_address_pool = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py new file mode 100644 index 00000000000..95f6c83e2d0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.outbound_rule._create import Create as _LBOutboundRuleCreate + + +class LBOutboundRuleCreate(_LBOutboundRuleCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ) + args_schema.frontend_ip_configs = AAZListArg( + options=["--frontend-ip-configs"], + arg_group="Properties", + help="The List of frontend IP configuration IDs or names.", + ) + args_schema.frontend_ip_configs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + ) + + args_schema.protocol._required = True + args_schema.backend_address_pool._required = True + args_schema.frontend_ip_configurations._registered = False + return args_schema + + def pre_operations(self): + from azure.cli.core.aaz.utils import assign_aaz_list_arg + args = self.ctx.args + args.frontend_ip_configurations = assign_aaz_list_arg( + args.frontend_ip_configurations, + args.frontend_ip_configs, + element_transformer=lambda _, id: {"id": id} + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py new file mode 100644 index 00000000000..3e624e15d8d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.outbound_rule._update import Update as _LBOutboundRuleUpdate + + +class LBOutboundRuleUpdate(_LBOutboundRuleUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ) + args_schema.frontend_ip_configs = AAZListArg( + options=["--frontend-ip-configs"], + arg_group="Properties", + help="The List of frontend IP configuration IDs or names.", + ) + args_schema.frontend_ip_configs.Element = AAZResourceIdArg( + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + ) + + args_schema.protocol._nullable = False + args_schema.backend_address_pool._nullable = False + args_schema.frontend_ip_configurations._registered = False + return args_schema + + def pre_operations(self): + from azure.cli.core.aaz.utils import assign_aaz_list_arg + args = self.ctx.args + args.frontend_ip_configurations = assign_aaz_list_arg( + args.frontend_ip_configurations, + args.frontend_ip_configs, + element_transformer=lambda _, id: {"id": id} + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py new file mode 100644 index 00000000000..51052a5f196 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.probe._create import Create as _LBProbeCreate + + +class LBProbeCreate(_LBProbeCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.port._required = True + args_schema.protocol._required = True + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.number_of_probes): + logger.warning( + "The property \"numberOfProbes\" is not respected. Load Balancer health probes will probe up or down " + "immediately after one probe regardless of the property's configured value. To control the number of " + "successful or failed consecutive probes necessary to mark backend instances as healthy or unhealthy, " + "please leverage the property \"probeThreshold\" instead." + ) + if has_value(args.request_path) and args.request_path == "": + args.request_path = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py new file mode 100644 index 00000000000..a154c331a36 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.command_modules.network.aaz.latest.network.lb.probe._update import Update as _LBProbeUpdate + + +class LBProbeUpdate(_LBProbeUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.port._nullable = False + args_schema.protocol._nullable = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.number_of_probes): + logger.warning( + "The property \"numberOfProbes\" is not respected. Load Balancer health probes will probe up or down " + "immediately after one probe regardless of the property's configured value. To control the number of " + "successful or failed consecutive probes necessary to mark backend instances as healthy or unhealthy, " + "please leverage the property \"probeThreshold\" instead." + ) + if has_value(args.request_path) and args.request_path == "": + args.request_path = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py new file mode 100644 index 00000000000..9f7b811a5e9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py @@ -0,0 +1,80 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ArgumentUsageError +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._create import Create as _LBRuleCreate + + +class LBRuleCreate(_LBRuleCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + args_schema.probe_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" + ) + # list argument accept one element: `--backend-pool-name PoolName` + args_schema.backend_pools = AAZListArg( + options=["--backend-pools-name", "--backend-pool-name"], + arg_group="Properties", + help="List of ID or name of the backend address pools. Multiple pools are only supported by Gateway SKU load balancer. If only one exists, omit to use as default." + ) + args_schema.backend_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ) + ) + + args_schema.protocol._required = True + args_schema.frontend_port._required = True + args_schema.backend_port._required = True + args_schema.backend_address_pools._registered = False + return args_schema + + def pre_instance_create(self): + from azure.cli.core.aaz.utils import assign_aaz_list_arg + args = self.ctx.args + if not has_value(args.frontend_ip_name): + instance = self.ctx.vars.instance + frontend_ip_configurations = instance.properties.frontend_ip_configurations + if len(frontend_ip_configurations) == 1: + args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id + elif len(frontend_ip_configurations) > 1: + raise ArgumentUsageError( + "Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") + if not has_value(args.backend_pools): + instance = self.ctx.vars.instance + backend_address_pools = instance.properties.backend_address_pools + if len(backend_address_pools) == 1: + args.backend_pools = [instance.properties.backend_address_pools[0].id] + elif len(backend_address_pools) > 1: + raise ArgumentUsageError( + "Multiple BackendAddressPools found in loadbalancer. Specify --backend-pool-name explicitly.") + args.backend_address_pools = assign_aaz_list_arg( + args.backend_address_pools, args.backend_pools, + element_transformer=lambda _, id: {"id": id} + ) + + def post_instance_create(self, instance): + args = self.ctx.args + if has_value(args.frontend_ip_name): + curr_id = args.frontend_ip_name.to_serialized_data() + curr_name = parse_resource_id(curr_id)["resource_name"] if is_valid_resource_id(curr_id) else curr_id + + parent = self.ctx.vars.instance + frontend_ip_configurations = parent.properties.frontend_ip_configurations + for fip in frontend_ip_configurations: + if fip.name == curr_name: + if has_value(fip.properties.gateway_load_balancer): + rid = fip.properties.gateway_load_balancer.id.to_serialized_data() + self.ctx.update_aux_subscriptions(parse_resource_id(rid)["subscription"]) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py new file mode 100644 index 00000000000..67f3b9803e7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py @@ -0,0 +1,72 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.command_modules.network.aaz.latest.network.lb.rule._update import Update as _LBRuleUpdate + + +class LBRuleUpdate(_LBRuleUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" + ) + args_schema.probe_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" + ) + + args_schema.backend_pools = AAZListArg( + options=["--backend-pools-name", "--backend-pool-name"], + nullable=True, + arg_group="Properties", + help="List of ID or name of the backend address pools. Multiple pools are only supported by Gateway SKU load balancer." + ) + + args_schema.backend_pools.Element = AAZResourceIdArg( + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" + ) + ) + + args_schema.protocol._nullable = False + args_schema.frontend_port._nullable = False + args_schema.backend_port._nullable = False + args_schema.backend_address_pools._registered = False + return args_schema + + def pre_operations(self): + from azure.cli.core.aaz.utils import assign_aaz_list_arg + args = self.ctx.args + args.backend_address_pools = assign_aaz_list_arg( + args.backend_address_pools, args.backend_pools, + element_transformer=lambda _, id: {"id": id} + ) + + def post_instance_update(self, instance): + if not has_value(instance.properties.frontend_ip_configuration.id): + instance.properties.frontend_ip_configuration = None + if not has_value(instance.properties.probe.id): + instance.properties.probe = None + # always remove backend_address_pool in update request, service will fill this property based on backend_address_pools property. + instance.properties.backend_address_pool = None + + args = self.ctx.args + if has_value(args.frontend_ip_name): + curr_id = args.frontend_ip_name.to_serialized_data() + curr_name = parse_resource_id(curr_id)["resource_name"] if is_valid_resource_id(curr_id) else curr_id + + parent = self.ctx.vars.instance + frontend_ip_configurations = parent.properties.frontend_ip_configurations + for fip in frontend_ip_configurations: + if fip.name == curr_name: + if has_value(fip.properties.gateway_load_balancer): + rid = fip.properties.gateway_load_balancer.id.to_serialized_data() + self.ctx.update_aux_subscriptions(parse_resource_id(rid)["subscription"]) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/_list.py new file mode 100644 index 00000000000..40dfcd80432 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/local_gateway/_list.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.local_gateway._list import List as _LocalGatewayList +from azure.cli.command_modules.network._format import transform_local_gateway_table_output + + +class LocalGatewayList(_LocalGatewayList): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_local_gateway_table_output diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_create.py new file mode 100644 index 00000000000..07cc2e1a1d7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_create.py @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.nat.gateway._create import Create as _GatewayCreate + + +class GatewayCreate(_GatewayCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_addresses = AAZListArg( + options=["--public-ip-addresses"], + help="Space-separated list of public IP addresses (Names or IDs).", + ) + args_schema.public_ip_addresses.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/publicIPAddresses/{}", + ), + ) + args_schema.public_ip_prefixes = AAZListArg( + options=["--public-ip-prefixes"], + help="Space-separated list of public IP prefixes (Names or IDs).", + ) + args_schema.public_ip_prefixes.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/publicIPPrefixes/{}", + ), + ) + args_schema.pip_addresses._registered = False + args_schema.pip_prefixes._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.pip_addresses = assign_aaz_list_arg( + args.pip_addresses, + args.public_ip_addresses, + element_transformer=lambda _, address_id: {"id": address_id} + ) + args.pip_prefixes = assign_aaz_list_arg( + args.pip_prefixes, + args.public_ip_prefixes, + element_transformer=lambda _, prefix_id: {"id": prefix_id} + ) + args.sku.name = "Standard" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/nat.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_update.py similarity index 53% rename from src/azure-cli/azure/cli/command_modules/network/operations/nat.py rename to src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_update.py index 7727087942c..277a4445364 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/nat.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nat/gateway/_update.py @@ -3,56 +3,10 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -# pylint: disable=protected-access +# pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.aaz.utils import assign_aaz_list_arg - -from ..aaz.latest.network.nat.gateway._create import Create as _GatewayCreate -from ..aaz.latest.network.nat.gateway._update import Update as _GatewayUpdate - - -class GatewayCreate(_GatewayCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_addresses = AAZListArg( - options=["--public-ip-addresses"], - help="Space-separated list of public IP addresses (Names or IDs).", - ) - args_schema.public_ip_addresses.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/publicIPAddresses/{}", - ), - ) - args_schema.public_ip_prefixes = AAZListArg( - options=["--public-ip-prefixes"], - help="Space-separated list of public IP prefixes (Names or IDs).", - ) - args_schema.public_ip_prefixes.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/publicIPPrefixes/{}", - ), - ) - args_schema.pip_addresses._registered = False - args_schema.pip_prefixes._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.pip_addresses = assign_aaz_list_arg( - args.pip_addresses, - args.public_ip_addresses, - element_transformer=lambda _, address_id: {"id": address_id} - ) - args.pip_prefixes = assign_aaz_list_arg( - args.pip_prefixes, - args.public_ip_prefixes, - element_transformer=lambda _, prefix_id: {"id": prefix_id} - ) - args.sku.name = "Standard" +from azure.cli.command_modules.network.aaz.latest.network.nat.gateway._update import Update as _GatewayUpdate class GatewayUpdate(_GatewayUpdate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py new file mode 100644 index 00000000000..8c2b0567526 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py @@ -0,0 +1,152 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.nic._create import Create as _NICCreate + + +class NICCreate(_NICCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + options=["--vnet-name"], + arg_group="IP Configuration", + help="Name of the virtual network.", + ) + args_schema.subnet = AAZResourceIdArg( + options=["--subnet"], + arg_group="IP Configuration", + help="Name or ID of an existing subnet. If name specified, please also specify `--vnet-name`; " + "If you want to use an existing subnet in other resource group, " + "please provide the ID instead of the name of the subnet.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/virtualNetworks/{vnet_name}/subnets/{}", + ), + ) + args_schema.application_security_groups = AAZListArg( + options=["--application-security-groups", "--asgs"], + arg_group="IP Configuration", + help="Space-separated list of application security groups.", + ) + args_schema.application_security_groups.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + ) + args_schema.private_ip_address = AAZStrArg( + options=["--private-ip-address"], + arg_group="IP Configuration", + help="Static private IP address to use.", + ) + args_schema.private_ip_address_version = AAZStrArg( + options=["--private-ip-address-version"], + arg_group="IP Configuration", + help="Version of private IP address to use.", + enum=["IPv4", "IPv6"], + default="IPv4", + ) + args_schema.public_ip_address = AAZResourceIdArg( + options=["--public-ip-address"], + arg_group="IP Configuration", + help="Name or ID of an existing public IP address.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" + "publicIPAddresses/{}" + ), + ) + args_schema.gateway_name = AAZStrArg( + options=["--gateway-name"], + arg_group="Application Gateway", + help="Name of the application gateway." + ) + args_schema.app_gateway_address_pools = AAZListArg( + options=["--app-gateway-address-pools", "--ag-address-pools"], + arg_group="Application Gateway", + help="Space-separated list of names or IDs of application gateway backend address pools to " + "associate with the NIC. If names are used, `--gateway-name` must be specified.", + ) + args_schema.app_gateway_address_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ), + ) + args_schema.lb_name = AAZStrArg( + options=["--lb-name"], + arg_group="Load Balancer", + help="Name of the load balancer", + ) + args_schema.lb_address_pools = AAZListArg( + options=["--lb-address-pools"], + arg_group="Load Balancer", + help="Space-separated list of names or IDs of load balancer address pools to associate with the NIC. " + "If names are used, `--lb-name` must be specified.", + ) + args_schema.lb_address_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/backendAddressPools/{}", + ), + ) + args_schema.lb_inbound_nat_rules = AAZListArg( + options=["--lb-inbound-nat-rules"], + arg_group="Load Balancer", + help="Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. " + "If names are used, `--lb-name` must be specified.", + ) + args_schema.lb_inbound_nat_rules.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/inboundNatRules/{}", + ), + ) + args_schema.edge_zone = AAZStrArg( + options=["--edge-zone"], + help="Name of edge zone." + ) + args_schema.network_security_group = AAZResourceIdArg( + options=["--network-security-group"], + help="Name or ID of an existing network security group", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/networkSecurityGroups/{}", + ), + ) + args_schema.extended_location._registered = False + args_schema.ip_configurations._registered = False + args_schema.nsg._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.network_security_group): + args.nsg.id = args.network_security_group + if has_value(args.edge_zone): + args.extended_location.name = args.edge_zone + args.extended_location.type = "EdgeZone" + ip_configuration = { + "name": "ipconfig1", + "private_ip_address": args.private_ip_address, + "private_ip_address_version": args.private_ip_address_version, # when address doesn't exist, version should be ipv4 (default) + "private_ip_allocation_method": "Static" if has_value(args.private_ip_address) else "Dynamic", + "subnet": {"id": args.subnet} if has_value(args.subnet) else None, + "public_ip_address": {"id": args.public_ip_address} if has_value(args.public_ip_address) else None, + "application_security_groups": [{"id": x} for x in args.application_security_groups] if has_value(args.application_security_groups) else None, + "application_gateway_backend_address_pools": [{"id": x} for x in args.app_gateway_address_pools] if has_value(args.app_gateway_address_pools) else None, + "load_balancer_backend_address_pools": [{"id": x} for x in args.lb_address_pools] if has_value(args.lb_address_pools) else None, + "load_balancer_inbound_nat_rules": [{"id": x} for x in args.lb_inbound_nat_rules] if has_value(args.lb_inbound_nat_rules) else None, + } + args.ip_configurations = [ip_configuration] + + def _output(self, *args, **kwargs): + result = super()._output(*args, **kwargs) + return {"NewNIC": result} diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_list_effective_nsg.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_list_effective_nsg.py new file mode 100644 index 00000000000..efce30d9cd4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_list_effective_nsg.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.nic._list_effective_nsg import ListEffectiveNsg as _ListEffectiveNsg +from azure.cli.command_modules.network._format import transform_effective_nsg + + +class NICListEffectiveNsg(_ListEffectiveNsg): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_effective_nsg diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_show_effective_route_table.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_show_effective_route_table.py new file mode 100644 index 00000000000..57b53b85d26 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_show_effective_route_table.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.nic._show_effective_route_table import ShowEffectiveRouteTable as _ShowEffectiveRouteTable +from azure.cli.command_modules.network._format import transform_effective_route_table + + +class NICShowEffectiveRouteTable(_ShowEffectiveRouteTable): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_effective_route_table diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py new file mode 100644 index 00000000000..71c5230c73e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py @@ -0,0 +1,38 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.nic._update import Update as _NICUpdate + + +class NICUpdate(_NICUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_security_group = AAZResourceIdArg( + options=["--network-security-group"], + help="Name or ID of an existing network security group", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/networkSecurityGroups/{}", + ), + nullable=True, + ) + args_schema.nsg._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.network_security_group): + args.nsg.id = args.network_security_group + if has_value(args.internal_dns_name) and args.internal_dns_name == "": + args.internal_dns_name = None + + def post_instance_update(self, instance): + if not has_value(instance.properties.network_security_group.id): + instance.properties.network_security_group = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py new file mode 100644 index 00000000000..64b73daf867 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py @@ -0,0 +1,133 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.nic.ip_config._create import Create as _NICIPConfigCreate + + +class NICIPConfigCreate(_NICIPConfigCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + options=["--vnet-name"], + arg_group="IP Configuration", + help="Name of the virtual network.", + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/virtualNetworks/{vnet_name}/subnets/{}", + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" + "publicIPAddresses/{}" + ) + args_schema.application_security_groups = AAZListArg( + options=["--application-security-groups", "--asgs"], + arg_group="IP Configuration", + help="Space-separated list of application security groups.", + ) + args_schema.application_security_groups.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + ) + args_schema.gateway_name = AAZStrArg( + options=["--gateway-name"], + arg_group="Application Gateway", + help="Name of the application gateway." + ) + args_schema.app_gateway_address_pools = AAZListArg( + options=["--app-gateway-address-pools", "--ag-address-pools"], + arg_group="Application Gateway", + help="Space-separated list of names or IDs of application gateway backend address pools to " + "associate with the NIC. If names are used, `--gateway-name` must be specified.", + ) + args_schema.app_gateway_address_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ), + ) + args_schema.lb_name = AAZStrArg( + options=["--lb-name"], + arg_group="Load Balancer", + help="Name of the load balancer", + ) + args_schema.lb_address_pools = AAZListArg( + options=["--lb-address-pools"], + arg_group="Load Balancer", + help="Space-separated list of names or IDs of load balancer address pools to associate with the NIC. " + "If names are used, `--lb-name` must be specified.", + ) + args_schema.lb_address_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/backendAddressPools/{}", + ), + ) + args_schema.lb_inbound_nat_rules = AAZListArg( + options=["--lb-inbound-nat-rules"], + arg_group="Load Balancer", + help="Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. " + "If names are used, `--lb-name` must be specified.", + ) + args_schema.lb_inbound_nat_rules.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/inboundNatRules/{}", + ), + ) + args_schema.application_gateway_backend_address_pools._registered = False + args_schema.load_balancer_backend_address_pools._registered = False + args_schema.load_balancer_inbound_nat_rules._registered = False + args_schema.private_ip_allocation_method._registered = False + args_schema.asgs_obj._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.private_ip_allocation_method = "Static" if has_value(args.private_ip_address) else "Dynamic" + if has_value(args.private_ip_address_prefix_length) and has_value(args.make_primary) and \ + args.make_primary.to_serialized_data() is True: + raise ArgumentUsageError( + 'usage error: When `--private-ip-address-prefix-length` is specified, `--make-primary` must be false') + + args.asgs_obj = assign_aaz_list_arg( + args.asgs_obj, + args.application_security_groups, + element_transformer=lambda _, asg_id: {"id": asg_id} + ) + args.application_gateway_backend_address_pools = assign_aaz_list_arg( + args.application_gateway_backend_address_pools, + args.app_gateway_address_pools, + element_transformer=lambda _, pool_id: {"id": pool_id} + ) + args.load_balancer_backend_address_pools = assign_aaz_list_arg( + args.load_balancer_backend_address_pools, + args.lb_address_pools, + element_transformer=lambda _, pool_id: {"id": pool_id} + ) + args.load_balancer_inbound_nat_rules = assign_aaz_list_arg( + args.load_balancer_inbound_nat_rules, + args.lb_inbound_nat_rules, + element_transformer=lambda _, rule_id: {"id": rule_id} + ) + + def pre_instance_create(self): + args = self.ctx.args + instance = self.ctx.vars.instance + if args.private_ip_address_version.to_serialized_data().lower() == "ipv4" and not has_value(args.subnet): + primary = next(x for x in instance.properties.ip_configurations if x.properties.primary) + args.subnet = primary.properties.subnet.id + if args.make_primary.to_serialized_data(): + for config in instance.properties.ip_configurations: + config.properties.primary = False diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py new file mode 100644 index 00000000000..bd83666ec42 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py @@ -0,0 +1,164 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.nic.ip_config._update import Update as _NICIPConfigUpdate + + +class NICIPConfigUpdate(_NICIPConfigUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg( + options=["--vnet-name"], + arg_group="IP Configuration", + help="Name of the virtual network.", + nullable=True, + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/virtualNetworks/{vnet_name}/subnets/{}", + ) + args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" + "publicIPAddresses/{}" + ) + args_schema.gateway_lb._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/" + "loadBalancers/{}/frontendIPConfigurations/{}", + ) + args_schema.application_security_groups = AAZListArg( + options=["--application-security-groups", "--asgs"], + arg_group="IP Configuration", + help="Space-separated list of application security groups.", + nullable=True, + ) + args_schema.application_security_groups.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + nullable=True, + ) + args_schema.gateway_name = AAZStrArg( + options=["--gateway-name"], + arg_group="Application Gateway", + help="Name of the application gateway.", + nullable=True, + ) + args_schema.app_gateway_address_pools = AAZListArg( + options=["--app-gateway-address-pools", "--ag-address-pools"], + arg_group="Application Gateway", + help="Space-separated list of names or IDs of application gateway backend address pools to " + "associate with the NIC. If names are used, `--gateway-name` must be specified.", + nullable=True, + ) + args_schema.app_gateway_address_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationGateways/{gateway_name}/backendAddressPools/{}", + ), + nullable=True, + ) + args_schema.lb_name = AAZStrArg( + options=["--lb-name"], + arg_group="Load Balancer", + help="Name of the load balancer", + nullable=True, + ) + args_schema.lb_address_pools = AAZListArg( + options=["--lb-address-pools"], + arg_group="Load Balancer", + help="Space-separated list of names or IDs of load balancer address pools to associate with the NIC. " + "If names are used, `--lb-name` must be specified.", + nullable=True, + ) + args_schema.lb_address_pools.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/backendAddressPools/{}", + ), + nullable=True, + ) + args_schema.lb_inbound_nat_rules = AAZListArg( + options=["--lb-inbound-nat-rules"], + arg_group="Load Balancer", + help="Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. " + "If names are used, `--lb-name` must be specified.", + nullable=True, + ) + args_schema.lb_inbound_nat_rules.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/inboundNatRules/{}", + ), + nullable=True, + ) + args_schema.application_gateway_backend_address_pools._registered = False + args_schema.load_balancer_backend_address_pools._registered = False + args_schema.load_balancer_inbound_nat_rules._registered = False + args_schema.private_ip_allocation_method._registered = False + args_schema.asgs_obj._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.private_ip_address): + if args.private_ip_address is None or args.private_ip_address == "": + # switch private IP address allocation to dynamic if empty string is used + args.private_ip_address = None + args.private_ip_allocation_method = "Dynamic" + args.private_ip_address_version = "IPv4" + else: + # if specific address provided, allocation is static + args.private_ip_allocation_method = "Static" + + if has_value(args.private_ip_address_prefix_length) and has_value(args.make_primary) and \ + args.make_primary.to_serialized_data() is True: + raise ArgumentUsageError( + 'usage error: When `--private-ip-address-prefix-length` is specified, `--make-primary` must be false') + + def pre_instance_update(self, instance): + args = self.ctx.args + instance = self.ctx.vars.instance + args.asgs_obj = assign_aaz_list_arg( + args.asgs_obj, + args.application_security_groups, + element_transformer=lambda _, asg_id: {"id": asg_id} + ) + args.application_gateway_backend_address_pools = assign_aaz_list_arg( + args.application_gateway_backend_address_pools, + args.app_gateway_address_pools, + element_transformer=lambda _, pool_id: {"id": pool_id} + ) + args.load_balancer_backend_address_pools = assign_aaz_list_arg( + args.load_balancer_backend_address_pools, + args.lb_address_pools, + element_transformer=lambda _, pool_id: {"id": pool_id} + ) + args.load_balancer_inbound_nat_rules = assign_aaz_list_arg( + args.load_balancer_inbound_nat_rules, + args.lb_inbound_nat_rules, + element_transformer=lambda _, rule_id: {"id": rule_id} + ) + # all ip configurations must belong to the same asgs + is_primary = args.make_primary.to_serialized_data() + for config in instance.properties.ip_configurations: + if is_primary: + config.properties.primary = False + config.properties.application_security_groups = args.asgs_obj + + def post_instance_update(self, instance): + if not has_value(instance.properties.subnet.id): + instance.properties.subnet = None + if not has_value(instance.properties.public_ip_address.id): + instance.properties.public_ip_address = None + if not has_value(instance.properties.gateway_load_balancer.id): + instance.properties.gateway_load_balancer = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_add.py new file mode 100644 index 00000000000..69534c55725 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_add.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.nic.ip_config.inbound_nat_rule._add import Add as _NICIPConfigNATAdd + + +class NICIPConfigNATAdd(_NICIPConfigNATAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.lb_name = AAZStrArg( + options=["--lb-name"], + help="Name of the load balancer", + ) + args_schema.inbound_nat_rule._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/inboundNatRules/{}", + ) + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result["ipConfigurations"][0] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_remove.py new file mode 100644 index 00000000000..6cc445241d1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/inbound_nat_rule/_remove.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.nic.ip_config.inbound_nat_rule._remove import Remove as _NICIPConfigNATRemove + + +class NICIPConfigNATRemove(_NICIPConfigNATRemove): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.lb_name = AAZStrArg( + options=["--lb-name"], + help="Name of the load balancer", + ) + args_schema.inbound_nat_rule._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/loadBalancers/{lb_name}/inboundNatRules/{}", + ) + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/_create.py new file mode 100644 index 00000000000..c0c7ff7a552 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/_create.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.nsg._create import Create as _NSGCreate + + +class NSGCreate(_NSGCreate): + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return {"NewNSG": result} diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py new file mode 100644 index 00000000000..7253425540a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py @@ -0,0 +1,65 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.nsg.rule._create import Create as _NSGRuleCreate + + +class NSGRuleCreate(_NSGRuleCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.priority._required = True + args_schema.destination_asgs = AAZListArg( + options=["--destination-asgs"], + arg_group="Destination", + help="Space-separated list of application security group names or IDs. Limited by backend server, " + "temporarily this argument only supports one application security group name or ID.", + ) + args_schema.destination_asgs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + ) + args_schema.source_asgs = AAZListArg( + options=["--source-asgs"], + arg_group="Source", + help="Space-separated list of application security group names or IDs. Limited by backend server, " + "temporarily this argument only supports one application security group name or ID.", + ) + args_schema.source_asgs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + ) + # filter arguments + args_schema.destination_address_prefix._registered = False + args_schema.destination_application_security_groups._registered = False + args_schema.destination_port_range._registered = False + args_schema.source_address_prefix._registered = False + args_schema.source_application_security_groups._registered = False + args_schema.source_port_range._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + _handle_plural_or_singular(args, "destination_address_prefixes", "destination_address_prefix") + _handle_plural_or_singular(args, "destination_port_ranges", "destination_port_range") + _handle_plural_or_singular(args, "source_address_prefixes", "source_address_prefix") + _handle_plural_or_singular(args, "source_port_ranges", "source_port_range") + # handle application security groups + if has_value(args.destination_asgs): + args.destination_application_security_groups = [{"id": asg_id} for asg_id in args.destination_asgs] + if has_value(args.destination_address_prefix): + args.destination_address_prefix = None + if has_value(args.source_asgs): + args.source_application_security_groups = [{"id": asg_id} for asg_id in args.source_asgs] + if has_value(args.source_address_prefix): + args.source_address_prefix = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_show.py new file mode 100644 index 00000000000..4ed05e72d33 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_show.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.nsg.rule._show import Show as _NSGRuleShow +from azure.cli.command_modules.network._format import transform_nsg_rule_table_output + + +class NSGRuleShow(_NSGRuleShow): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_nsg_rule_table_output diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_update.py new file mode 100644 index 00000000000..b24013df289 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_update.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.nsg.rule._update import Update as _NSGRuleUpdate + + +class NSGRuleUpdate(_NSGRuleUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.destination_asgs = AAZListArg( + options=["--destination-asgs"], + arg_group="Destination", + help="Space-separated list of application security group names or IDs. Limited by backend server, " + "temporarily this argument only supports one application security group name or ID.", + nullable=True, + ) + args_schema.destination_asgs.Element = AAZResourceIdArg( + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + ) + args_schema.source_asgs = AAZListArg( + options=["--source-asgs"], + arg_group="Source", + help="Space-separated list of application security group names or IDs. Limited by backend server, " + "temporarily this argument only supports one application security group name or ID.", + nullable=True, + ) + args_schema.source_asgs.Element = AAZResourceIdArg( + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/applicationSecurityGroups/{}", + ), + ) + # filter arguments + args_schema.destination_address_prefix._registered = False + args_schema.destination_application_security_groups._registered = False + args_schema.destination_port_range._registered = False + args_schema.source_address_prefix._registered = False + args_schema.source_application_security_groups._registered = False + args_schema.source_port_range._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + # handle application security groups + args.destination_application_security_groups = assign_aaz_list_arg( + args.destination_application_security_groups, + args.destination_asgs, + element_transformer=lambda _, asg_id: {"id": asg_id} + ) + args.source_application_security_groups = assign_aaz_list_arg( + args.source_application_security_groups, + args.source_asgs, + element_transformer=lambda _, asg_id: {"id": asg_id} + ) + + def pre_instance_update(self, instance): + if instance.properties.sourceAddressPrefix: + instance.properties.sourceAddressPrefixes = [instance.properties.sourceAddressPrefix] + instance.properties.sourceAddressPrefix = None + if instance.properties.destinationAddressPrefix: + instance.properties.destinationAddressPrefixes = [instance.properties.destinationAddressPrefix] + instance.properties.destinationAddressPrefix = None + if instance.properties.sourcePortRange: + instance.properties.sourcePortRanges = [instance.properties.sourcePortRange] + instance.properties.sourcePortRange = None + if instance.properties.destinationPortRange: + instance.properties.destinationPortRanges = [instance.properties.destinationPortRange] + instance.properties.destinationPortRange = None + + def post_instance_update(self, instance): + if instance.properties.sourceAddressPrefixes and len(instance.properties.sourceAddressPrefixes) == 1: + instance.properties.sourceAddressPrefix = instance.properties.sourceAddressPrefixes[0] + instance.properties.sourceAddressPrefixes = None + if instance.properties.destinationAddressPrefixes and len(instance.properties.destinationAddressPrefixes) == 1: + instance.properties.destinationAddressPrefix = instance.properties.destinationAddressPrefixes[0] + instance.properties.destinationAddressPrefixes = None + if instance.properties.sourcePortRanges and len(instance.properties.sourcePortRanges) == 1: + instance.properties.sourcePortRange = instance.properties.sourcePortRanges[0] + instance.properties.sourcePortRanges = None + if instance.properties.destinationPortRanges and len(instance.properties.destinationPortRanges) == 1: + instance.properties.destinationPortRange = instance.properties.destinationPortRanges[0] + instance.properties.destinationPortRanges = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py new file mode 100644 index 00000000000..b10617ef691 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py @@ -0,0 +1,72 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.private_endpoint._create import Create as _PrivateEndpointCreate + + +class PrivateEndpointCreate(_PrivateEndpointCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.private_connection_resource_id = AAZStrArg( + options=['--private-connection-resource-id'], + help="The resource id of the private endpoint to connect to.", + required=True) + args_schema.group_ids = AAZListArg( + options=["--group-ids", "--group-id"], + help="The ID of the group obtained from the remote resource that this private endpoint should connect to. You can use \"az network private-link-resource list\" to obtain the supported group ids. You must provide this except for PrivateLinkService.," + ) + args_schema.group_ids.Element = AAZStrArg() + args_schema.request_message = AAZStrArg( + options=['--request-message'], + help="A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars.") + args_schema.connection_name = AAZStrArg( + options=['--connection-name'], + help="Name of the private link service connection.", + required=True) + args_schema.manual_request = AAZBoolArg( + options=['--manual-request'], + help="Use manual request to establish the connection. Configure it as 'true' when you don't have access to the subscription of private link service.") + args_schema.vnet_name = AAZStrArg( + options=['--vnet-name'], + help="The virtual network (VNet) associated with the subnet (Omit if supplying a subnet id).") + args_schema.subnet = AAZResourceIdArg( + options=['--subnet'], + help="Name or ID of an existing subnet. If name specified, also specify --vnet-name. " + "If you want to use an existing subnet in other resource group or subscription, please provide the ID instead of the name of the subnet and do not specify the--vnet-name.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}" + ) + ) + args_schema.manual_private_link_service_connections._registered = False + args_schema.private_link_service_connections._registered = False + args_schema.edge_zone_type._registered = False + args_schema.subnet_id._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + pls_connection = {'name': args.connection_name, + 'group_ids': args.group_ids, + 'request_message': args.request_message, + 'private_link_service_id': args.private_connection_resource_id} + + if args.manual_request: + args.manual_private_link_service_connections = [pls_connection] + else: + args.private_link_service_connections = [pls_connection] + + if has_value(args.subnet): + args.subnet_id = args.subnet + + if has_value(args.edge_zone): + args.edge_zone_type = 'EdgeZone' diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py new file mode 100644 index 00000000000..e48322ec379 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.private_endpoint._update import Update as _PrivateEndpointUpdate + + +class PrivateEndpointUpdate(_PrivateEndpointUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.request_message = AAZStrArg( + options=['--request-message'], + help="A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars.") + + args_schema.manual_private_link_service_connections._registered = False + args_schema.private_link_service_connections._registered = False + + return args_schema + + def pre_instance_update(self, instance): + args = self.ctx.args + if has_value(args.request_message): + if has_value(instance.properties.private_link_service_connections): + instance.properties.private_link_service_connections[0].properties.request_message = args.request_message + elif has_value(instance.properties.manual_private_link_service_connections): + instance.properties.manual_private_link_service_connections[0].properties.request_message = args.request_message diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/_add.py new file mode 100644 index 00000000000..3c81ff0566b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/asg/_add.py @@ -0,0 +1,22 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.private_endpoint.asg._add import Add as _PrivateEndpointAsgAdd + + +class PrivateEndpointAsgAdd(_PrivateEndpointAsgAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.asg_id._required = False + + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_add.py new file mode 100644 index 00000000000..ab40b8888e6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_add.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.private_endpoint.dns_zone_group._add import Add as _PrivateEndpointPrivateDnsZoneAdd + + +class PrivateEndpointPrivateDnsZoneAdd(_PrivateEndpointPrivateDnsZoneAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.private_dns_zone = AAZResourceIdArg( + options=['--private-dns-zone'], + help="Name or ID of the private dns zone.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/privateDnsZones/{}" + ) + ) + args_schema.private_dns_zone_id._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.private_dns_zone_id = args.private_dns_zone + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_create.py new file mode 100644 index 00000000000..ef819f3878b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/dns_zone_group/_create.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.private_endpoint.dns_zone_group._create import Create as _PrivateEndpointPrivateDnsZoneGroupCreate + + +class PrivateEndpointPrivateDnsZoneGroupCreate(_PrivateEndpointPrivateDnsZoneGroupCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.private_dns_zone = AAZResourceIdArg( + options=['--private-dns-zone'], + help="Name or ID of the private dns zone.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/privateDnsZones/{}" + ) + ) + args_schema.zone_name = AAZStrArg(options=['--zone-name'], help="Name of the private dns zone.", required=True) + args_schema.private_dns_zone_configs._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.private_dns_zone_configs = [{'name': args.zone_name, 'private_dns_zone_id': args.private_dns_zone}] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/_add.py new file mode 100644 index 00000000000..058b43b3847 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/ip_config/_add.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.private_endpoint.ip_config._add import Add as _PrivateEndpointIpConfigAdd + + +class PrivateEndpointIpConfigAdd(_PrivateEndpointIpConfigAdd): + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py new file mode 100644 index 00000000000..6ddceef7905 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py @@ -0,0 +1,67 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.core.util import CLIError, sdk_no_wait +from azure.cli.command_modules.network.aaz.latest.network.private_link_service._create import Create as _PrivateLinkServiceCreate + + +class PrivateLinkServiceCreate(_PrivateLinkServiceCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vnet_name = AAZStrArg(options=['--vnet-name'], arg_group="IP Configuration", help="The virtual network (VNet) name.") + args_schema.subnet = AAZResourceIdArg( + options=['--subnet'], + arg_group="IP Configuration", + help="Name or ID of subnet to use. If name provided, also supply `--vnet-name`.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}" + ) + ) + args_schema.private_ip_address = AAZStrArg(options=['--private-ip-address'], arg_group="IP Configuration", help="Static private IP address to use.") + args_schema.private_ip_address_version = AAZStrArg(options=['--private-ip-address-version'], arg_group="IP Configuration", help="IP version of the private IP address.", + default="IPv4", enum={"IPv4": "IPv4", "IPv6": "IPv6"}) + args_schema.private_ip_allocation_method = AAZStrArg(options=['--private-ip-allocation-method'], arg_group="IP Configuration", help="Private IP address allocation method.", + enum={"Dynamic": "Dynamic", "Static": "Static"}) + args_schema.lb_name = AAZStrArg(options=['--lb-name'], help="Name of the load balancer to retrieve frontend IP configs from. Ignored if a frontend IP configuration ID is supplied.") + args_schema.lb_frontend_ip_configs = AAZListArg(options=['--lb-frontend-ip-configs'], help="Space-separated list of names or IDs of load balancer frontend IP configurations to link to. If names are used, also supply `--lb-name`.") + args_schema.lb_frontend_ip_configs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIpConfigurations/{}" + ) + ) + + args_schema.load_balancer_frontend_ip_configurations._registered = False + args_schema.edge_zone_type._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + + if not has_value(args.ip_configurations): + args.ip_configurations = [{ + 'name': '{}_ipconfig_0'.format(args.name.to_serialized_data()), + 'private_ip_address': args.private_ip_address, + 'private_ip_allocation_method': args.private_ip_allocation_method, + 'private_ip_address_version': args.private_ip_address_version, + 'subnet': {'id': args.subnet} + }] + + args.load_balancer_frontend_ip_configurations = assign_aaz_list_arg( + args.load_balancer_frontend_ip_configurations, + args.lb_frontend_ip_configs, + element_transformer=lambda _, lb_frontend_ip_config: {"id": lb_frontend_ip_config} + ) + + if has_value(args.edge_zone): + args.edge_zone_type = 'EdgeZone' + if not has_value(args.lb_frontend_ip_configs) and not has_value(args.destination_ip_address): + raise CLIError("usage error: either --lb-frontend-ip-configs or --destination-ip-address is required") diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py new file mode 100644 index 00000000000..870308afaef --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py @@ -0,0 +1,38 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.private_link_service._update import Update as _PrivateLinkServiceUpdate + + +class PrivateLinkServiceUpdate(_PrivateLinkServiceUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.lb_name = AAZStrArg(options=['--lb-name'], help="Name of the load balancer to retrieve frontend IP configs from. Ignored if a frontend IP configuration ID is supplied.") + args_schema.lb_frontend_ip_configs = AAZListArg(options=['--lb-frontend-ip-configs'], help="Space-separated list of names or IDs of load balancer frontend IP configurations to link to. If names are used, also supply `--lb-name`.", nullable=True) + args_schema.lb_frontend_ip_configs.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIpConfigurations/{}" + ), + nullable=True + ) + args_schema.load_balancer_frontend_ip_configurations._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + + if has_value(args.lb_frontend_ip_configs): + args.load_balancer_frontend_ip_configurations = assign_aaz_list_arg( + args.load_balancer_frontend_ip_configurations, + args.lb_frontend_ip_configs, + element_transformer=lambda _, lb_frontend_ip_config: {"id": lb_frontend_ip_config} + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/_update.py new file mode 100644 index 00000000000..d7ebdc95467 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/connection/_update.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.private_link_service.connection._update import Update as _PrivateEndpointConnectionUpdate + + +class PrivateEndpointConnectionUpdate(_PrivateEndpointConnectionUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZArgEnum + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.connection_status._required = True + args_schema.connection_status.enum = AAZArgEnum({"Approved": "Approved", "Rejected": "Rejected", "Removed": "Removed"}) + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_create.py new file mode 100644 index 00000000000..2010212e567 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_create.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.public_ip._create import Create as _PublicIPCreate + + +class PublicIPCreate(_PublicIPCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/publicIPPrefixes/{}", + ) + args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ddosProtectionPlans/{}", + ) + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_list.py new file mode 100644 index 00000000000..6bf4fa94106 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_list.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.public_ip._list import List as _PublicIPList + + +_PUBLIC_IP_SHOW_TABLE_TRANSFORM = ( + '{Name:name, ResourceGroup:resourceGroup, Location:location, ' + 'Zones: (!zones && \' \') || join(` `, zones), ' + 'Address:ipAddress, AddressVersion:publicIpAddressVersion, ' + 'AllocationMethod:publicIpAllocationMethod, ' + 'IdleTimeoutInMinutes:idleTimeoutInMinutes, ' + 'ProvisioningState:provisioningState}' +) + + +class PublicIPList(_PublicIPList): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = '[].' + _PUBLIC_IP_SHOW_TABLE_TRANSFORM diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_show.py new file mode 100644 index 00000000000..4d187c94725 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_show.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.public_ip._show import Show as _PublicIPShow + + +_PUBLIC_IP_SHOW_TABLE_TRANSFORM = ( + '{Name:name, ResourceGroup:resourceGroup, Location:location, ' + 'Zones: (!zones && \' \') || join(` `, zones), ' + 'Address:ipAddress, AddressVersion:publicIpAddressVersion, ' + 'AllocationMethod:publicIpAllocationMethod, ' + 'IdleTimeoutInMinutes:idleTimeoutInMinutes, ' + 'ProvisioningState:provisioningState}' +) + + +class PublicIPShow(_PublicIPShow): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = _PUBLIC_IP_SHOW_TABLE_TRANSFORM diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py new file mode 100644 index 00000000000..f7d281b7899 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.public_ip._update import Update as _PublicIPUpdate + + +class PublicIPUpdate(_PublicIPUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZStrArg, AAZDictArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/publicIPPrefixes/{}", + ) + args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ddosProtectionPlans/{}", + ) + args_schema.ip_tags = AAZDictArg( + options=["--ip-tags"], + help="Space-separated list of IP tags in `TYPE=VAL` format.", + nullable=True + ) + args_schema.ip_tags.Element = AAZStrArg() + args_schema.ip_tags_list._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.ip_tags): + if (ip_tags := args.ip_tags.to_serialized_data()) is None: + args.ip_tags_list = [] + else: + args.ip_tags_list = [{"ip_tag_type": k, "tag": v} for k, v in ip_tags.items()] + + def post_instance_update(self, instance): + if not has_value(instance.properties.ddos_settings.ddos_protection_plan.id): + instance.properties.ddos_settings.ddos_protection_plan = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py new file mode 100644 index 00000000000..e956ca39ad8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py @@ -0,0 +1,39 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.public_ip.prefix._create import Create as _PublicIpPrefixCreate + + +class PublicIpPrefixCreate(_PublicIpPrefixCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZDictArg, AAZStrArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.custom_ip_prefix_name._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/customIPPrefixes/{}" + ) + args_schema.ip_tags = AAZDictArg( + options=["--ip-tags"], + help="The list of tags associated with the public IP prefix in 'TYPE=VAL' format.", + ) + args_schema.ip_tags.Element = AAZStrArg() + args_schema.type._registered = False + args_schema.ip_tags_list._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.edge_zone): + args.type = 'EdgeZone' + if has_value(args.ip_tags): + ip_tags = [] + for k, v in args.ip_tags.to_serialized_data().items(): + ip_tags.append({"ip_tag_type": k, "tag": v}) + args.ip_tags_list = ip_tags diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/_list_service_communities.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/_list_service_communities.py new file mode 100644 index 00000000000..4e1478297ad --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/route_filter/rule/_list_service_communities.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.route_filter.rule._list_service_communities import \ + ListServiceCommunities as _ListServiceCommunities +from azure.cli.command_modules.network._format import transform_service_community_table_output + + +class RouteFilterRuleListServiceCommunities(_ListServiceCommunities): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_service_community_table_output diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_create.py new file mode 100644 index 00000000000..bbd26826e60 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.security_partner_provider._create import Create as _SecurityPartnerProviderCreate + + +class SecurityPartnerProviderCreate(_SecurityPartnerProviderCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vhub._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_update.py new file mode 100644 index 00000000000..67c539a12f2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/security_partner_provider/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.security_partner_provider._update import Update as _SecurityPartnerProviderUpdate + + +class SecurityPartnerProviderUpdate(_SecurityPartnerProviderUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vhub._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/_show_geographic_hierarchy.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/_show_geographic_hierarchy.py new file mode 100644 index 00000000000..39e2dbc5c11 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/traffic_manager/endpoint/_show_geographic_hierarchy.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.traffic_manager.endpoint._show_geographic_hierarchy import \ + ShowGeographicHierarchy as _ShowGeographicHierarchy +from azure.cli.command_modules.network._format import transform_geographic_hierachy_table_output + + +class TrafficManagerEndpointShowGeographicHierarchy(_ShowGeographicHierarchy): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_geographic_hierachy_table_output diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_create.py new file mode 100644 index 00000000000..1b090a240e2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.virtual_appliance._create import Create as _VirtualApplianceCreate + + +class VirtualApplianceCreate(_VirtualApplianceCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vhub._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_update.py new file mode 100644 index 00000000000..c4d0bfdeedc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/virtual_appliance/_update.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.virtual_appliance._update import Update as _VirtualApplianceUpdate + + +class VirtualApplianceUpdate(_VirtualApplianceUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vhub._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{}", + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py new file mode 100644 index 00000000000..4affada6622 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet._create import Create as _VNetCreate + + +class VNetCreate(_VNetCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.edge_zone = AAZStrArg( + options=["--edge-zone"], + help="The name of edge zone.", + ) + # add subnet arguments + args_schema.subnet_name = AAZStrArg( + options=["--subnet-name"], + arg_group="Subnet", + help="Name of a new subnet to create within the VNet.", + ) + args_schema.subnet_prefixes = AAZListArg( + options=["--subnet-prefixes"], + arg_group="Subnet", + help="Space-separated list of address prefixes in CIDR format for the new subnet. If omitted, " + "automatically reserves a /24 (or as large as available) block within the VNet address space.", + ) + args_schema.subnet_prefixes.Element = AAZStrArg() + args_schema.subnet_nsg = AAZResourceIdArg( + options=["--nsg", "--network-security-group"], + arg_group="Subnet", + help="Name or ID of a network security group (NSG).", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/networkSecurityGroups/{}", + ), + ) + args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/ddosProtectionPlans/{}", + ) + # filter arguments + args_schema.extended_location._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.edge_zone): + args.extended_location.name = args.edge_zone + args.extended_location.type = "EdgeZone" + + if has_value(args.subnet_name): + subnet = {"name": args.subnet_name} + if not has_value(args.subnet_prefixes): + # set default value + address, bit_mask = str(args.address_prefixes[0]).split("/") + subnet_mask = 24 if int(bit_mask) < 24 else bit_mask + subnet["address_prefix"] = f"{address}/{subnet_mask}" + elif len(args.subnet_prefixes) == 1: + subnet["address_prefix"] = args.subnet_prefixes[0] + else: + subnet["address_prefixes"] = args.subnet_prefixes + if has_value(args.subnet_nsg): + subnet["network_security_group"] = {"id": args.subnet_nsg} + args.subnets = [subnet] + + if has_value(args.ipam_pool_prefix_allocations): + args.address_prefixes = [] + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return {"newVNet": result} diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_list.py new file mode 100644 index 00000000000..036f2f8ea2a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_list.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet._list import List as _VNetList +from azure.cli.command_modules.network._format import transform_vnet_table_output + + +class VNetList(_VNetList): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_vnet_table_output diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py new file mode 100644 index 00000000000..0092b2a0d3d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet._update import Update as _VNetUpdate + + +class VNetUpdate(_VNetUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + # handle detach logic + args_schema.ddos_protection_plan._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/ddosProtectionPlans/{}", + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + if args.ipam_pool_prefix_allocations.to_serialized_data(): + args.address_prefixes = [] + + def post_instance_update(self, instance): + if not has_value(instance.properties.ddos_protection_plan.id): + instance.properties.ddos_protection_plan = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/_create.py new file mode 100644 index 00000000000..597f2470554 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/peering/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet.peering._create import Create as _VNetPeeringCreate + + +class VNetPeeringCreate(_VNetPeeringCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.sync_remote._registered = False + args_schema.remote_vnet._required = True + args_schema.remote_vnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}", + ) + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py new file mode 100644 index 00000000000..b22c05eb92f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py @@ -0,0 +1,119 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._create import Create as _VNetSubnetCreate + + +class VNetSubnetCreate(_VNetSubnetCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.delegations = AAZListArg( + options=["--delegations"], + help="Space-separated list of services to whom the subnet should be delegated, e.g., Microsoft.Sql/servers." + ) + args_schema.delegations.Element = AAZStrArg() + # add endpoint/policy arguments + args_schema.service_endpoints = AAZListArg( + options=["--service-endpoints"], + help="Space-separated list of services allowed private access to this subnet. " + "Values from: az network vnet list-endpoint-services.", + ) + args_schema.service_endpoints.Element = AAZStrArg() + args_schema.service_endpoint_policy = AAZListArg( + options=["--service-endpoint-policy"], + help="Space-separated list of names or IDs of service endpoint policies to apply.", + ) + args_schema.service_endpoint_policy.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/serviceEndpointPolicies/{}", + ), + ) + # add ple/pls arguments + args_schema.disable_private_endpoint_network_policies = AAZStrArg( + options=["--disable-private-endpoint-network-policies"], + help="Disable private endpoint network policies on the subnet. Please note that it will be replaced by `--private-endpoint-network-policies` soon.", + enum={ + "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", + "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", + }, + blank="Disabled", + ) + args_schema.disable_private_link_service_network_policies = AAZStrArg( + options=["--disable-private-link-service-network-policies"], + help="Disable private link service network policies on the subnet. Please note that it will be replaced by `--private-link-service-network-policies` soon.", + enum={ + "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", + "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", + }, + blank="Disabled", + ) + args_schema.nat_gateway._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/natGateways/{}", + ) + args_schema.network_security_group._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/networkSecurityGroups/{}", + ) + args_schema.route_table._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/routeTables/{}", + ) + # filter arguments + args_schema.policies._registered = False + args_schema.delegated_services._registered = False + args_schema.address_prefix._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + _handle_plural_or_singular(args, "address_prefixes", "address_prefix") + + def delegation_trans(index, service_name): + service_name = str(service_name) + # covert name to service name + if "/" not in service_name and len(service_name.split(".")) == 3: + _, service, resource_type = service_name.split(".") + service_name = f"Microsoft.{service}/{resource_type}" + return { + "name": str(index), + "service_name": service_name, + } + + if has_value(args.endpoints) and has_value(args.service_endpoints): + raise ArgumentUsageError("usage error: `--endpoints` and `--service-endpoints` cannot be used together, we prefer to use `endpoints` instead") + args.delegated_services = assign_aaz_list_arg( + args.delegated_services, + args.delegations, + element_transformer=delegation_trans + ) + args.endpoints = assign_aaz_list_arg( + args.endpoints, + args.service_endpoints, + element_transformer=lambda _, service_name: {"service": service_name} + ) + args.policies = assign_aaz_list_arg( + args.policies, + args.service_endpoint_policy, + element_transformer=lambda _, policy_id: {"id": policy_id} + ) + # use string instead of bool + if has_value(args.disable_private_endpoint_network_policies): + logger.warning(subnet_disable_ple_msg) + args.private_endpoint_network_policies = args.disable_private_endpoint_network_policies + if has_value(args.disable_private_link_service_network_policies): + logger.warning(subnet_disable_pls_msg) + args.private_link_service_network_policies = args.disable_private_link_service_network_policies + + if has_value(args.ipam_pool_prefix_allocations): + args.address_prefixes = [] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py new file mode 100644 index 00000000000..6d185f96843 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py @@ -0,0 +1,138 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._update import Update as _VNetSubnetUpdate + + +class VNetSubnetUpdate(_VNetSubnetUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.delegations = AAZListArg( + options=["--delegations"], + help="Space-separated list of services to whom the subnet should be delegated, e.g., Microsoft.Sql/servers.", + nullable=True, + ) + args_schema.delegations.Element = AAZStrArg( + nullable=True, + ) + # add endpoint/policy arguments + args_schema.service_endpoints = AAZListArg( + options=["--service-endpoints"], + help="Space-separated list of services allowed private access to this subnet. " + "Values from: az network vnet list-endpoint-services.", + nullable=True, + ) + args_schema.service_endpoints.Element = AAZStrArg( + nullable=True, + ) + args_schema.service_endpoint_policy = AAZListArg( + options=["--service-endpoint-policy"], + help="Space-separated list of names or IDs of service endpoint policies to apply.", + nullable=True, + ) + args_schema.service_endpoint_policy.Element = AAZResourceIdArg( + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/serviceEndpointPolicies/{}", + ), + ) + # add ple/pls arguments + args_schema.disable_private_endpoint_network_policies = AAZStrArg( + options=["--disable-private-endpoint-network-policies"], + help="Disable private endpoint network policies on the subnet. Please note that it will be replaced by `--private-endpoint-network-policies` soon.", + nullable=True, + enum={ + "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", + "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", + }, + blank="Disabled", + ) + args_schema.disable_private_link_service_network_policies = AAZStrArg( + options=["--disable-private-link-service-network-policies"], + help="Disable private link service network policies on the subnet. Please note that it will be replaced by `--private-link-service-network-policies` soon.", + nullable=True, + enum={ + "true": "Disabled", "t": "Disabled", "yes": "Disabled", "y": "Disabled", "1": "Disabled", + "false": "Enabled", "f": "Enabled", "no": "Enabled", "n": "Enabled", "0": "Enabled", + }, + blank="Disabled", + ) + # filter arguments + args_schema.address_prefix._registered = False + args_schema.delegated_services._registered = False + args_schema.policies._registered = False + # handle detach logic + args_schema.nat_gateway._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/natGateways/{}", + ) + args_schema.network_security_group._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/networkSecurityGroups/{}", + ) + args_schema.route_table._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/routeTables/{}", + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + _handle_plural_or_singular(args, "address_prefixes", "address_prefix") + + def delegation_trans(index, service_name): + service_name = str(service_name) + # covert name to service name + if "/" not in service_name and len(service_name.split(".")) == 3: + _, service, resource_type = service_name.split(".") + service_name = f"Microsoft.{service}/{resource_type}" + return { + "name": str(index), + "service_name": service_name, + } + + if has_value(args.endpoints) and has_value(args.service_endpoints): + raise ArgumentUsageError("usage error: `--endpoints` and `--service-endpoints` cannot be used together, we prefer to use `endpoints` instead") + args.delegated_services = assign_aaz_list_arg( + args.delegated_services, + args.delegations, + element_transformer=delegation_trans + ) + args.endpoints = assign_aaz_list_arg( + args.endpoints, + args.service_endpoints, + element_transformer=lambda _, service_name: {"service": service_name} + ) + args.policies = assign_aaz_list_arg( + args.policies, + args.service_endpoint_policy, + element_transformer=lambda _, policy_id: {"id": policy_id} + ) + # use string instead of bool + if has_value(args.disable_private_endpoint_network_policies): + logger.warning(subnet_disable_ple_msg) + args.private_endpoint_network_policies = args.disable_private_endpoint_network_policies + if has_value(args.disable_private_link_service_network_policies): + logger.warning(subnet_disable_pls_msg) + args.private_link_service_network_policies = args.disable_private_link_service_network_policies + + if args.ipam_pool_prefix_allocations.to_serialized_data(): + args.address_prefixes = [] + + def post_instance_update(self, instance): + if not has_value(instance.properties.network_security_group.id): + instance.properties.network_security_group = None + if not has_value(instance.properties.route_table.id): + instance.properties.route_table = None + if not has_value(instance.properties.nat_gateway.id): + instance.properties.nat_gateway = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py new file mode 100644 index 00000000000..240a088b6a7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py @@ -0,0 +1,133 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.custom import RootCertFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._create import Create as _VnetGatewayCreate + + +class VnetGatewayCreate(_VnetGatewayCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZFileArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_addresses = AAZListArg(options=['--public-ip-addresses', '--public-ip-address'], + help="Specify a single public IP (name or ID) for an active-standby gateway. Specify two space-separated public IPs for an active-active gateway.") + args_schema.public_ip_addresses.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}" + ) + ) + args_schema.vnet = AAZResourceIdArg( + options=['--vnet'], + help="Name or ID of an existing virtual network which has a subnet named 'GatewaySubnet'.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + ) + args_schema.nat_rules.Element.external_mappings = AAZStrArg( + options=["external-mappings"], + help="Required.The private IP address external mapping for NAT.", + ) + args_schema.nat_rules.Element.internal_mappings = AAZStrArg( + options=["internal-mappings"], + help="Required.The private IP address internal mapping for NAT.", + ) + args_schema.root_cert_data = AAZFileArg(options=['--root-cert-data'], arg_group="Root Cert Authentication", + help="Base64 contents of the root certificate file or file path.", + fmt=RootCertFormat()) + args_schema.root_cert_name = AAZStrArg(options=['--root-cert-name'], arg_group="Root Cert Authentication", + help="Root certificate name.") + args_schema.gateway_default_site._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/localNetworkGateways/{}" + ) + args_schema.virtual_network_gateway_migration_status._registered = False + args_schema.ip_configurations._registered = False + args_schema.edge_zone_type._registered = False + args_schema.active._registered = False + args_schema.vpn_client_root_certificates._registered = False + args_schema.sku_tier._registered = False + args_schema.enable_bgp._registered = False + args_schema.nat_rules.Element.external_mappings_ip._registered = False + args_schema.nat_rules.Element.internal_mappings_ip._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + subnet = args.vnet.to_serialized_data() + '/subnets/GatewaySubnet' + args.sku_tier = args.sku + if has_value(args.gateway_type) and args.gateway_type != "LocalGateway": + args.active = len(args.public_ip_addresses) == 2 + else: + args.active = False + + args.ip_configurations = [] + if args.gateway_type != "LocalGateway": + if has_value(args.public_ip_addresses): + public_ip_addresses = args.public_ip_addresses.to_serialized_data() + ip_configuration = {} + for i, public_ip in enumerate(public_ip_addresses): + ip_configuration[i] = {'subnet': subnet, 'public_ip_address': public_ip, + 'private_ip_allocation_method': 'Dynamic', + 'name': 'vnetGatewayConfig{}'.format(i)} + args.ip_configurations.append(ip_configuration[i]) + else: + ip_configuration = {'subnet': subnet, + 'private_ip_allocation_method': 'Dynamic', + 'name': 'vnetGatewayConfig'} + args.ip_configurations.append(ip_configuration) + + else: + args.vpn_type = None + args.sku = None + args.sku_tier = None + + if has_value(args.asn) or has_value(args.bgp_peering_address) or has_value(args.peer_weight): + args.enable_bgp = True + else: + args.asn = None + args.bgp_peering_address = None + args.peer_weight = None + + if has_value(args.nat_rules): + rules = args.nat_rules.to_serialized_data() + for rule in rules: + if 'internal_mappings' in rule: + internal_mappings = rule['internal_mappings'].split(',') + rule['internal_mappings_ip'] = [{"address_space": internal_mapping} for internal_mapping in + internal_mappings] + if 'external_mappings' in rule: + external_mappings = rule['external_mappings'].split(',') + rule['external_mappings_ip'] = [{"address_space": external_mapping} for external_mapping in + external_mappings] + args.nat_rules = rules + + if has_value(args.address_prefixes) or has_value(args.client_protocol): + if has_value(args.root_cert_data): + data = args.root_cert_data.to_serialized_data() + else: + data = None + if has_value(args.root_cert_name): + args.vpn_client_root_certificates = [{'name': args.root_cert_name, 'public_cert_data': data}] + else: + args.vpn_client_root_certificates = [] + + if has_value(args.edge_zone): + args.edge_zone_type = 'EdgeZone' + + def _output(self, *args, **kwargs): + from azure.cli.core.aaz import AAZUndefined + if has_value(self.ctx.vars.instance.properties.nat_rules): + nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() + for nat_rule in nat_rules: + if 'type' in nat_rule['properties']: + # `properties.type` conflict with the `type` property when flatten `properties` + nat_rule['properties']['type'] = AAZUndefined + self.ctx.vars.instance.properties.nat_rules = nat_rules + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return {'vnetGateway': result} diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_disconnect_vpn_connections.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_disconnect_vpn_connections.py new file mode 100644 index 00000000000..dbfa1117fa1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_disconnect_vpn_connections.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._disconnect_vpn_connections import DisconnectVpnConnections as _VnetGatewayVpnConnectionsDisconnect + + +class VnetGatewayVpnConnectionsDisconnect(_VnetGatewayVpnConnectionsDisconnect): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vpn_connections.Element._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/connections/{}" + ) + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py new file mode 100644 index 00000000000..b62bd492f02 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._list import List as _VNetGatewayList + + +class VNetGatewayList(_VNetGatewayList): + def _output(self, *args, **kwargs): + from azure.cli.core.aaz import AAZUndefined + + # resolve flatten conflict + # when the type field conflicts, the type in inner layer is ignored and the outer layer is applied + for item in self.ctx.vars.instance.value: + props = item.properties + if has_value(props.nat_rules): + for rule in props.nat_rules: + if has_value(rule.properties) and has_value(rule.properties.type): + rule.properties.type = AAZUndefined + + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + + return result, next_link diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_advertised_routes.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_advertised_routes.py new file mode 100644 index 00000000000..b57ad858fcf --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_advertised_routes.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._list_advertised_routes import \ + ListAdvertisedRoutes as _ListAdvertisedRoutes +from azure.cli.command_modules.network._format import transform_vnet_gateway_routes_table + + +class VNetGatewayListAdvertisedRoutes(_ListAdvertisedRoutes): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_vnet_gateway_routes_table diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_bgp_peer_status.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_bgp_peer_status.py new file mode 100644 index 00000000000..2eee93f9cf0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_bgp_peer_status.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._list_bgp_peer_status import \ + ListBgpPeerStatus as _ListBgpPeerStatus +from azure.cli.command_modules.network._format import transform_vnet_gateway_bgp_peer_table + + +class VNetGatewayListBgpPeerStatus(_ListBgpPeerStatus): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_vnet_gateway_bgp_peer_table diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_learned_routes.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_learned_routes.py new file mode 100644 index 00000000000..e38993bef7a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list_learned_routes.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._list_learned_routes import \ + ListLearnedRoutes as _ListLearnedRoutes +from azure.cli.command_modules.network._format import transform_vnet_gateway_routes_table + + +class VNetGatewayListLearnedRoutes(_ListLearnedRoutes): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.table_transformer = transform_vnet_gateway_routes_table diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py new file mode 100644 index 00000000000..572dbdcaacc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py @@ -0,0 +1,26 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._show import Show as _VNetGatewayShow + + +class VNetGatewayShow(_VNetGatewayShow): + def _output(self, *args, **kwargs): + from azure.cli.core.aaz import AAZUndefined + + # resolve flatten conflict + # when the type field conflicts, the type in inner layer is ignored and the outer layer is applied + props = self.ctx.vars.instance.properties + if has_value(props.nat_rules): + for rule in props.nat_rules: + if has_value(rule.properties) and has_value(rule.properties.type): + rule.properties.type = AAZUndefined + + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py new file mode 100644 index 00000000000..f354e5ff592 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.custom import RootCertFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate + + +class VnetGatewayUpdate(_VnetGatewayUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg, AAZFileArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_ip_addresses = AAZListArg(options=['--public-ip-addresses', '--public-ip-address'], + help="Specify a single public IP (name or ID) for an active-standby gateway. Specify two space-separated public IPs for an active-active gateway.", + nullable=True) + args_schema.public_ip_addresses.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}" + ), + nullable=True, + ) + args_schema.vnet = AAZResourceIdArg( + options=['--vnet'], + help="Name or ID of an existing virtual network which has a subnet named 'GatewaySubnet'.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ), + ) + args_schema.root_cert_data = AAZFileArg(options=['--root-cert-data'], arg_group="Root Cert Authentication", + help="Base64 contents of the root certificate file or file path.", + fmt=RootCertFormat(), nullable=True) + args_schema.root_cert_name = AAZStrArg(options=['--root-cert-name'], arg_group="Root Cert Authentication", + help="Root certificate name.", nullable=True,) + args_schema.gateway_default_site._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/localNetworkGateways/{}" + ) + args_schema.enable_high_bandwidth_vpn_gateway._registered = False + args_schema.virtual_network_gateway_migration_status._registered = False + args_schema.ip_configurations._registered = False + args_schema.active._registered = False + args_schema.vpn_client_root_certificates._registered = False + args_schema.sku_tier._registered = False + args_schema.vpn_client_ipsec_policies._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + + if has_value(args.sku): + args.sku_tier = args.sku + + def pre_instance_update(self, instance): + args = self.ctx.args + if has_value(args.root_cert_data): + collection = instance.properties.vpn_client_configuration.vpn_client_root_certificates.to_serialized_data() + root_certificate = {'name': args.root_cert_name, 'public_cert_data': args.root_cert_data} + value = args.root_cert_name.to_serialized_data() + match = next((x for x in collection if getattr(x, 'name', None) == value), None) + if match: + collection.remove(match) + collection.append(root_certificate) + args.vpn_client_root_certificates = collection + + subnet_id = '{}/subnets/GatewaySubnet'.format(args.vnet) if has_value(args.vnet) else \ + instance.properties.ip_configurations[0].properties.subnet.id + + if has_value(args.vnet): + if has_value(instance.properties.ip_configurations): + for config in instance.properties.ip_configurations: + config.properties.subnet.id = subnet_id + + if has_value(args.public_ip_addresses): + instance.properties.ip_configurations = [] + public_ip_addresses = args.public_ip_addresses.to_serialized_data() + args.ip_configurations = [] + ip_configuration = {} + for i, public_ip in enumerate(public_ip_addresses): + ip_configuration[i] = {'subnet': subnet_id, 'public_ip_address': {'id': public_ip}, + 'private_ip_allocation_method': 'Dynamic', + 'name': 'vnetGatewayConfig{}'.format(i)} + args.ip_configurations.append(ip_configuration[i]) + + # Update active-active/active-standby status + active = len(args.public_ip_addresses) == 2 + if instance.properties.active_active and not active: + logger.info('Placing gateway in active-standby mode.') + elif not instance.properties.active_active and active: + logger.info('Placing gateway in active-active mode.') + args.active = active diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/_assign.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/_assign.py new file mode 100644 index 00000000000..87d6bae1ab1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/aad/_assign.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.aad._assign import Assign as _VnetGatewayAadAssign + + +class VnetGatewayAadAssign(_VnetGatewayAadAssign): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.audience._required = True + args_schema.issuer._required = True + args_schema.tenant._required = True + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/_add.py new file mode 100644 index 00000000000..7e47a618817 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/ipsec_policy/_add.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.ipsec_policy._add import Add as _VnetGatewayIpsecPolicyAdd + + +class VnetGatewayIpsecPolicyAdd(_VnetGatewayIpsecPolicyAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.vpn_client_ipsec_policy_index._registered = False + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_abort.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_abort.py new file mode 100644 index 00000000000..a7d9997fc21 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_abort.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.migration._abort import Abort as _VNetGatewayMigrationAbort + + +class VNetGatewayMigrationAbort(_VNetGatewayMigrationAbort): + + class VirtualNetworkGatewaysInvokeAbortMigration(_VNetGatewayMigrationAbort.VirtualNetworkGatewaysInvokeAbortMigration): + + # to handle the LRO response with no response body + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + lambda _: None, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_commit.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_commit.py new file mode 100644 index 00000000000..5fa5baf0622 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_commit.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.migration._commit import Commit as _VNetGatewayMigrationCommit + + +class VNetGatewayMigrationCommit(_VNetGatewayMigrationCommit): + + class VirtualNetworkGatewaysInvokeCommitMigration(_VNetGatewayMigrationCommit.VirtualNetworkGatewaysInvokeCommitMigration): + + # to handle the LRO response with no response body + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + lambda _: None, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_execute.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_execute.py new file mode 100644 index 00000000000..e1fd7fbc6a5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_execute.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.migration._execute import Execute as _VNetGatewayMigrationExecute + + +class VNetGatewayMigrationExecute(_VNetGatewayMigrationExecute): + + class VirtualNetworkGatewaysInvokeExecuteMigration(_VNetGatewayMigrationExecute.VirtualNetworkGatewaysInvokeExecuteMigration): + + # to handle the LRO response with no response body + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + lambda _: None, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_prepare.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_prepare.py new file mode 100644 index 00000000000..4f1ae7645b4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/migration/_prepare.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.migration._prepare import Prepare as _VNetGatewayMigrationPrepare + + +class VNetGatewayMigrationPrepare(_VNetGatewayMigrationPrepare): + + class VirtualNetworkGatewaysInvokePrepareMigration(_VNetGatewayMigrationPrepare.VirtualNetworkGatewaysInvokePrepareMigration): + + # to handle the LRO response with no response body + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + lambda _: None, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py new file mode 100644 index 00000000000..c97b0c97b9b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py @@ -0,0 +1,61 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._add import Add as _VnetGatewayNatRuleAdd + + +class VnetGatewayNatRuleAdd(_VnetGatewayNatRuleAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZListArg, AAZStrArg + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.external_mappings = AAZListArg( + options=["--external-mappings"], + help="The private IP address external mapping for NAT.", + required=True + ) + args_schema.external_mappings.Element = AAZStrArg() + args_schema.internal_mappings = AAZListArg( + options=["--internal-mappings"], + help="The private IP address internal mapping for NAT.", + required=True + ) + args_schema.internal_mappings.Element = AAZStrArg() + + args_schema.external_mappings_ip._registered = False + args_schema.internal_mappings_ip._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.external_mappings): + args.external_mappings_ip = assign_aaz_list_arg( + args.external_mappings_ip, + args.external_mappings, + element_transformer=lambda _, external_mapping: {"address_space": external_mapping} + ) + + if has_value(args.internal_mappings): + args.internal_mappings_ip = assign_aaz_list_arg( + args.internal_mappings_ip, + args.internal_mappings, + element_transformer=lambda _, internal_mapping: {"address_space": internal_mapping} + ) + + def _output(self, *args, **kwargs): + from azure.cli.core.aaz import AAZUndefined + if has_value(self.ctx.vars.instance.properties.nat_rules): + nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() + for nat_rule in nat_rules: + if 'type' in nat_rule['properties']: + nat_rule['properties']['type'] = AAZUndefined + self.ctx.vars.instance.properties.nat_rules = nat_rules + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py new file mode 100644 index 00000000000..50537587525 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._list import List as _VnetGatewayNatRuleShow + + +class VnetGatewayNatRuleShow(_VnetGatewayNatRuleShow): + + def _output(self, *args, **kwargs): + from azure.cli.core.aaz import AAZUndefined + if has_value(self.ctx.vars.instance.properties.nat_rules): + nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() + for nat_rule in nat_rules: + if 'type' in nat_rule['properties']: + nat_rule['properties']['type'] = AAZUndefined + self.ctx.vars.instance.properties.nat_rules = nat_rules + result = self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py new file mode 100644 index 00000000000..922c37b2b69 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._remove import Remove as _VnetGatewayNatRuleRemove + + +class VnetGatewayNatRuleRemove(_VnetGatewayNatRuleRemove): + + def _handler(self, command_args): + lro_poller = super()._handler(command_args) + lro_poller._result_callback = self._output + return lro_poller + + def _output(self, *args, **kwargs): + from azure.cli.core.aaz import AAZUndefined + if has_value(self.ctx.vars.instance.properties.nat_rules): + nat_rules = self.ctx.vars.instance.properties.natRules.to_serialized_data() + for nat_rule in nat_rules: + if 'type' in nat_rule['properties']: + nat_rule['properties']['type'] = AAZUndefined + self.ctx.vars.instance.properties.nat_rules = nat_rules + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/_wait.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/_wait.py new file mode 100644 index 00000000000..02c25221443 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/packet_capture/_wait.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._wait import Wait as _VNetGatewayWait + + +@register_command("network vnet-gateway packet-capture wait") +class VNetGatewayPacketCaptureWait(_VNetGatewayWait): + """Place the CLI in a waiting state until a condition of the virtual network gateway is met. + + :example: Pause executing next line of CLI script until the virtual network gateway is successfully provisioned. + az network vnet-gateway packet-capture wait -g MyResourceGroup -n MyVnetGateway --created + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/_create.py new file mode 100644 index 00000000000..4f92aa78113 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/revoked_cert/_create.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.revoked_cert._create import Create as _VnetGatewayRevokedCertCreate + + +class VnetGatewayRevokedCertCreate(_VnetGatewayRevokedCertCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.thumbprint._required = True + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py new file mode 100644 index 00000000000..5e9ae09a21f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.root_cert._create import Create as _VnetGatewayRootCertCreate + + +class VnetGatewayRootCertCreate(_VnetGatewayRootCertCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZFileArg, AAZFileArgBase64EncodeFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.public_cert_data = AAZFileArg(options=['--public-cert-data'], + help="Base64 contents of the root certificate file or file path.", + required=True, + fmt=AAZFileArgBase64EncodeFormat()) + args_schema.root_cert_data._required = False + args_schema.root_cert_data._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.public_cert_data): + import os + path = os.path.expanduser(args.public_cert_data.to_serialized_data()) + else: + path = None + args.root_cert_data = path diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/_wait.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/_wait.py new file mode 100644 index 00000000000..26ab06ea60b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/vpn_client/ipsec_policy/_wait.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command +from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._wait import Wait as _VNetGatewayWait + + +@register_command("network vnet-gateway vpn-client ipsec-policy wait") +class VNetGatewayVpnClientIpsecPolicyWait(_VNetGatewayWait): + """Place the CLI in a waiting state until a condition of the virtual network gateway is met. + + :example: Pause executing next line of CLI script until the virtual network gateway is successfully provisioned. + az network vnet-gateway vpn-client ipsec-policy wait -g MyResourceGroup -n MyVnetGateway --created + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_show_device_config_script.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_show_device_config_script.py new file mode 100644 index 00000000000..a6fc710d904 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_show_device_config_script.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vpn_connection._show_device_config_script import ShowDeviceConfigScript as _VpnConnectionDeviceConfigScriptShow + + +class VpnConnectionDeviceConfigScriptShow(_VpnConnectionDeviceConfigScriptShow): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.device_family._required = True + args_schema.firmware_version._required = True + args_schema.vendor._required = True + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_update.py new file mode 100644 index 00000000000..41b118c88d5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/_update.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vpn_connection._update import Update as _VpnConnectionUpdate + + +class VpnConnectionUpdate(_VpnConnectionUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.ipsec_policies._registered = False + + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/_add.py new file mode 100644 index 00000000000..0b70c27b4f5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/ipsec_policy/_add.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vpn_connection.ipsec_policy._add import Add as _VpnConnIpsecPolicyAdd + + +class VpnConnIpsecPolicyAdd(_VpnConnIpsecPolicyAdd): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.ipsec_policy_index._registered = False + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_stop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_stop.py new file mode 100644 index 00000000000..5b612db1b2c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_stop.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vpn_connection.packet_capture._stop import Stop as _VpnConnPackageCaptureStop + + +class VpnConnPackageCaptureStop(_VpnConnPackageCaptureStop): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.sas_url._required = True + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_wait.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_wait.py new file mode 100644 index 00000000000..73187bd86be --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/packet_capture/_wait.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import register_command +from azure.cli.command_modules.network.aaz.latest.network.vpn_connection._wait import Wait as _VpnConnectionWait + + +@register_command("network vpn-connection packet-capture wait") +class VpnConnectionPacketCaptureWait(_VpnConnectionWait): + """Place the CLI in a waiting state until a condition of the VPN connection is met. + + :example: Pause executing next line of CLI script until the VPN connection is successfully provisioned. + az network vpn-connection packet-capture wait -g MyResourceGroup -n MyConnection --created + """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/_update.py new file mode 100644 index 00000000000..35da26acf6a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vpn_connection/shared_key/_update.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.aaz.latest.network.vpn_connection.shared_key._update import Update as _VpnConnSharedKeyUpdate + + +class VpnConnSharedKeyUpdate(_VpnConnSharedKeyUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.value._required = True + return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py new file mode 100644 index 00000000000..6b402a156ec --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py @@ -0,0 +1,168 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access + +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.commands.arm import get_arm_resource_by_id +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.profiles import ResourceType +from azure.cli.core.commands.validators import validate_tags +from azure.cli.command_modules.network._validators import _resolve_api_version + + +def get_network_watcher_from_location(cmd, watcher_name="watcher_name", rg_name="watcher_rg"): + from ..aaz.latest.network.watcher._list import List + + args = cmd.ctx.args + location = args.location.to_serialized_data() + watcher_list = List(cli_ctx=cmd.cli_ctx)(command_args={}) + watcher = next((w for w in watcher_list if w["location"].lower() == location.lower()), None) + if not watcher: + raise ValidationError(f"network watcher is not enabled for region {location}.") + + id_parts = parse_resource_id(watcher["id"]) + setattr(args, rg_name, id_parts["resource_group"]) + setattr(args, watcher_name, id_parts["name"]) + + +def get_network_watcher_from_vm(cmd): + args = cmd.ctx.args + compute_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machines + vm_name = parse_resource_id(args.vm.to_serialized_data())["name"] + vm = compute_client.get(args.resource_group_name, vm_name) + args.location = vm.location + get_network_watcher_from_location(cmd) + + +def get_network_watcher_from_resource(cmd): + args = cmd.ctx.args + resource = get_arm_resource_by_id(cmd.cli_ctx, args.resource.to_serialized_data()) + args.location = resource.location + get_network_watcher_from_location(cmd) + + +def get_network_watcher_from_vmss(cmd): + args = cmd.ctx.args + compute_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machine_scale_sets + vmss_name = parse_resource_id(args.target.to_serialized_data())["name"] + vmss = compute_client.get(args.resource_group_name, vmss_name) + args.location = vmss.location + get_network_watcher_from_location(cmd) + + +def process_nw_cm_v2_create_namespace(cmd): + args = cmd.ctx.args + validate_tags(args) + if not has_value(args.location): # location is None only occurs in creating a V2 connection monitor + endpoint_source_resource_id = args.endpoint_source_resource_id.to_serialized_data() + from azure.mgmt.resource import ResourceManagementClient + # parse and verify endpoint_source_resource_id + if not has_value(args.endpoint_source_resource_id): + raise ValidationError('usage error: --location/--endpoint-source-resource-id ' + 'is required to create a V2 connection monitor') + if is_valid_resource_id(endpoint_source_resource_id) is False: + raise ValidationError('usage error: "{}" is not a valid resource id'.format(endpoint_source_resource_id)) + + resource = parse_resource_id(endpoint_source_resource_id) + resource_client = get_mgmt_service_client(cmd.cli_ctx, ResourceManagementClient) + resource_api_version = _resolve_api_version(resource_client, + resource['namespace'], + resource['resource_parent'], + resource['resource_type']) + resource = resource_client.resources.get_by_id(endpoint_source_resource_id, resource_api_version) + + args.location = resource.location + if not has_value(args.location): + raise ValidationError("Can not get location from --endpoint-source-resource-id") + + if not has_value(args.test_config_protocol): + raise ValidationError('usage error: --protocol is required to create a test ' + 'configuration for V2 connection monitor') + + if has_value(args.output_type) and not has_value(args.workspace_ids): + raise ValidationError('usage error: --output-type is specified but no other resource id provided') + + +# These are helper classes used by custom.py functions, not registered commands. +# They inherit AZ_NAME from the aaz parent but should NOT be auto-registered. +# They are placed here (not in a _.py file) to avoid autoloading. + +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._update import Update as _WatcherConnectionMonitorUpdate + + +class WatcherConnectionMonitorOutputRemove(_WatcherConnectionMonitorUpdate): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._required = False + args_schema.watcher_rg._required = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) + args = self.ctx.args + args.outputs = [] + + +class WatcherConnectionMonitorTestGroupRemove(_WatcherConnectionMonitorUpdate): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._required = False + args_schema.watcher_rg._required = False + args_schema.test_group_name = AAZStrArg( + options=["--test-group-name"], + help='The name of the connection monitor test group.', + required=True, + registered=False, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) + + def pre_instance_update(self, instance): + args = self.ctx.args + name = args.test_group_name.to_serialized_data() + + instance = self.ctx.vars.instance + + new_test_groups, removed_test_group = [], None + for t in instance.properties.test_groups: + if t.name.to_serialized_data() == name: + removed_test_group = t + else: + new_test_groups.append(t) + + if removed_test_group is None: + raise ValidationError('test group: "{}" not exist'.format(name)) + instance.properties.test_groups = new_test_groups + + # deal with endpoints which are only referenced by this removed test group + removed_endpoints = [] + for e in (removed_test_group.sources.to_serialized_data() + + removed_test_group.destinations.to_serialized_data()): + tmp = [t for t in instance.properties.test_groups + if (e in t.sources.to_serialized_data() or e in t.destinations.to_serialized_data())] + if not tmp: + removed_endpoints.append(e) + instance.properties.endpoints = [e for e in instance.properties.endpoints + if e.name.to_serialized_data() not in removed_endpoints] + + # deal with test configurations which are only referenced by this remove test group + removed_test_configurations = [] + for c in removed_test_group.test_configurations.to_serialized_data(): + tmp = [t for t in instance.properties.test_groups if c in t.test_configurations.to_serialized_data()] + if not tmp: + removed_test_configurations.append(c) + instance.properties.test_configurations = [c for c in instance.properties.test_configurations + if c.name.to_serialized_data() not in removed_test_configurations] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py new file mode 100644 index 00000000000..ff861ca2389 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py @@ -0,0 +1,123 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher._run_configuration_diagnostic import RunConfigurationDiagnostic as _RunConfigurationDiagnostic +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_resource + + +class RunConfigurationDiagnostic(_RunConfigurationDiagnostic): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + args_schema.destination = AAZStrArg( + options=["--destination"], + arg_group="Query", + help="Traffic destination. Accepted values are '*', IP address/CIDR, or Service Tag.", + ) + args_schema.direction = AAZStrArg( + options=["--direction"], + arg_group="Query", + help="Direction of the traffic.", + enum={"Inbound": "Inbound", "Outbound": "Outbound"}, + ) + args_schema.port = AAZStrArg( + options=["--port"], + arg_group="Query", + help="Traffic destination port. Accepted values are '*', port number (3389) or port range (80-100).", + ) + args_schema.protocol = AAZStrArg( + options=["--protocol"], + arg_group="Query", + help="Protocol to be verified on.", + enum={"TCP": "TCP", "UDP": "UDP"}, + ) + args_schema.source = AAZStrArg( + options=["--source"], + arg_group="Query", + help="Traffic source. Accepted values are '*', IP address/CIDR, or Service Tag.", + ) + args_schema.parent = AAZStrArg( + options=["--parent"], + arg_group="Target", + help="Parent path, e.g., virtualMachineScaleSets/vmss1.", + ) + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + arg_group="Target", + help="Name of the resource group the target resource is in.", + ) + args_schema.resource_type = AAZStrArg( + options=["-t", "--resource-type"], + arg_group="Target", + help="Resource type.", + enum={ + "applicationGateways": "applicationGateways", + "networkInterfaces": "networkInterfaces", + "virtualMachines": "virtualMachines", + }, + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + args_schema.queries._required = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + # validate target resource + resource_usage = ValidationError("usage error: --resource ID | --resource NAME --resource-type TYPE --resource-group NAME [--parent PATH]") + # omit --parent since it is optional + id_params = [has_value(args.resource_group_name), has_value(args.resource_type)] + if not is_valid_resource_id(args.resource.to_serialized_data()): + if not all(id_params): + raise resource_usage + # infer resource namespace + NAMESPACES = { + "virtualMachines": "Microsoft.Compute", + "applicationGateways": "Microsoft.Network", + "networkInterfaces": "Microsoft.Network", + } + resource_namespace = NAMESPACES[args.resource_type.to_serialized_data()] + if has_value(args.parent): + # special case for virtualMachineScaleSets/NetworkInterfaces, since it is + # the only one to need `--parent` + resource_namespace = "Microsoft.Compute" + args.resource = resource_id( + subscription=self.ctx.subscription_id, + resource_group=args.resource_group_name, + namespace=resource_namespace, + type=args.resource_type, + parent=args.parent, + name=args.resource + ) + elif any(id_params) or has_value(args.parent): + raise resource_usage + # validate query + query_usage = ValidationError("usage error: --queries JSON | --destination DEST --source SRC --direction DIR --port PORT --protocol PROTOCOL") + query_params = [has_value(args.destination), has_value(args.port), has_value(args.direction), has_value(args.protocol), has_value(args.source)] + if has_value(args.queries): + if any(query_params): + raise query_usage + elif not all(query_params): + raise query_usage + else: + args.queries = [{ + "destination": args.destination, + "destination_port": args.port, + "direction": args.direction, + "protocol": args.protocol, + "source": args.source + }] + + get_network_watcher_from_resource(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py new file mode 100644 index 00000000000..0d451923bc8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py @@ -0,0 +1,39 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher._show_next_hop import ShowNextHop as _ShowNextHop +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm + + +class ShowNextHop(_ShowNextHop): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of the resource group the target VM is in.", + ) + args_schema.vm._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" + "/virtualMachines/{}", + ) + args_schema.nic._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" + "/networkInterfaces/{}", + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_vm(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py new file mode 100644 index 00000000000..ae38409d9a1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher._show_security_group_view import ShowSecurityGroupView as _ShowSecurityGroupView +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm + + +class ShowSecurityGroupView(_ShowSecurityGroupView): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of the resource group the target VM is in.", + ) + args_schema.vm._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" + "/virtualMachines/{}", + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_vm(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py new file mode 100644 index 00000000000..1a5b43c7d32 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py @@ -0,0 +1,58 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.profiles import ResourceType +from azure.cli.command_modules.network.aaz.latest.network.watcher._show_topology import ShowTopology as _ShowTopology +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class ShowTopology(_ShowTopology): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + help="Location. Defaults to the location of the target resource group. " + "Topology information is only shown for resources within the target resource group " + "that are within the specified region.", + ) + args_schema.resource_group_name._options = ["-g", "--resource-group"] + args_schema.vnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" + "/virtualNetworks/{}", + ) + args_schema.subnet._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" + "/virtualNetworks/{vnet}/subnets/{}", + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.subnet): + rg = parse_resource_id(args.subnet.to_serialized_data())["resource_group"] + args.resource_group_name = None + args.vnet = None + elif has_value(args.vnet): + rg = parse_resource_id(args.vnet.to_serialized_data())["resource_group"] + args.resource_group_name = None + else: + rg = args.resource_group_name.to_serialized_data() + # retrieve location from resource group + if not has_value(args.location): + resource_client = \ + get_mgmt_service_client(self.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES).resource_groups + resource_group = resource_client.get(rg) + args.location = resource_group.location + + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py new file mode 100644 index 00000000000..812a48ef3ac --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py @@ -0,0 +1,73 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.profiles import ResourceType +from azure.cli.command_modules.network.aaz.latest.network.watcher._test_connectivity import TestConnectivity as _TestConnectivity +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class TestConnectivity(_TestConnectivity): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of the resource group the target resource is in.", + ) + args_schema.headers = AAZDictArg( + options=["--headers"], + arg_group="HTTP Configuration", + help="Space-separated list of headers in `KEY=VALUE` format.", + ) + args_schema.headers.Element = AAZStrArg() + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + args_schema.headers_obj._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + compute_client = get_mgmt_service_client(self.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machines + id_parts = parse_resource_id(args.source_resource.to_serialized_data()) + vm_name = id_parts["name"] + rg = args.resource_group_name or id_parts.get("resource_group", None) + if not rg: + raise ValidationError("usage error: --source-resource ID | --source-resource NAME --resource-group NAME") + + vm = compute_client.get(rg, vm_name) + args.location = vm.location + get_network_watcher_from_location(self) + + if has_value(args.source_resource) and not is_valid_resource_id(args.source_resource.to_serialized_data()): + args.source_resource = resource_id( + subscription=self.ctx.subscription_id, + resource_group=rg, + namespace="Microsoft.Compute", + type="virtualMachines", + name=args.source_resource + ) + + if has_value(args.dest_resource) and not is_valid_resource_id(args.dest_resource.to_serialized_data()): + args.dest_resource = resource_id( + subscription=self.ctx.subscription_id, + resource_group=args.resource_group_name, + namespace="Microsoft.Compute", + type="virtualMachines", + name=args.dest_resource + ) + + if has_value(args.headers): + args.headers_obj = [{"name": k, "value": v} for k, v in args.headers.items()] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py new file mode 100644 index 00000000000..e1d4260e2e2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py @@ -0,0 +1,67 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher._test_ip_flow import TestIpFlow as _TestIPFlow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm + + +class TestIPFlow(_TestIPFlow): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + args_schema.local = AAZStrArg( + options=["--local"], + help="Private IPv4 address for the VMs NIC and the port of the packet in X.X.X.X:PORT format. " + "`*` can be used for port when direction is outbound.", + required=True, + ) + args_schema.remote = AAZStrArg( + options=["--remote"], + help="IPv4 address and port for the remote side of the packet X.X.X.X:PORT format. " + "`*` can be used for port when the direction is inbound.", + required=True, + ) + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of the resource group the target VM is in.", + ) + args_schema.vm._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" + "/virtualMachines/{}", + ) + args_schema.nic._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" + "/networkInterfaces/{}", + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + args_schema.local_ip_address._required = False + args_schema.local_ip_address._registered = False + args_schema.local_port._required = False + args_schema.local_port._registered = False + args_schema.remote_ip_address._required = False + args_schema.remote_ip_address._registered = False + args_schema.remote_port._required = False + args_schema.remote_port._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + try: + args.local_ip_address, args.local_port = args.local.to_serialized_data().split(":") + args.remote_ip_address, args.remote_port = args.remote.to_serialized_data().split(":") + except: + raise ValidationError("usage error: the format of the '--local' and '--remote' should be like x.x.x.x:port") + + get_network_watcher_from_vm(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py new file mode 100644 index 00000000000..c7b5aa23782 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py @@ -0,0 +1,306 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._create import Create as _WatcherConnectionMonitorCreate +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location, process_nw_cm_v2_create_namespace + + +class WatcherConnectionMonitorCreate(_WatcherConnectionMonitorCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group._required = False + + args_schema.auto_start._registered = False + args_schema.monitoring_interval_in_seconds._registered = False + args_schema.source._registered = False + args_schema.destination._registered = False + args_schema.endpoints._registered = False + args_schema.test_configurations._registered = False + args_schema.test_groups._registered = False + args_schema.outputs._registered = False + + # V2 Endpoint + args_schema.endpoint_dest_address = AAZStrArg( + options=["--endpoint-dest-address"], + help="Address of the destination of connection monitor endpoint (IP or domain name)", + arg_group="V2 Endpoint", + ) + args_schema.endpoint_dest_coverage_level = AAZStrArg( + options=["--endpoint-dest-coverage-level"], + help="Test coverage for the endpoint.", + enum={"AboveAverage": "AboveAverage", "Average": "Average", "BelowAverage": "BelowAverage", + "Default": "Default", "Full": "Full", "Low": "Low"}, + arg_group="V2 Endpoint" + ) + args_schema.endpoint_dest_name = AAZStrArg( + options=["--endpoint-dest-name"], + help="The name of the destination of connection monitor endpoint. " + "If you are creating a V2 Connection Monitor, it's required.", + required=True, + arg_group="V2 Endpoint" + ) + args_schema.endpoint_dest_resource_id = AAZStrArg( + options=["--endpoint-dest-resource-id"], + help="Resource ID of the destination of connection monitor endpoint.", + arg_group="V2 Endpoint", + ) + args_schema.endpoint_dest_type = AAZStrArg( + options=["--endpoint-dest-type"], + help="The endpoint type.", + enum={"AzureArcVM": "AzureArcVM", "AzureSubnet": "AzureSubnet", "AzureVM": "AzureVM", + "AzureVMSS": "AzureVMSS", "AzureVNet": "AzureVNet", "ExternalAddress": "ExternalAddress", + "MMAWorkspaceMachine": "MMAWorkspaceMachine", "MMAWorkspaceNetwork": "MMAWorkspaceNetwork"}, + arg_group="V2 Endpoint" + ) + args_schema.endpoint_source_address = AAZStrArg( + options=["--endpoint-source-address"], + help="Address of the source of connection monitor endpoint (IP or domain name).", + arg_group="V2 Endpoint", + ) + args_schema.endpoint_source_coverage_level = AAZStrArg( + options=["--endpoint-source-coverage-level"], + help="Test coverage for the endpoint.", + enum={"AboveAverage": "AboveAverage", "Average": "Average", "BelowAverage": "BelowAverage", + "Default": "Default", "Full": "Full", "Low": "Low"}, + arg_group="V2 Endpoint" + ) + args_schema.endpoint_source_name = AAZStrArg( + options=["--endpoint-source-name"], + help="The name of the source of connection monitor endpoint. " + "If you are creating a V2 Connection Monitor, it's required.", + required=True, + arg_group="V2 Endpoint", + ) + args_schema.endpoint_source_resource_id = AAZStrArg( + options=["--endpoint-source-resource-id"], + help="Resource ID of the source of connection monitor endpoint. " + "If endpoint is intended to used as source, this option is required.", + required=True, + arg_group="V2 Endpoint", + ) + args_schema.endpoint_source_type = AAZStrArg( + options=["--endpoint-source-type"], + help="The endpoint type.", + enum={"AzureArcVM": "AzureArcVM", "AzureSubnet": "AzureSubnet", "AzureVM": "AzureVM", + "AzureVMSS": "AzureVMSS", "AzureVNet": "AzureVNet", "ExternalAddress": "ExternalAddress", + "MMAWorkspaceMachine": "MMAWorkspaceMachine", "MMAWorkspaceNetwork": "MMAWorkspaceNetwork"}, + arg_group="V2 Endpoint" + ) + + # V2 Output + args_schema.output_type = AAZStrArg( + options=["--type", "--output-type"], + help="Connection monitor output destination type. Currently, only \"Workspace\" is supported.", + enum={"Workspace": "Workspace"}, + arg_group="V2 Output" + ) + args_schema.workspace_ids = AAZListArg( + options=["--workspace-ids"], + help="Space-separated list of ids of log analytics workspace.", + arg_group="V2 Output" + ) + args_schema.workspace_ids.Element = AAZStrArg() + + # V2 Test Configuration + args_schema.test_config_name = AAZStrArg( + options=["--test-config-name"], + help="The name of the connection monitor test configuration. " + "If you are creating a V2 Connection Monitor, it's required.", + required=True, + arg_group="V2 Test Configuration", + ) + args_schema.test_config_frequency = AAZIntArg( + options=["--frequency"], + help="The frequency of test evaluation, in seconds.", + arg_group="V2 Test Configuration", + default=60, + ) + args_schema.test_config_http_method = AAZStrArg( + options=["--http-method"], + help="The HTTP method to use.", + arg_group="V2 Test Configuration", + enum={"Get": "Get", "Post": "Post"}, + ) + args_schema.test_config_http_path = AAZStrArg( + options=["--http-path"], + help='The path component of the URI. For instance, "/dir1/dir2".', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_http_port = AAZIntArg( + options=["--http-port"], + help='The port to connect to.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_http_valid_status_codes = AAZListArg( + options=["--http-valid-status-codes"], + help="Space-separated list of HTTP status codes to consider successful. For instance, '2xx 301-304 418'", + arg_group="V2 Test Configuration" + ) + args_schema.test_config_http_valid_status_codes.Element = AAZStrArg() + + args_schema.test_config_http_prefer_https = AAZBoolArg( + options=["--https-prefer"], + help='Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. ' + ' Allowed values: false, true.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_icmp_disable_trace_route = AAZBoolArg( + options=["--icmp-disable-trace-route"], + help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' + ' Allowed values: false, true.', + arg_group="V2 Test Configuration", + ) + + args_schema.test_config_preferred_ip_version = AAZStrArg( + options=["--preferred-ip-version"], + help='The preferred IP version to use in test evaluation. ' + 'The connection monitor may choose to use a different version depending on other parameters.', + arg_group="V2 Test Configuration", + enum={"IPv4": "IPv4", "IPv6": "IPv6"}, + ) + args_schema.test_config_protocol = AAZStrArg( + options=["--protocol"], + help='The protocol to use in test evaluation.', + arg_group="V2 Test Configuration", + enum={"Http": "Http", "Icmp": "Icmp", "Tcp": "Tcp"}, + ) + + args_schema.test_config_tcp_disable_trace_route = AAZBoolArg( + options=["--tcp-disable-trace-route"], + help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' + 'Allowed values: false, true.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_tcp_port = AAZIntArg( + options=["--tcp-port"], + help='The port to connect to.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_tcp_port_behavior = AAZStrArg( + options=["--tcp-port-behavior"], + help='Destination port behavior.', + arg_group="V2 Test Configuration", + enum={"ListenIfAvailable": "ListenIfAvailable", "None": "None"}, + ) + args_schema.test_config_threshold_failed_percent = AAZIntArg( + options=["--threshold-failed-percent"], + help='The maximum percentage of failed checks permitted for a test to evaluate as successful.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_threshold_round_trip_time = AAZFloatArg( + options=["--threshold-round-trip-time"], + help='The maximum round-trip time in milliseconds permitted for a test to evaluate as successful.', + arg_group="V2 Test Configuration", + ) + + # V2 Test Group + args_schema.test_group_disable = AAZBoolArg( + options=["--test-group-disable"], + help='Value indicating whether test group is disabled. false is default.', + arg_group="V2 Test Group", + ) + args_schema.test_group_name = AAZStrArg( + options=["--test-group-name"], + help='The name of the connection monitor test group.', + arg_group="V2 Test Group", + default="DefaultTestGroup" + ) + return args_schema + + def pre_operations(self): + process_nw_cm_v2_create_namespace(self) + get_network_watcher_from_location(self, watcher_name='network_watcher_name', rg_name='resource_group') + args = self.ctx.args + + # deal with endpoint + src_endpoint = { + "name": args.endpoint_source_name, + "resource_id": args.endpoint_source_resource_id, + "address": args.endpoint_source_address, + "type": args.endpoint_source_type, + "coverage_level": args.endpoint_source_coverage_level + } + dst_endpoint = { + "name": args.endpoint_dest_name, + "resource_id": args.endpoint_dest_resource_id, + "address": args.endpoint_dest_address, + "type": args.endpoint_dest_type, + "coverage_level": args.endpoint_dest_coverage_level + } + + # deal with test configuration + test_config = { + "name": args.test_config_name, + "test_frequency_sec": args.test_config_frequency, + "protocol": args.test_config_protocol, + "preferred_ip_version": args.test_config_preferred_ip_version, + } + if has_value(args.test_config_threshold_failed_percent) or \ + has_value(args.test_config_threshold_round_trip_time): + test_config['success_threshold'] = { + "checks_failed_percent": args.test_config_threshold_failed_percent, + "round_trip_time_ms": args.test_config_threshold_round_trip_time + } + if args.test_config_protocol == "Tcp": + tcp_config = { + "port": args.test_config_tcp_port, + "destination_port_behavior": args.test_config_tcp_port_behavior, + "disable_trace_route": args.test_config_tcp_disable_trace_route, + } + test_config['tcp_configuration'] = tcp_config + elif args.test_config_protocol == "Icmp": + icmp_config = {"disable_trace_route": args.test_config_icmp_disable_trace_route} + test_config['icmp_configuration'] = icmp_config + elif args.test_config_protocol == "Http": + http_config = { + "port": args.test_config_http_port, + "method": args.test_config_http_method, + "path": args.test_config_http_path, + "valid_status_code_ranges": args.test_config_http_valid_status_codes, + "prefer_https": args.test_config_http_prefer_https, + } + test_config['http_configuration'] = http_config + else: + raise ValidationError('Unsupported protocol: "{}" for test configuration'.format(args.test_config_protocol)) + + # deal with test group + test_group = { + "name": args.test_group_name, + "disable": args.test_group_disable, + "test-configurations": [tc['name'] for tc in [test_config]], + "sources": [e['name'] for e in [src_endpoint]], + "destinations": [e['name'] for e in [dst_endpoint]] + } + + # If 'workspace_ids' option is specified but 'output_type' is not + # then still it should be implicit that 'output-type' is 'Workspace' + # since only supported value for output_type is 'Workspace' currently. + if has_value(args.workspace_ids) and not has_value(args.output_type): + args.output_type = 'Workspace' + + if has_value(args.output_type) and has_value(args.workspace_ids): + if args.output_type != "Workspace": + raise ValidationError('Unsupported output type: "{}"'.format(args.output_type)) + args.outputs = [] + for workspace_id in args.workspace_ids: + output = { + "type": args.output_type, + "workspace_id": workspace_id, + } + args.outputs.append(output) + else: + args.outputs = [] + args.endpoints = [src_endpoint, dst_endpoint] + args.test_configurations = [test_config] + args.test_groups = [test_group] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py new file mode 100644 index 00000000000..73e502e0713 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._delete import Delete as _WatcherConnectionMonitorDelete +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorDelete(_WatcherConnectionMonitorDelete): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group_name._registered = False + args_schema.resource_group_name._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group_name' + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py new file mode 100644 index 00000000000..e39546ec611 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._list import List as _WatcherConnectionMonitorList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorList(_WatcherConnectionMonitorList): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group_name._registered = False + args_schema.resource_group_name._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group_name' + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py new file mode 100644 index 00000000000..f72bce56709 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._query import Query as _WatcherConnectionMonitorQuery +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorQuery(_WatcherConnectionMonitorQuery): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group_name._registered = False + args_schema.resource_group_name._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group_name' + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py new file mode 100644 index 00000000000..f55659346ab --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._show import Show as _WatcherConnectionMonitorShow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorShow(_WatcherConnectionMonitorShow): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group_name._registered = False + args_schema.resource_group_name._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group_name' + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py new file mode 100644 index 00000000000..c873ac79275 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._start import Start as _WatcherConnectionMonitorStart +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorStart(_WatcherConnectionMonitorStart): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group_name._registered = False + args_schema.resource_group_name._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group_name' + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py new file mode 100644 index 00000000000..0bd97624b67 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._stop import Stop as _WatcherConnectionMonitorStop +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorStop(_WatcherConnectionMonitorStop): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group_name._registered = False + args_schema.resource_group_name._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group_name' + ) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py new file mode 100644 index 00000000000..c955d6ffdcc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py @@ -0,0 +1,99 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz.utils import assign_aaz_list_arg +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._add import Add as _WatcherConnectionMonitorEndpointAdd +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorEndpointAdd(_WatcherConnectionMonitorEndpointAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.filter_items._registered = False + args_schema.filter_type._registered = False + args_schema.scope_exclude._registered = False + args_schema.scope_include._registered = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True + ) + args_schema.address_exclude = AAZListArg( + options=["--address-exclude"], + help="List of address of the endpoint item which needs to be excluded to the endpoint scope.", + ) + args_schema.address_exclude.Element = AAZStrArg() + + args_schema.address_include = AAZListArg( + options=["--address-include"], + help="List of address of the endpoint item which needs to be included to the endpoint scope.", + ) + args_schema.address_include.Element = AAZStrArg() + + args_schema.dest_test_groups = AAZListArg( + options=["--dest-test-groups"], + help="Space-separated list of names for test group to reference as destination.", + arg_group="V2 Test Group" + ) + args_schema.dest_test_groups.Element = AAZStrArg() + + args_schema.source_test_groups = AAZListArg( + options=["--source-test-groups"], + help="Space-separated list of names for test group to reference as source.", + arg_group="V2 Test Group" + ) + args_schema.source_test_groups.Element = AAZStrArg() + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.dest_test_groups) or has_value(args.source_test_groups): + dest_test_groups, source_test_groups = args.dest_test_groups, args.source_test_groups + if dest_test_groups is None and source_test_groups is None: + raise ValidationError('usage error: endpoint has to be referenced from at least one existing ' + 'test group via --dest-test-groups/--source-test-groups') + get_network_watcher_from_location(self) + + args.scope_include = assign_aaz_list_arg( + args.scope_include, + args.address_include, + element_transformer=lambda _, tmp_ip: {"address": tmp_ip} + ) + + args.scope_exclude = assign_aaz_list_arg( + args.scope_exclude, + args.address_exclude, + element_transformer=lambda _, tmp_ip: {"address": tmp_ip} + ) + + def pre_instance_create(self): + args = self.ctx.args + name = args.endpoint_name.to_serialized_data() + instance = self.ctx.vars.instance + src_test_groups = set() + dst_test_groups = set() + if has_value(args.source_test_groups): + src_test_groups = set(args.source_test_groups.to_serialized_data()) + if has_value(args.dest_test_groups): + dst_test_groups = set(args.dest_test_groups.to_serialized_data()) + for test_group in instance.properties.test_groups: + if test_group.name.to_serialized_data() in src_test_groups: + test_group.sources.append(name) + if test_group.name.to_serialized_data() in dst_test_groups: + test_group.destinations.append(name) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py new file mode 100644 index 00000000000..31b6347c984 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._list import List as _WatcherConnectionMonitorEndpointList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorEndpointList(_WatcherConnectionMonitorEndpointList): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py new file mode 100644 index 00000000000..85c920ba462 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py @@ -0,0 +1,55 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._remove import Remove as _WatcherConnectionMonitorEndpointRemove +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorEndpointRemove(_WatcherConnectionMonitorEndpointRemove): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + args_schema.test_groups = AAZListArg( + options=["--test-groups"], + help="Space-separated list of names of test group which only need to " + "be affected if specified.", + arg_group="V2 Test Group", + ) + args_schema.test_groups.Element = AAZStrArg() + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) + + def post_instance_delete(self): + args = self.ctx.args + instance = self.ctx.vars.instance + name = args.endpoint_name.to_serialized_data() + # refresh test groups + + temp_test_groups = instance.properties.test_groups + if has_value(args.test_groups): + temp_test_groups = [t for t in instance.properties.test_groups + if t.name.to_serialized_data() in args.test_groups] + + for test_group in temp_test_groups: + test_group.sources = [tc for tc in test_group.sources if tc != name] + test_group.destinations = [tc for tc in test_group.destinations if tc != name] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py new file mode 100644 index 00000000000..179f867b9d3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._show import Show as _WatcherConnectionMonitorEndpointShow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorEndpointShow(_WatcherConnectionMonitorEndpointShow): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py new file mode 100644 index 00000000000..6b9eaeffe0b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py @@ -0,0 +1,38 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.output._add import Add as _WatcherConnectionMonitorOutputAdd +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorOutputAdd(_WatcherConnectionMonitorOutputAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.output_type._required = True + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.output_type) and not has_value(args.workspace_id): + raise ValidationError('usage error: --type is specified but no other resource id provided') + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py new file mode 100644 index 00000000000..c32e5806424 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.output._list import List as _WatcherConnectionMonitorOutputList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorOutputList(_WatcherConnectionMonitorOutputList): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py new file mode 100644 index 00000000000..bea213f07f7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py @@ -0,0 +1,64 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._add import Add as _MonitorTestConfigurationAdd +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestConfigurationAdd(_MonitorTestConfigurationAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + args_schema.http_request_headers._registered = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + args_schema.http_request_header = AAZDictArg( + options=["--http-request-header"], + help="The HTTP headers to transmit with the request. List of property=value pairs to define HTTP headers.", + arg_group="HTTP Protocol", + ) + args_schema.http_request_header.Element = AAZStrArg() + + args_schema.test_groups = AAZListArg( + options=["--test-groups"], + help="Space-separated list of names of test group which only need to be affected if specified.", + required=True, + ) + args_schema.test_groups.Element = AAZStrArg() + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) + + def pre_instance_create(self): + args = self.ctx.args + name = args.test_configuration_name.to_serialized_data() + + if has_value(args.http_request_header): + for tmp_name, val in args.http_request_header.items(): + args.http_request_headers.append({ + "name": tmp_name, + "value": val, + }) + + instance = self.ctx.vars.instance + if has_value(args.test_groups): + for test_group in instance.properties.test_groups: + if test_group.name.to_serialized_data() in args.test_groups: + test_group.test_configurations.append(name) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py new file mode 100644 index 00000000000..5092660b0e1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._list import List as _MonitorTestConfigurationList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestConfigurationList(_MonitorTestConfigurationList): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py new file mode 100644 index 00000000000..8db67469ba2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._remove import Remove as _MonitorTestConfigurationRemove +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestConfigurationRemove(_MonitorTestConfigurationRemove): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + args_schema.test_groups = AAZListArg( + options=["--test-groups"], + help="Space-separated list of names of test group which only need to " + "be affected if specified.", + ) + args_schema.test_groups.Element = AAZStrArg() + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) + + def post_instance_delete(self): + args = self.ctx.args + instance = self.ctx.vars.instance + name = args.test_configuration_name.to_serialized_data() + + # refresh test groups + temp_test_groups = instance.properties.test_groups + if has_value(args.test_groups): + temp_test_groups = [t for t in instance.properties.test_groups + if t.name.to_serialized_data() in args.test_groups] + + for test_group in temp_test_groups: + test_group.test_configurations = [tc for tc in test_group.test_configurations if tc != name] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py new file mode 100644 index 00000000000..3ce3b5fbef5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._show import Show as _MonitorTestConfigurationShow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestConfigurationShow(_MonitorTestConfigurationShow): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py new file mode 100644 index 00000000000..0efd23a021c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py @@ -0,0 +1,232 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_group._add import Add as _WatcherConnectionMonitorTestGroupAdd +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestGroupAdd(_WatcherConnectionMonitorTestGroupAdd): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.destinations._registered = False + args_schema.destinations._required = False + args_schema.sources._registered = False + args_schema.sources._required = False + args_schema.test_configurations._registered = False + args_schema.test_configurations._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + # V2 Endpoint + args_schema.endpoint_dest_name = AAZStrArg( + options=["--endpoint-dest-name"], + help="The name of the destination of connection monitor endpoint. " + "If you are creating a V2 Connection Monitor, it's required.", + arg_group="V2 Endpoint", + required=True + ) + args_schema.endpoint_source_name = AAZStrArg( + options=["--endpoint-source-name"], + help="The name of the source of connection monitor endpoint. " + "If you are creating a V2 Connection Monitor, it's required.", + arg_group="V2 Endpoint", + required=True + ) + args_schema.endpoint_dest_address = AAZStrArg( + options=["--endpoint-dest-address"], + help="Address of the destination of connection monitor endpoint (IP or domain name)", + arg_group="V2 Endpoint", + ) + args_schema.endpoint_dest_resource_id = AAZStrArg( + options=["--endpoint-dest-resource-id"], + help="Resource ID of the destination of connection monitor endpoint.", + arg_group="V2 Endpoint", + ) + args_schema.endpoint_source_address = AAZStrArg( + options=["--endpoint-source-address"], + help="Address of the source of connection monitor endpoint (IP or domain name).", + arg_group="V2 Endpoint", + ) + args_schema.endpoint_source_resource_id = AAZStrArg( + options=["--endpoint-source-resource-id"], + help="Resource ID of the source of connection monitor endpoint. " + "If endpoint is intended to used as source, this option is required.", + arg_group="V2 Endpoint", + ) + + # V2 Test Configuration + args_schema.test_config_name = AAZStrArg( + options=["--test-config-name"], + help="The name of the connection monitor test configuration. " + "If you are creating a V2 Connection Monitor, it's required.", + arg_group="V2 Test Configuration", + required=True + ) + args_schema.test_config_frequency = AAZStrArg( + options=["--frequency"], + help="The frequency of test evaluation, in seconds. Default: 60.", + arg_group="V2 Test Configuration", + ) + args_schema.test_config_http_method = AAZStrArg( + options=["--http-method"], + help="The HTTP method to use.", + arg_group="V2 Test Configuration", + enum={"Get": "Get", "Post": "Post"}, + ) + args_schema.test_config_http_path = AAZStrArg( + options=["--http-path"], + help='The path component of the URI. For instance, "/dir1/dir2".', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_http_port = AAZIntArg( + options=["--http-port"], + help='The port to connect to.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_http_valid_status_codes = AAZListArg( + options=["--http-valid-status-codes"], + help="Space-separated list of HTTP status codes to consider successful. For instance, '2xx 301-304 418'", + arg_group="V2 Test Configuration" + ) + args_schema.test_config_http_valid_status_codes.Element = AAZStrArg() + + args_schema.test_config_http_prefer_https = AAZBoolArg( + options=["--https-prefer"], + help='Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. ' + ' Allowed values: false, true.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_icmp_disable_trace_route = AAZBoolArg( + options=["--icmp-disable-trace-route"], + help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' + ' Allowed values: false, true.', + arg_group="V2 Test Configuration", + ) + + args_schema.test_config_preferred_ip_version = AAZStrArg( + options=["--preferred-ip-version"], + help='The preferred IP version to use in test evaluation. ' + 'The connection monitor may choose to use a different version depending on other parameters.', + arg_group="V2 Test Configuration", + enum={"IPv4": "IPv4", "IPv6": "IPv6"}, + ) + args_schema.test_config_protocol = AAZStrArg( + options=["--protocol"], + help='The protocol to use in test evaluation.', + arg_group="V2 Test Configuration", + enum={"Http": "Http", "Icmp": "Icmp", "Tcp": "Tcp"}, + ) + + args_schema.test_config_tcp_disable_trace_route = AAZBoolArg( + options=["--tcp-disable-trace-route"], + help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' + 'Allowed values: false, true.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_tcp_port = AAZIntArg( + options=["--tcp-port"], + help='The port to connect to.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_threshold_failed_percent = AAZIntArg( + options=["--threshold-failed-percent"], + help='The maximum percentage of failed checks permitted for a test to evaluate as successful.', + arg_group="V2 Test Configuration", + ) + args_schema.test_config_threshold_round_trip_time = AAZFloatArg( + options=["--threshold-round-trip-time"], + help='The maximum round-trip time in milliseconds permitted for a test to evaluate as successful.', + arg_group="V2 Test Configuration", + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) + + # pylint: disable=too-many-boolean-expressions + def pre_instance_create(self): + args = self.ctx.args + instance = self.ctx.vars.instance + + # deal with endpoint + if has_value(args.endpoint_source_address) or has_value(args.endpoint_source_resource_id): + src_endpoint = { + "name": args.endpoint_source_name, + "resource_id": args.endpoint_source_resource_id, + "address": args.endpoint_source_address + } + instance.properties.endpoints.append(src_endpoint) + if has_value(args.endpoint_dest_address) or has_value(args.endpoint_dest_resource_id): + dst_endpoint = { + "name": args.endpoint_dest_name, + "resource_id": args.endpoint_dest_resource_id, + "address": args.endpoint_dest_address + } + instance.properties.endpoints.append(dst_endpoint) + + args.sources.append(args.endpoint_source_name) + args.destinations.append(args.endpoint_dest_name) + + # deal with test configuration + if has_value(args.test_config_protocol) or has_value(args.test_config_preferred_ip_version) or \ + has_value(args.test_config_threshold_failed_percent) or \ + has_value(args.test_config_threshold_round_trip_time) or \ + has_value(args.test_config_tcp_disable_trace_route) or has_value(args.test_config_tcp_port) or \ + has_value(args.test_config_icmp_disable_trace_route) or \ + has_value(args.test_config_http_port) or has_value(args.test_config_http_method) or \ + has_value(args.test_config_http_path) or has_value(args.test_config_http_valid_status_codes) or \ + has_value(args.test_config_http_prefer_https): + test_config = { + "name": args.test_config_name, + "test_frequency_sec": args.test_config_frequency, + "protocol": args.test_config_protocol, + "preferred_ip_version": args.test_config_preferred_ip_version, + } + if has_value(args.test_config_threshold_failed_percent) or \ + has_value(args.test_config_threshold_round_trip_time): + test_config['success_threshold'] = { + "checks_failed_percent": args.test_config_threshold_failed_percent, + "round_trip_time_ms": args.test_config_threshold_round_trip_time + } + if args.test_config_protocol == "Tcp": + tcp_config = { + "port": args.test_config_tcp_port, + "disable_trace_route": args.test_config_tcp_disable_trace_route, + } + test_config['tcp_configuration'] = tcp_config + elif args.test_config_protocol == "Icmp": + icmp_config = {"disable_trace_route": args.test_config_icmp_disable_trace_route} + test_config['icmp_configuration'] = icmp_config + elif args.test_config_protocol == "Http": + http_config = { + "port": args.test_config_http_port, + "method": args.test_config_http_method, + "path": args.test_config_http_path, + "valid_status_code_ranges": args.test_config_http_valid_status_codes, + "prefer_https": args.test_config_http_prefer_https, + } + test_config['http_configuration'] = http_config + else: + raise ValidationError('Unsupported protocol: "{}" for test configuration'.format( + args.test_config_protocol)) + instance.properties.test_configurations.append(test_config) + args.test_configurations.append(args.test_config_name) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py new file mode 100644 index 00000000000..45cb00b96b8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_group._list import List as _WatcherConnectionMonitorTestGroupList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestGroupList(_WatcherConnectionMonitorTestGroupList): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py new file mode 100644 index 00000000000..562b61c1f5b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_group._show import Show as _WatcherConnectionMonitorTestGroupShow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class WatcherConnectionMonitorTestGroupShow(_WatcherConnectionMonitorTestGroupShow): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_rg._required = False + + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location. Values from: `az account list-locations`. " + "You can configure the default location " + "using `az configure --defaults location=`.", + required=True, + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py new file mode 100644 index 00000000000..1ba6b42e630 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py @@ -0,0 +1,147 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from knack.util import CLIError +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.commands.arm import get_arm_resource_by_id +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network._validators import validate_managed_identity_resource_id +from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._create import Create as _NwFlowLogCreate +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class NwFlowLogCreate(_NwFlowLogCreate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group._required = False + args_schema.location._required = True + args_schema.flow_analytics_configuration._registered = False + args_schema.retention_policy._registered = False + args_schema.target_resource_id._registered = False + args_schema.traffic_analytics_interval = AAZIntArg( + options=['--interval'], arg_group="Traffic Analytics", + help="Interval in minutes at which to conduct flow analytics. Temporarily allowed values are 10 and 60.", + default=60, + fmt=AAZIntArgFormat( + maximum=60, + minimum=10, + ) + ) + args_schema.user_assigned_identity = AAZResourceIdArg( + options=["--user-assigned-identity"], + help="Name or ID of the ManagedIdentity Resource.", + required=False, + ) + args_schema.retention = AAZIntArg( + options=['--retention'], + help="Number of days to retain logs.", + ) + args_schema.traffic_analytics_enabled = AAZBoolArg( + options=['--traffic-analytics'], arg_group="Traffic Analytics", + help="Enable traffic analytics. Defaults to true if `--workspace` is provided." + ) + args_schema.traffic_analytics_workspace = AAZResourceIdArg( + options=['--workspace'], arg_group="Traffic Analytics", + help="Name or ID of a Log Analytics workspace. Must be in the same region of flow log", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.OperationalInsights/workspaces/{}" + ) + ) + args_schema.vnet = AAZResourceIdArg( + options=['--vnet'], + help="Name or ID of the Virtual Network Resource.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + ) + args_schema.subnet = AAZResourceIdArg( + options=['--subnet'], + help="Name or ID of Subnet.", + ) + args_schema.nic = AAZResourceIdArg( + options=['--nic'], + help="Name or ID of the Network Interface (NIC) Resource.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkInterfaces/{}" + ) + ) + args_schema.nsg = AAZResourceIdArg( + options=['--nsg'], + help="Name or ID of the network security group.", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkSecurityGroups/{}" + ) + ) + args_schema.storage_account._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Storage/storageAccounts/{}" + ) + + return args_schema + + def pre_operations(self): + args = self.ctx.args + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group') + if has_value(args.subnet): + subnet = args.subnet.to_serialized_data() + if not is_valid_resource_id(subnet) and has_value(args.vnet): + args.subnet = args.vnet.to_serialized_data() + "/subnets/" + subnet + + if not has_value(args.enabled): + args.enabled = True + if sum(map(bool, [args.vnet, args.subnet, args.nic, args.nsg])) == 0: + raise RequiredArgumentMissingError("Please enter atleast one target resource ID.") + if sum(map(bool, [args.vnet, args.nic, args.nsg])) > 1: + raise MutuallyExclusiveArgumentError("Please enter only one target resource ID.") + + if has_value(args.subnet): + args.target_resource_id = args.subnet + elif has_value(args.vnet) and not has_value(args.subnet): + args.target_resource_id = args.vnet + elif has_value(args.nic): + args.target_resource_id = args.nic + elif has_value(args.nsg): + args.target_resource_id = args.nsg + + if has_value(args.user_assigned_identity): + user_assigned_identity = args.user_assigned_identity.to_serialized_data() + is_valid_miresource_id = validate_managed_identity_resource_id(user_assigned_identity) + if not is_valid_miresource_id: + raise CLIError('Managed Identity resource id is invalid') + if user_assigned_identity.lower() != 'none': + args.identity = { + "type": "UserAssigned", + "user_assigned_identities": {user_assigned_identity: {}} + } + else: + args.identity = { + "type": "None" + } + + if has_value(args.retention): + if args.retention > 0: + args.retention_policy = {"days": args.retention, "enabled": True} + + if has_value(args.traffic_analytics_workspace): + + workspace = get_arm_resource_by_id(self.cli_ctx, args.traffic_analytics_workspace.to_serialized_data()) + if not workspace: + raise CLIError('Name or ID of workspace is invalid') + + args.flow_analytics_configuration = {"workspace_id": workspace.properties['customerId'], + "workspace_region": workspace.location, + "workspace_resource_id": workspace.id} + if has_value(args.traffic_analytics_enabled): + args.flow_analytics_configuration['enabled'] = args.traffic_analytics_enabled + if has_value(args.traffic_analytics_interval): + args.flow_analytics_configuration['traffic_analytics_interval'] = args.traffic_analytics_interval diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py new file mode 100644 index 00000000000..e5f02cd07ca --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._delete import Delete as _NwFlowLogDelete +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class NwFlowLogDelete(_NwFlowLogDelete): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group._registered = False + args_schema.resource_group._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location to identify the exclusive Network Watcher under a region. " + "Only one Network Watcher can be existed per subscription and region.", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group') diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py new file mode 100644 index 00000000000..7f294384c63 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._list import List as _NwFlowLogList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class NwFlowLogList(_NwFlowLogList): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group._registered = False + args_schema.resource_group._required = False + args_schema.location = AAZResourceLocationArg( + options=["-l", "--location"], + help="Location to identify the exclusive Network Watcher under a region. " + "Only one Network Watcher can be existed per subscription and region.", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group') diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py new file mode 100644 index 00000000000..f0a2eacd1d8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py @@ -0,0 +1,146 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from knack.util import CLIError +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.commands.arm import get_arm_resource_by_id +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network._validators import validate_managed_identity_resource_id +from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._update import Update as _NwFlowLogUpdate +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class NwFlowLogUpdate(_NwFlowLogUpdate): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.network_watcher_name._registered = False + args_schema.network_watcher_name._required = False + args_schema.resource_group._required = False + args_schema.location._required = True + args_schema.flow_analytics_configuration._registered = False + args_schema.retention_policy._registered = False + args_schema.target_resource_id._registered = False + args_schema.retention = AAZIntArg( + options=['--retention'], + help="Number of days to retain logs.", + nullable=True, + ) + args_schema.traffic_analytics_interval = AAZIntArg( + options=['--interval'], arg_group="Traffic Analytics", + help="Interval in minutes at which to conduct flow analytics. Temporarily allowed values are 10 and 60.", + nullable=True, + fmt=AAZIntArgFormat( + maximum=60, + minimum=10, + ) + ) + args_schema.user_assigned_identity = AAZResourceIdArg( + options=["--user-assigned-identity"], + help="Name or ID of the ManagedIdentity Resource.", + required=False, + ) + args_schema.traffic_analytics_enabled = AAZBoolArg( + options=['--traffic-analytics'], arg_group="Traffic Analytics", nullable=True, + help="Enable traffic analytics. Defaults to true if `--workspace` is provided." + ) + args_schema.traffic_analytics_workspace = AAZResourceIdArg( + options=['--workspace'], arg_group="Traffic Analytics", nullable=True, + help="Name or ID of a Log Analytics workspace. Must be in the same region of flow log", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.OperationalInsights/workspaces/{}" + ) + ) + args_schema.vnet = AAZResourceIdArg( + options=['--vnet'], + help="Name or ID of the Virtual Network Resource.", + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" + ) + ) + args_schema.subnet = AAZResourceIdArg( + options=['--subnet'], + help="Name or ID of Subnet.", + nullable=True, + ) + args_schema.nic = AAZResourceIdArg( + options=['--nic'], + help="Name or ID of the Network Interface (NIC) Resource.", + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkInterfaces/{}" + ) + ) + args_schema.nsg = AAZResourceIdArg( + options=['--nsg'], + help="Name or ID of the network security group.", + nullable=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkSecurityGroups/{}" + ) + ) + args_schema.storage_account._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Storage/storageAccounts/{}" + ) + + return args_schema + + def pre_operations(self): + args = self.ctx.args + get_network_watcher_from_location(self, + watcher_name='network_watcher_name', + rg_name='resource_group') + if has_value(args.subnet): + subnet = args.subnet.to_serialized_data() + if not is_valid_resource_id(subnet) and has_value(args.vnet): + args.subnet = args.vnet.to_serialized_data() + "/subnets/" + subnet + + if sum(map(bool, [args.vnet, args.nic, args.nsg])) > 1: + raise MutuallyExclusiveArgumentError("Please enter only one target resource ID.") + if has_value(args.subnet): + args.target_resource_id = args.subnet + elif has_value(args.vnet) and not has_value(args.subnet): + args.target_resource_id = args.vnet + elif has_value(args.nic): + args.target_resource_id = args.nic + elif has_value(args.nsg): + args.target_resource_id = args.nsg + if has_value(args.retention) and args.retention > 0: + args.retention_policy = {"days": args.retention, "enabled": True} + + if has_value(args.user_assigned_identity): + user_assigned_identity = args.user_assigned_identity.to_serialized_data() + is_valid_miresource_id = validate_managed_identity_resource_id(user_assigned_identity) + if not is_valid_miresource_id: + raise CLIError('Managed Identity resource id is invalid') + if user_assigned_identity.lower() != 'none': + args.identity = { + "type": "UserAssigned", + "user_assigned_identities": {user_assigned_identity: {}} + } + else: + args.identity = { + "type": "None" + } + + if has_value(args.traffic_analytics_workspace): + workspace = get_arm_resource_by_id(self.cli_ctx, args.traffic_analytics_workspace.to_serialized_data()) + if not workspace: + raise CLIError('Name or ID of workspace is invalid') + + args.flow_analytics_configuration = { + "workspace_id": workspace.properties['customerId'], + "workspace_region": workspace.location, + "workspace_resource_id": workspace.id + } + if has_value(args.traffic_analytics_enabled): + args.flow_analytics_configuration['enabled'] = args.traffic_analytics_enabled + if has_value(args.traffic_analytics_interval): + args.flow_analytics_configuration['traffic_analytics_interval'] = args.traffic_analytics_interval diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py new file mode 100644 index 00000000000..0bb9a2ec398 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py @@ -0,0 +1,70 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._create import Create as _PacketCaptureCreate +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm, get_network_watcher_from_vmss + + +class PacketCaptureCreate(_PacketCaptureCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of the resource group the target resource is in.", + required=True, + ) + args_schema.vm = AAZResourceIdArg( + options=["--vm"], + help="Name or ID of the VM to target", + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" + "/virtualMachines/{}", + ), + ) + args_schema.target._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" + "/virtualMachineScaleSets/{}", + ) + args_schema.storage_account._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage" + "/storageAccounts/{}", + ) + args_schema.target._required = False + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if has_value(args.target_type) and args.target_type.to_serialized_data().lower() == "azurevmss": + get_network_watcher_from_vmss(self) + else: + # set the appropriate fields if target is vm + get_network_watcher_from_vm(self) + args.target = args.vm + args.include, args.exclude = None, None + + storage_usage = ValidationError("usage error: --storage-account NAME_OR_ID [--storage-path PATH] [--file-path PATH] | --file-path PATH") + if not has_value(args.storage_account) and (has_value(args.storage_path) or not has_value(args.file_path)): + raise storage_usage + + if has_value(args.file_path): + path = args.file_path.to_serialized_data() + if not path.endswith(".cap"): + raise ValidationError("usage error: --file-path PATH must end with the '*.cap' extension") + + if not path.startswith("/"): + path = path.replace("/", "\\") + args.file_path = path diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py new file mode 100644 index 00000000000..5d220aecdc1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._delete import Delete as _PacketCaptureDelete +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class PacketCaptureDelete(_PacketCaptureDelete): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + required=True, + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py new file mode 100644 index 00000000000..ec22fcf42cb --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._list import List as _PacketCaptureList +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class PacketCaptureList(_PacketCaptureList): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + required=True, + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py new file mode 100644 index 00000000000..5bea51f5c95 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._show import Show as _PacketCaptureShow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class PacketCaptureShow(_PacketCaptureShow): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + required=True, + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py new file mode 100644 index 00000000000..7dbde9cc249 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._show_status import ShowStatus as _PacketCaptureShowStatus +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class PacketCaptureShowStatus(_PacketCaptureShowStatus): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + required=True, + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py new file mode 100644 index 00000000000..3983c332921 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._stop import Stop as _PacketCaptureStop +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location + + +class PacketCaptureStop(_PacketCaptureStop): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.location = AAZResourceLocationArg( + required=True, + ) + args_schema.watcher_rg._required = False + args_schema.watcher_rg._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_name._registered = False + return args_schema + + def pre_operations(self): + get_network_watcher_from_location(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/__init__.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py new file mode 100644 index 00000000000..afc425cb516 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.troubleshooting._show import Show as _NwTroubleshootingShow +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_resource + + +class NwTroubleshootingShow(_NwTroubleshootingShow): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._required = False + args_schema.target_resource_id._registered = False + args_schema.target_resource_id._required = False + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + ) + args_schema.resource_type = AAZStrArg( + options=["-t", "--resource-type"], + help="The resource type.", + enum={"vnetGateway": "virtualNetworkGateways", "vpnConnection": "connections"}, + ) + args_schema.resource = AAZResourceIdArg( + options=["--resource"], + help="Name or ID of the resource to troubleshoot.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/{resource_type}/{}" + ) + ) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + get_network_watcher_from_resource(self) + if has_value(args.resource): + args.target_resource_id = args.resource diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py new file mode 100644 index 00000000000..9d58f735298 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py @@ -0,0 +1,57 @@ +# -------------------------------------------------------------------------------------------- +# 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, protected-access, too-few-public-methods + +from knack.util import CLIError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.command_modules.network.aaz.latest.network.watcher.troubleshooting._start import Start as _NwTroubleshootingStart +from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_resource + + +class NwTroubleshootingStart(_NwTroubleshootingStart): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.watcher_name._registered = False + args_schema.watcher_name._required = False + args_schema.watcher_rg._required = False + args_schema.target_resource_id._registered = False + args_schema.target_resource_id._required = False + args_schema.resource_group_name = AAZStrArg( + options=["-g", "--resource-group"], + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + ) + args_schema.resource_type = AAZStrArg( + options=["-t", "--resource-type"], + help="The type of target resource to troubleshoot, if resource ID is not specified.", + enum={"vnetGateway": "virtualNetworkGateways", "vpnConnection": "connections"}, + ) + args_schema.resource = AAZResourceIdArg( + options=["--resource"], + help="Name or ID of the resource to troubleshoot.", + required=True, + fmt=AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/{resource_type}/{}" + ) + ) + args_schema.storage_account._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{}" + ) + args_schema.location = AAZResourceLocationArg( + registered=False, + ) + + return args_schema + + def pre_operations(self): + args = self.ctx.args + storage_usage = CLIError('usage error: --storage-account NAME_OR_ID [--storage-path PATH]') + if has_value(args.storage_path) and not has_value(args.storage_account): + raise storage_usage + if has_value(args.resource): + args.target_resource_id = args.resource + get_network_watcher_from_resource(self) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py b/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py deleted file mode 100644 index 0fc57f6eeeb..00000000000 --- a/src/azure-cli/azure/cli/command_modules/network/operations/load_balancer.py +++ /dev/null @@ -1,1251 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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, protected-access, too-few-public-methods -from knack.log import get_logger -from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, \ - AAZStrArg, AAZArgEnum -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id -from ..aaz.latest.network.lb._delete import Delete as _LBDelete -from ..aaz.latest.network.lb._update import Update as _LBUpdate -from ..aaz.latest.network.lb._list import List as _LBList -from ..aaz.latest.network.lb._show import Show as _LBShow -from ..aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate -from ..aaz.latest.network.lb.frontend_ip._update import Update as _LBFrontendIPUpdate -from ..aaz.latest.network.lb.frontend_ip._show import Show as _LBFrontendIPShow -from ..aaz.latest.network.lb.frontend_ip._delete import Delete as _LBFrontendIPDelete -from ..aaz.latest.network.lb.frontend_ip._list import List as _LBFrontendIPList -from ..aaz.latest.network.lb.inbound_nat_pool._create import Create as _LBInboundNatPoolCreate -from ..aaz.latest.network.lb.inbound_nat_pool._update import Update as _LBInboundNatPoolUpdate -from ..aaz.latest.network.lb.inbound_nat_rule._create import Create as _LBInboundNatRuleCreate -from ..aaz.latest.network.lb.inbound_nat_rule._update import Update as _LBInboundNatRuleUpdate -from ..aaz.latest.network.lb.rule._create import Create as _LBRuleCreate -from ..aaz.latest.network.lb.rule._update import Update as _LBRuleUpdate -from ..aaz.latest.network.lb.rule._show import Show as _LBRuleShow -from ..aaz.latest.network.lb.rule._delete import Delete as _LBRuleDelete -from ..aaz.latest.network.lb.rule._list import List as _LBRuleList -from ..aaz.latest.network.lb.outbound_rule._create import Create as _LBOutboundRuleCreate -from ..aaz.latest.network.lb.outbound_rule._update import Update as _LBOutboundRuleUpdate -from ..aaz.latest.network.lb.address_pool._create import Create as _LBAddressPoolCreate -from ..aaz.latest.network.lb.address_pool._update import Update as _LBAddressPoolUpdate -from ..aaz.latest.network.lb.address_pool._show import Show as _LBAddressPoolShow -from ..aaz.latest.network.lb.address_pool._delete import Delete as _LBAddressPoolDelete -from ..aaz.latest.network.lb.address_pool._list import List as _LBAddressPoolList -from ..aaz.latest.network.lb.address_pool.address._add import Add as _LBAddressPoolAddressAdd -from ..aaz.latest.network.lb.address_pool.address._update import Update as _LBAddressPoolAddressUpdate -from ..aaz.latest.network.lb.address_pool.address._show import Show as _LBAddressPoolAddressShow -from ..aaz.latest.network.lb.address_pool.address._remove import Remove as _LBAddressPoolAddressRemove -from ..aaz.latest.network.lb.address_pool.address._list import List as _LBAddressPoolAddressList -from ..aaz.latest.network.lb.address_pool.basic._create import Create as _LBAddressPoolBasicCreate -from ..aaz.latest.network.lb.address_pool.basic._delete import Delete as _LBAddressPoolBasicDelete -from ..aaz.latest.network.lb.address_pool.tunnel_interface._add import Add as _LBAddressPoolTunnelInterfaceAdd -from ..aaz.latest.network.lb.address_pool.tunnel_interface._update import Update as _LBAddressPoolTunnelInterfaceUpdate -from ..aaz.latest.network.lb.probe._create import Create as _LBProbeCreate -from ..aaz.latest.network.lb.probe._update import Update as _LBProbeUpdate - - -logger = get_logger(__name__) - - -class LBFrontendIPCreate(_LBFrontendIPCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - arg_group="Properties", - options=['--vnet-name'], - help="The virtual network (VNet) associated with the subnet (Omit if supplying a subnet id)." - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}", - ) - args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", - ) - args_schema.gateway_lb._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" - ) - - args_schema.zones.Element.enum = AAZArgEnum({ - "1": "1", - "2": "2", - "3": "3", - }) - args_schema.private_ip_allocation_method._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.subnet) and has_value(args.public_ip_address): - raise ArgumentUsageError( - 'incorrect usage: --subnet NAME --vnet-name NAME | ' - '--subnet ID | --public-ip-address NAME_OR_ID') - - if not has_value(args.public_ip_address): - logger.warning( - "Please note that the default public IP used for LB frontend will be changed from Basic to Standard " - "in the future." - ) - - if has_value(args.private_ip_address): - args.private_ip_allocation_method = 'Static' - else: - args.private_ip_allocation_method = 'Dynamic' - - -class LBFrontendIPUpdate(_LBFrontendIPUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet_name = AAZStrArg( - arg_group="Properties", - options=['--vnet-name'], - help="The virtual network (VNet) associated with the subnet (Omit if supplying a subnet id)." - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}", - ) - args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", - ) - args_schema.gateway_lb._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" - ) - - args_schema.zones.Element.enum = AAZArgEnum({ - "1": "1", - "2": "2", - "3": "3", - }) - args_schema.private_ip_allocation_method._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.private_ip_address): - # update private_ip_address - if args.private_ip_address: - args.private_ip_allocation_method = 'Static' - else: - # set private_ip_address as null value - args.private_ip_allocation_method = 'Dynamic' - - def post_instance_update(self, instance): - if not has_value(instance.properties.subnet.id): - instance.properties.subnet = None - if not has_value(instance.properties.public_ip_address.id): - instance.properties.public_ip_address = None - if not has_value(instance.properties.public_ip_prefix.id): - instance.properties.public_ip_prefix = None - if not has_value(instance.properties.gateway_load_balancer.id): - instance.properties.gateway_load_balancer = None - - -class LBInboundNatPoolCreate(_LBInboundNatPoolCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - if not has_value(args.frontend_ip_name): - instance = self.ctx.vars.instance - frontend_ip_configurations = instance.properties.frontend_ip_configurations - if len(frontend_ip_configurations) == 1: - args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id - elif len(frontend_ip_configurations) > 1: - raise ArgumentUsageError("Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") - - -class LBInboundNatPoolUpdate(_LBInboundNatPoolUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - return args_schema - - def post_instance_update(self, instance): - if not has_value(instance.properties.frontend_ip_configuration.id): - instance.properties.frontend_ip_configuration = None - - -class LBInboundNatRuleCreate(_LBInboundNatRuleCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ) - - # required for a public load balancer - args_schema.protocol._required = True - args_schema.backend_port._required = True - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - if not has_value(args.frontend_ip_name): - instance = self.ctx.vars.instance - frontend_ip_configurations = instance.properties.frontend_ip_configurations - if len(frontend_ip_configurations) == 1: - args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id - elif len(frontend_ip_configurations) > 1: - raise ArgumentUsageError("Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") - - -class LBInboundNatRuleUpdate(_LBInboundNatRuleUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ) - return args_schema - - def post_instance_update(self, instance): - if not has_value(instance.properties.frontend_ip_configuration.id): - instance.properties.frontend_ip_configuration = None - if not has_value(instance.properties.backend_address_pool.id): - instance.properties.backend_address_pool = None - - -class LBRuleCreate(_LBRuleCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - args_schema.probe_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" - ) - # list argument accept one element: `--backend-pool-name PoolName` - args_schema.backend_pools = AAZListArg( - options=["--backend-pools-name", "--backend-pool-name"], - arg_group="Properties", - help="List of ID or name of the backend address pools. Multiple pools are only supported by Gateway SKU load balancer. If only one exists, omit to use as default." - ) - args_schema.backend_pools.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ) - ) - - args_schema.protocol._required = True - args_schema.frontend_port._required = True - args_schema.backend_port._required = True - args_schema.backend_address_pools._registered = False - return args_schema - - def pre_instance_create(self): - from azure.cli.core.aaz.utils import assign_aaz_list_arg - args = self.ctx.args - if not has_value(args.frontend_ip_name): - instance = self.ctx.vars.instance - frontend_ip_configurations = instance.properties.frontend_ip_configurations - if len(frontend_ip_configurations) == 1: - args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id - elif len(frontend_ip_configurations) > 1: - raise ArgumentUsageError( - "Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") - if not has_value(args.backend_pools): - instance = self.ctx.vars.instance - backend_address_pools = instance.properties.backend_address_pools - if len(backend_address_pools) == 1: - args.backend_pools = [instance.properties.backend_address_pools[0].id] - elif len(backend_address_pools) > 1: - raise ArgumentUsageError( - "Multiple BackendAddressPools found in loadbalancer. Specify --backend-pool-name explicitly.") - args.backend_address_pools = assign_aaz_list_arg( - args.backend_address_pools, args.backend_pools, - element_transformer=lambda _, id: {"id": id} - ) - - def post_instance_create(self, instance): - args = self.ctx.args - if has_value(args.frontend_ip_name): - curr_id = args.frontend_ip_name.to_serialized_data() - curr_name = parse_resource_id(curr_id)["resource_name"] if is_valid_resource_id(curr_id) else curr_id - - parent = self.ctx.vars.instance - frontend_ip_configurations = parent.properties.frontend_ip_configurations - for fip in frontend_ip_configurations: - if fip.name == curr_name: - if has_value(fip.properties.gateway_load_balancer): - rid = fip.properties.gateway_load_balancer.id.to_serialized_data() - self.ctx.update_aux_subscriptions(parse_resource_id(rid)["subscription"]) - - -class LBRuleUpdate(_LBRuleUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - args_schema.probe_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" - ) - - args_schema.backend_pools = AAZListArg( - options=["--backend-pools-name", "--backend-pool-name"], - nullable=True, - arg_group="Properties", - help="List of ID or name of the backend address pools. Multiple pools are only supported by Gateway SKU load balancer." - ) - - args_schema.backend_pools.Element = AAZResourceIdArg( - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ) - ) - - args_schema.protocol._nullable = False - args_schema.frontend_port._nullable = False - args_schema.backend_port._nullable = False - args_schema.backend_address_pools._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz.utils import assign_aaz_list_arg - args = self.ctx.args - args.backend_address_pools = assign_aaz_list_arg( - args.backend_address_pools, args.backend_pools, - element_transformer=lambda _, id: {"id": id} - ) - - def post_instance_update(self, instance): - if not has_value(instance.properties.frontend_ip_configuration.id): - instance.properties.frontend_ip_configuration = None - if not has_value(instance.properties.probe.id): - instance.properties.probe = None - # always remove backend_address_pool in update request, service will fill this property based on backend_address_pools property. - instance.properties.backend_address_pool = None - - args = self.ctx.args - if has_value(args.frontend_ip_name): - curr_id = args.frontend_ip_name.to_serialized_data() - curr_name = parse_resource_id(curr_id)["resource_name"] if is_valid_resource_id(curr_id) else curr_id - - parent = self.ctx.vars.instance - frontend_ip_configurations = parent.properties.frontend_ip_configurations - for fip in frontend_ip_configurations: - if fip.name == curr_name: - if has_value(fip.properties.gateway_load_balancer): - rid = fip.properties.gateway_load_balancer.id.to_serialized_data() - self.ctx.update_aux_subscriptions(parse_resource_id(rid)["subscription"]) - - -class LBOutboundRuleCreate(_LBOutboundRuleCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ) - args_schema.frontend_ip_configs = AAZListArg( - options=["--frontend-ip-configs"], - arg_group="Properties", - help="The List of frontend IP configuration IDs or names.", - ) - args_schema.frontend_ip_configs.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - ) - - args_schema.protocol._required = True - args_schema.backend_address_pool._required = True - args_schema.frontend_ip_configurations._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz.utils import assign_aaz_list_arg - args = self.ctx.args - args.frontend_ip_configurations = assign_aaz_list_arg( - args.frontend_ip_configurations, - args.frontend_ip_configs, - element_transformer=lambda _, id: {"id": id} - ) - - -class LBOutboundRuleUpdate(_LBOutboundRuleUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.backend_address_pool._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ) - args_schema.frontend_ip_configs = AAZListArg( - options=["--frontend-ip-configs"], - arg_group="Properties", - help="The List of frontend IP configuration IDs or names.", - ) - args_schema.frontend_ip_configs.Element = AAZResourceIdArg( - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - ) - - args_schema.protocol._nullable = False - args_schema.backend_address_pool._nullable = False - args_schema.frontend_ip_configurations._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz.utils import assign_aaz_list_arg - args = self.ctx.args - args.frontend_ip_configurations = assign_aaz_list_arg( - args.frontend_ip_configurations, - args.frontend_ip_configs, - element_transformer=lambda _, id: {"id": id} - ) - - -@register_command("network lb address-pool create") -class LBAddressPoolCreate(_LBAddressPoolBasicCreate): - """Create load balancer backend address pool. - - :example: Create an address pool. - az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool - - :example: Create an address pool with several backend addresses using shorthand syntax arguments. - az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --vnet MyVnetResource --backend-addresses "[{name:addr1,ip-address:10.0.0.1},{name:addr2,ip-address:10.0.0.2,subnet:subnetName}]" - - :example: Create an address pool with several backend addresses using config file - az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses config_file.json - - :example: Create an address pool with one backend address using key-value arguments. - az network lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-address name=addr1 ip-address=10.0.0.1 subnet=/subscriptions/000/resourceGroups/MyRg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet1 - """ - - # inherient the BackendAddressPoolsCreateOrUpdate operation - class LoadBalancerBackendAddressPoolsCreateOrUpdate(_LBAddressPoolCreate.LoadBalancerBackendAddressPoolsCreateOrUpdate): - - def on_200_201(self, session): - # ignore the response data. - pass - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet = AAZResourceIdArg( - options=["--vnet"], - arg_group="Properties", - help="Name or Id of the default virtual network applied to backend addresses in `--backend-addresses`.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - ) - - args_schema.admin_state = AAZStrArg( - options=["--admin-state"], - arg_group="Properties", - help="Default administrative state to backend addresses in `--backend-addresses`.", - ) - args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum - - args_schema.backend_addresses.Element.virtual_network._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - - args_schema.backend_addresses.Element.name._required = True - args_schema.backend_addresses.Element.ip_address._required = True - args_schema.backend_addresses.Element.frontend_ip_address._registered = False - args_schema.vnet_id._registered = False - return args_schema - - def _execute_operations(self): - self.pre_operations() - self.LoadBalancersGet(ctx=self.ctx)() - self.pre_instance_create() - sku = self.ctx.vars.instance.sku.name.to_serialized_data() - if sku.lower() == "basic": - self.InstanceCreateByJson(ctx=self.ctx)() - self.post_instance_create(self.ctx.selectors.subresource.required()) - yield self.LoadBalancersCreateOrUpdate(ctx=self.ctx)() - else: - # use AddressPoolsCreateOrUpdate API to update Standarded or Geteway lb - yield self.LoadBalancerBackendAddressPoolsCreateOrUpdate(ctx=self.ctx)() - self.LoadBalancersGet(ctx=self.ctx)() - self.post_operations() - - def pre_operations(self): - from azure.cli.core.aaz import AAZUndefined - - args = self.ctx.args - if has_value(args.sync_mode) and has_value(args.vnet): - args.vnet_id = args.vnet - args.vnet = AAZUndefined - if has_value(args.backend_addresses): - for backend_address in args.backend_addresses: - if not has_value(backend_address.admin_state) and has_value(args.admin_state): - # use the command level argument --admin-state - backend_address.admin_state = args.admin_state - - virtual_network = backend_address.virtual_network.to_serialized_data() - if not virtual_network and has_value(args.vnet): - # use the command level argument --vnet - virtual_network = args.vnet.to_serialized_data() - backend_address.virtual_network = virtual_network - - subnet = backend_address.subnet.to_serialized_data() - if subnet and not is_valid_resource_id(subnet): - if not virtual_network: - raise ArgumentUsageError( - "Invalid backend address `{}`: vnet name or vnet ID is required when using subnet name only.".format( - backend_address.name) - ) - # convert subnet name to subnet id - subnet = f"{virtual_network}/subnets/{subnet}" - backend_address.subnet = subnet - - if not virtual_network and not subnet: - raise ArgumentUsageError( - "Invalid backend address `{}`: vnet or subnet is required.".format( - backend_address.name) - ) - - def pre_instance_create(self): - args = self.ctx.args - if not has_value(args.tunnel_interfaces): - instance = self.ctx.vars.instance - if has_value(instance.sku.name) and instance.sku.name.to_serialized_data().lower() == 'gateway': - # when sku is 'gateway', 'tunnelInterfaces' can't be None. Otherwise, service will respond error - args.tunnel_interfaces = [{"identifier": 900, "type": 'Internal', "protocol": 'VXLAN'}] - - -class LBAddressPoolUpdate(_LBAddressPoolUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vnet = AAZResourceIdArg( - options=["--vnet"], - arg_group="Properties", - help="Name or Id of the default virtual network applied to backend addresses in `--backend-addresses`.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - ) - args_schema.admin_state = AAZStrArg( - options=["--admin-state"], - arg_group="Properties", - help="Default administrative state to backend addresses in `--backend-addresses`.", - ) - args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum - - args_schema.backend_addresses.Element.virtual_network._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - - args_schema.backend_addresses.Element.name._nullable = False - args_schema.backend_addresses.Element.ip_address._nullable = False - args_schema.backend_addresses.Element.frontend_ip_address._registered = False - args_schema.vnet_id._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz import AAZUndefined - - args = self.ctx.args - if has_value(args.sync_mode) and has_value(args.vnet): - args.vnet_id = args.vnet - args.vnet = AAZUndefined - if has_value(args.backend_addresses) and args.backend_addresses.to_serialized_data() is not None: - for backend_address in args.backend_addresses: - if not has_value(backend_address.admin_state) and has_value(args.admin_state): - # use the command level argument --admin-state - backend_address.admin_state = args.admin_state - if not has_value(backend_address.virtual_network) and has_value(args.vnet): - # use the command level argument --vnet - backend_address.virtual_network = args.vnet - subnet = backend_address.subnet.to_serialized_data() - if subnet and not is_valid_resource_id(subnet): - virtual_network = backend_address.virtual_network.to_serialized_data() - if not virtual_network: - raise ArgumentUsageError( - "Invalid backend address: vnet name or vnet ID is required when using subnet name only." - ) - # convert subnet name to subnet id - subnet = f"{virtual_network}/subnets/{subnet}" - backend_address.subnet = subnet - - def post_instance_update(self, instance): - if has_value(instance.properties.load_balancer_backend_addresses): - for backend_address in instance.properties.load_balancer_backend_addresses: - if not has_value(backend_address.properties.virtual_network.id): - backend_address.properties.virtual_network = None - if not has_value(backend_address.properties.subnet.id): - backend_address.properties.subnet = None - - -@register_command("network lb address-pool delete") -class LBAddressPoolDelete(_LBAddressPoolBasicDelete): - """Delete the specified load balancer backend address pool. - - :example: Delete an address pool. - az network lb address-pool delete -g MyResourceGroup --lb-name MyLb -n MyAddressPool - """ - - -class LBAddressPoolAddressAdd(_LBAddressPoolAddressAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.virtual_network._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - args_schema.ip_address._required = True - args_schema.frontend_ip_address._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - virtual_network = args.virtual_network.to_serialized_data() - subnet = args.subnet.to_serialized_data() - if subnet and not is_valid_resource_id(subnet): - if not virtual_network: - raise ArgumentUsageError( - "vnet name or vnet ID is required when using subnet name only." - ) - # convert subnet name to subnet id - subnet = f"{virtual_network}/subnets/{subnet}" - args.subnet = subnet - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class LBAddressPoolAddressUpdate(_LBAddressPoolAddressUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.virtual_network._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - args_schema.ip_address._nullable = False - args_schema.frontend_ip_address._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - virtual_network = args.virtual_network.to_serialized_data() - subnet = args.subnet.to_serialized_data() - if subnet and not is_valid_resource_id(subnet): - if not virtual_network: - raise ArgumentUsageError( - "vnet name or vnet ID is required when using subnet name only." - ) - # convert subnet name to subnet id - subnet = f"{virtual_network}/subnets/{subnet}" - args.subnet = subnet - - def post_instance_update(self, instance): - if not has_value(instance.properties.virtual_network.id): - instance.properties.virtual_network = None - if not has_value(instance.properties.subnet.id): - instance.properties.subnet = None - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class LBAddressPoolTunnelInterfaceAdd(_LBAddressPoolTunnelInterfaceAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.identifier._required = True - args_schema.type._required = True - args_schema.protocol._required = True - return args_schema - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class LBAddressPoolTunnelInterfaceUpdate(_LBAddressPoolTunnelInterfaceUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.identifier._nullable = False - args_schema.type._nullable = False - args_schema.protocol._nullable = False - return args_schema - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -class LBProbeCreate(_LBProbeCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.port._required = True - args_schema.protocol._required = True - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.number_of_probes): - logger.warning( - "The property \"numberOfProbes\" is not respected. Load Balancer health probes will probe up or down " - "immediately after one probe regardless of the property's configured value. To control the number of " - "successful or failed consecutive probes necessary to mark backend instances as healthy or unhealthy, " - "please leverage the property \"probeThreshold\" instead." - ) - if has_value(args.request_path) and args.request_path == "": - args.request_path = None - - -class LBProbeUpdate(_LBProbeUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.port._nullable = False - args_schema.protocol._nullable = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.number_of_probes): - logger.warning( - "The property \"numberOfProbes\" is not respected. Load Balancer health probes will probe up or down " - "immediately after one probe regardless of the property's configured value. To control the number of " - "successful or failed consecutive probes necessary to mark backend instances as healthy or unhealthy, " - "please leverage the property \"probeThreshold\" instead." - ) - if has_value(args.request_path) and args.request_path == "": - args.request_path = None - - -# cross-region-lb commands -@register_command("network cross-region-lb show") -class CrossRegionLoadBalancerShow(_LBShow): - """Get the details of a load balancer. - - :example: Get the details of a load balancer. - az network cross-region-lb show -g MyResourceGroup -n MyLb - """ - - -@register_command("network cross-region-lb delete") -class CrossRegionLoadBalancerDelete(_LBDelete): - """Delete the specified load balancer. - - :example: Delete a load balancer. - az network cross-region-lb delete -g MyResourceGroup -n MyLb - """ - - -@register_command("network cross-region-lb list") -class CrossRegionLoadBalancerList(_LBList): - """List load balancers. - - :example: List load balancers. - az network cross-region-lb list -g MyResourceGroup - """ - - -@register_command("network cross-region-lb update") -class CrossRegionLoadBalancerUpdate(_LBUpdate): - """Update a load balancer. - - This command can only be used to update the tags for a load balancer. - Name and resource group are immutable and cannot be updated. - - :example: Update the tags of a load balancer. - az network cross-region-lb update -g MyResourceGroup -n MyLB --tags CostCenter=MyTestGroup - """ - - -@register_command("network cross-region-lb frontend-ip show") -class CrossRegionLoadBalancerFrontendIPShow(_LBFrontendIPShow): - """Get the details of a frontend IP address. - - :example: Get the details of a frontend IP address. - az network cross-region-lb frontend-ip show -g MyResourceGroup --lb-name MyLb -n MyFrontendIp - """ - - -@register_command("network cross-region-lb frontend-ip list") -class CrossRegionLoadBalancerFrontendIPList(_LBFrontendIPList): - """List frontend IP addresses. - - :example: List frontend IP addresses. - az network cross-region-lb frontend-ip list -g MyResourceGroup --lb-name MyLb - """ - - -@register_command("network cross-region-lb frontend-ip delete") -class CrossRegionLoadBalancerFrontendIPDelete(_LBFrontendIPDelete): - """Delete a frontend IP address. - - :example: Delete a frontend IP address. - az network cross-region-lb frontend-ip delete -g MyResourceGroup --lb-name MyLb -n MyFrontendIp - """ - - -@register_command("network cross-region-lb frontend-ip create") -class CrossRegionLoadBalancerFrontendIPCreate(_LBFrontendIPCreate): - """Create a frontend IP address. - - :example: Create a frontend ip address for a public load balancer. - az network cross-region-lb frontend-ip create -g MyResourceGroup --lb-name MyLb -n MyFrontendIp --public-ip-address MyFrontendIp - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", - ) - args_schema.zones.Element.enum = AAZArgEnum({ - "1": "1", - "2": "2", - "3": "3", - }) - - args_schema.private_ip_address._registered = False - args_schema.private_ip_address_version._registered = False - args_schema.private_ip_allocation_method._registered = False - args_schema.subnet._registered = False - args_schema.gateway_lb._registered = False - return args_schema - - -@register_command("network cross-region-lb frontend-ip update") -class CrossRegionLoadBalancerFrontendIPUpdate(_LBFrontendIPUpdate): - """Update a frontend IP address. - - :example: Update the frontend IP address of a public load balancer. - az network cross-region-lb frontend-ip update -g MyResourceGroup --lb-name MyLb -n MyFrontendIp --public-ip-address MyFrontendIp - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.public_ip_prefix._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIpPrefixes/{}", - ) - args_schema.public_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/publicIPAddresses/{}", - ) - args_schema.zones.Element.enum = AAZArgEnum({ - "1": "1", - "2": "2", - "3": "3", - }) - - args_schema.private_ip_address._registered = False - args_schema.private_ip_address_version._registered = False - args_schema.private_ip_allocation_method._registered = False - args_schema.subnet._registered = False - args_schema.gateway_lb._registered = False - return args_schema - - -@register_command("network cross-region-lb rule show") -class CrossRegionLoadBalancerRuleShow(_LBRuleShow): - """Get the details of a load balancing rule. - - :example: Get the details of a load balancing rule. - az network cross-region-lb rule show -g MyResourceGroup --lb-name MyLb -n MyLbRule - """ - - -@register_command("network cross-region-lb rule delete") -class CrossRegionLoadBalancerRuleDelete(_LBRuleDelete): - """Delete a load balancing rule. - - :example: Delete a load balancing rule. - az network cross-region-lb rule delete -g MyResourceGroup --lb-name MyLb -n MyLbRule - """ - - -@register_command("network cross-region-lb rule list") -class CrossRegionLoadBalancerRuleList(_LBRuleList): - """List load balancing rules. - - :example: List load balancing rules. - az network cross-region-lb rule list -g MyResourceGroup --lb-name MyLb -o table - """ - - -@register_command("network cross-region-lb rule create") -class CrossRegionLoadBalancerRuleCreate(_LBRuleCreate): - """Create a load balancing rule. - - :example: Create a load balancing rule that assigns a front-facing IP configuration and port to an address pool and port. - az network cross-region-lb rule create -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Tcp --frontend-ip-name MyFrontEndIp --frontend-port 80 --backend-pool-name MyAddressPool --backend-port 80 - - :example: Create a load balancing rule that assigns a front-facing IP configuration and port to an address pool and port with the floating ip feature. - az network cross-region-lb rule create -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Tcp --frontend-ip-name MyFrontEndIp --frontend-port 80 --backend-pool-name MyAddressPool --backend-port 80 --floating-ip true - - :example: Create an HA ports load balancing rule that assigns a frontend IP and port to use all available backend IPs in a pool on the same port. - az network cross-region-lb rule create -g MyResourceGroup --lb-name MyLb -n MyHAPortsRule --protocol All --frontend-port 0 --backend-port 0 --frontend-ip-name MyFrontendIp --backend-pool-name MyAddressPool - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - args_schema.probe_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" - ) - # not support multi backend pools because the loadbalance SKU is not Gateway - args_schema.backend_pool = AAZResourceIdArg( - options=["--backend-pool-name"], - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ), - arg_group="Properties", - help="ID or name of the backend address pools. If only one exists, omit to use as default." - ) - args_schema.idle_timeout_in_minutes._default = 4 - args_schema.enable_tcp_reset._default = False - args_schema.protocol._required = True - args_schema.frontend_port._required = True - args_schema.backend_port._required = True - args_schema.backend_address_pools._registered = False - args_schema.disable_outbound_snat._registered = False # it's not required for cross-region-lb - args_schema.idle_timeout_in_minutes._registered = False - args_schema.enable_tcp_reset._registered = False - return args_schema - - def pre_instance_create(self): - args = self.ctx.args - if not has_value(args.frontend_ip_name): - instance = self.ctx.vars.instance - frontend_ip_configurations = instance.properties.frontend_ip_configurations - if len(frontend_ip_configurations) == 1: - args.frontend_ip_name = instance.properties.frontend_ip_configurations[0].id - elif len(frontend_ip_configurations) > 1: - raise ArgumentUsageError( - "Multiple FrontendIpConfigurations found in loadbalancer. Specify --frontend-ip explicitly.") - if not has_value(args.backend_pool): - instance = self.ctx.vars.instance - backend_address_pools = instance.properties.backend_address_pools - if len(backend_address_pools) == 1: - args.backend_pool = instance.properties.backend_address_pools[0].id - elif len(backend_address_pools) > 1: - raise ArgumentUsageError( - "Multiple BackendAddressPools found in loadbalancer. Specify --backend-pool-name explicitly.") - if has_value(args.backend_pool): - args.backend_address_pools = [{"id": args.backend_pool.to_serialized_data()}] - - -@register_command("network cross-region-lb rule update") -class CrossRegionLoadBalancerRuleUpdate(_LBRuleUpdate): - """Update a load balancing rule. - - :example: Update a load balancing rule to change the protocol to UDP. - az network cross-region-lb rule update -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol Udp - - :example: Update a load balancing rule to support HA ports. - az network cross-region-lb rule update -g MyResourceGroup --lb-name MyLb -n MyLbRule --protocol All --frontend-port 0 --backend-port 0 - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/frontendIPConfigurations/{}" - ) - args_schema.probe_name._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/probes/{}" - ) - # not support multi backend pools because the loadbalance SKU is not Gateway - args_schema.backend_pool = AAZResourceIdArg( - options=["--backend-pool-name"], - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{lb_name}/backendAddressPools/{}" - ), - arg_group="Properties", - nullable=True, - help="ID or name of the backend address pools. If only one exists, omit to use as default." - ) - - args_schema.protocol._nullable = False - args_schema.frontend_port._nullable = False - args_schema.backend_port._nullable = False - args_schema.backend_address_pools._registered = False - args_schema.disable_outbound_snat._registered = False # it's not required for cross-region-lb - args_schema.idle_timeout_in_minutes._registered = False - args_schema.enable_tcp_reset._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.backend_pool): - backend_pool = args.backend_pool.to_serialized_data() - if backend_pool is None: - args.backend_address_pools = [] # remove backend pool - else: - args.backend_address_pools = [{"id": backend_pool}] - - def post_instance_update(self, instance): - if not has_value(instance.properties.frontend_ip_configuration.id): - instance.properties.frontend_ip_configuration = None - if not has_value(instance.properties.probe.id): - instance.properties.probe = None - # always remove backend_address_pool in update request, service will fill this property based on backend_address_pools property. - instance.properties.backend_address_pool = None - - -@register_command("network cross-region-lb address-pool create") -class CrossRegionLoadBalancerAddressPoolCreate(_LBAddressPoolCreate): - """Create load balancer backend address pool. - - :example: Create an address pool. - az network cross-region-lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool - - :example: Create an address pool with several backend addresses using shorthand syntax arguments. - az network cross-region-lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses "[{name:addr1,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb1'},{name:addr2,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2'}]" - - :example: Create an address pool with several backend addresses using config file - az network cross-region-lb address-pool create -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses config_file.json - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.admin_state = AAZStrArg( - options=["--admin-state"], - arg_group="Properties", - help="Default administrative state to backend addresses in `--backend-addresses`.", - ) - args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum - # not support name, the frontend id should belong to a regional load balance - args_schema.backend_addresses.Element.frontend_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" - ) - args_schema.backend_addresses.Element.name._required = True - args_schema.backend_addresses.Element.frontend_ip_address._required = True - - args_schema.tunnel_interfaces._registered = False - args_schema.backend_addresses.Element.ip_address._registered = False - args_schema.backend_addresses.Element.subnet._registered = False - args_schema.backend_addresses.Element.virtual_network._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.backend_addresses): - for backend_address in args.backend_addresses: - if not has_value(backend_address.admin_state) and has_value(args.admin_state): - # use the command level argument --admin-state - backend_address.admin_state = args.admin_state - - -@register_command("network cross-region-lb address-pool update") -class CrossRegionLoadBalancerAddressPoolUpdate(_LBAddressPoolUpdate): - """Update a load balancer backend address pool. - - :example: Update all backend addresses in the address pool using shorthand syntax - az network cross-region-lb address-pool update -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses "[{name:addr1,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb1'},{name:addr2,frontend-ip-address:'/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2'}]" - - :example: Update the frontend-ip-address of the first backend address in the address pool using shorthand syntax - az network cross-region-lb address-pool update -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses [0].frontend-ip-address=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb1 - - :example: Remove the first backend address in the address pool using shorthand syntax - az network cross-region-lb address-pool update -g MyResourceGroup --lb-name MyLb -n MyAddressPool --backend-addresses [0]=null - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.admin_state = AAZStrArg( - options=["--admin-state"], - arg_group="Properties", - help="Default administrative state to backend addresses in `--backend-addresses`.", - ) - args_schema.admin_state.enum = args_schema.backend_addresses.Element.admin_state.enum - # not support name, the frontend id should belong to a regional load balance - args_schema.backend_addresses.Element.frontend_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" - ) - args_schema.backend_addresses.Element.name._nullable = False - args_schema.backend_addresses.Element.frontend_ip_address._nullable = False - args_schema.backend_addresses.Element.admin_state._nullable = False - - args_schema.tunnel_interfaces._registered = False - args_schema.backend_addresses.Element.ip_address._registered = False - args_schema.backend_addresses.Element.subnet._registered = False - args_schema.backend_addresses.Element.virtual_network._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.backend_addresses): - for backend_address in args.backend_addresses: - if not has_value(backend_address.admin_state) and has_value(args.admin_state): - # use the command level argument --admin-state - backend_address.admin_state = args.admin_state - - -@register_command("network cross-region-lb address-pool show") -class CrossRegionLoadBalancerAddressPoolShow(_LBAddressPoolShow): - """Get load balancer backend address pool. - - :example: Get the details of an address pool. - az network cross-region-lb address-pool show -g MyResourceGroup --lb-name MyLb -n MyAddressPool - """ - - -@register_command("network cross-region-lb address-pool delete") -class CrossRegionLoadBalancerAddressPoolDelete(_LBAddressPoolDelete): - """Delete the specified load balancer backend address pool. - - :example: Delete an address pool. - az network cross-region-lb address-pool delete -g MyResourceGroup --lb-name MyLb -n MyAddressPool - """ - - -@register_command("network cross-region-lb address-pool list") -class CrossRegionLoadBalancerAddressPoolList(_LBAddressPoolList): - """List all the load balancer backed address pools. - - :example: List address pools. - az network cross-region-lb address-pool list -g MyResourceGroup --lb-name MyLb -o table - """ - - -@register_command("network cross-region-lb address-pool address add") -class CrossRegionLoadBalancerAddressPoolAddressAdd(_LBAddressPoolAddressAdd): - """Add one backend address into the load balance backend address pool. - - :example: Add one backend address into the load balance backend address pool. - az network cross-region-lb address-pool address add -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress --frontend-ip-address /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2 - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" - ) - - args_schema.frontend_ip_address._required = True - args_schema.ip_address._registered = False - args_schema.subnet._registered = False - args_schema.virtual_network._registered = False - return args_schema - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -@register_command("network cross-region-lb address-pool address remove") -class CrossRegionLoadBalancerAddressPoolAddressRemove(_LBAddressPoolAddressRemove): - """Remove one backend address from the load balance backend address pool. - :example: Remove one backend address from the load balance backend address pool. - az network cross-region-lb address-pool address remove -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress - """ - - -@register_command("network cross-region-lb address-pool address update") -class CrossRegionLoadBalancerAddressPoolAddressUpdate(_LBAddressPoolAddressUpdate): - """Update the backend address into the load balance backend address pool. - - :example: Update the frontend ip of the backend address into the load balance backend address pool. - az network cross-region-lb address-pool address update -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress --frontend-ip-address /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_lb_address_pool_addresses000001/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb2 - """ - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.frontend_ip_address._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}" - ) - - args_schema.frontend_ip_address._nullable = False - args_schema.ip_address._registered = False - args_schema.subnet._registered = False - args_schema.virtual_network._registered = False - return args_schema - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - -@register_command("network cross-region-lb address-pool address list") -class CrossRegionLoadBalancerAddressPoolAddressList(_LBAddressPoolAddressList): - """List all backend addresses of the load balance backend address pool. - - :example: List all backend addresses of the load balance backend address pool. - az network cross-region-lb address-pool address list -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool - """ - - -@register_command("network cross-region-lb address-pool address show") -class CrossRegionLoadBalancerAddressPoolAddressShow(_LBAddressPoolAddressShow): - """Show the backend address from the load balance backend address pool. - - :example: Show the backend address from the load balance backend address pool. - az network cross-region-lb address-pool address show -g MyResourceGroup --lb-name MyLb --pool-name MyAddressPool -n MyAddress - """ diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py b/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py deleted file mode 100644 index 351219da89b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/network/operations/vnet_gateway_migration.py +++ /dev/null @@ -1,95 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# pylint: disable=protected-access, line-too-long - -from ..aaz.latest.network.vnet_gateway.migration._prepare import Prepare as _VNetGatewayMigrationPrepare -from ..aaz.latest.network.vnet_gateway.migration._execute import Execute as _VNetGatewayMigrationExecute -from ..aaz.latest.network.vnet_gateway.migration._commit import Commit as _VNetGatewayMigrationCommit -from ..aaz.latest.network.vnet_gateway.migration._abort import Abort as _VNetGatewayMigrationAbort - - -class VNetGatewayMigrationPrepare(_VNetGatewayMigrationPrepare): - - class VirtualNetworkGatewaysInvokePrepareMigration(_VNetGatewayMigrationPrepare.VirtualNetworkGatewaysInvokePrepareMigration): - - # to handle the LRO response with no response body - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - lambda _: None, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - -class VNetGatewayMigrationExecute(_VNetGatewayMigrationExecute): - - class VirtualNetworkGatewaysInvokeExecuteMigration(_VNetGatewayMigrationExecute.VirtualNetworkGatewaysInvokeExecuteMigration): - - # to handle the LRO response with no response body - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - lambda _: None, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - -class VNetGatewayMigrationCommit(_VNetGatewayMigrationCommit): - - class VirtualNetworkGatewaysInvokeCommitMigration(_VNetGatewayMigrationCommit.VirtualNetworkGatewaysInvokeCommitMigration): - - # to handle the LRO response with no response body - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - lambda _: None, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - -class VNetGatewayMigrationAbort(_VNetGatewayMigrationAbort): - - class VirtualNetworkGatewaysInvokeAbortMigration(_VNetGatewayMigrationAbort.VirtualNetworkGatewaysInvokeAbortMigration): - - # to handle the LRO response with no response body - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - lambda _: None, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py b/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py deleted file mode 100644 index 8ab9311ee64..00000000000 --- a/src/azure-cli/azure/cli/command_modules/network/operations/watcher.py +++ /dev/null @@ -1,2159 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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, protected-access, too-few-public-methods -from knack.log import get_logger -from knack.util import CLIError -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id - -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.commands.arm import get_arm_resource_by_id - -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, \ - AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat -from azure.cli.core.aaz.utils import assign_aaz_list_arg -from azure.cli.core.commands.client_factory import get_mgmt_service_client -from azure.cli.core.profiles import ResourceType -from azure.cli.core.commands.validators import validate_tags -from azure.cli.command_modules.network._validators import validate_managed_identity_resource_id -from .._validators import _resolve_api_version - -from ..aaz.latest.network.watcher._run_configuration_diagnostic import RunConfigurationDiagnostic as _RunConfigurationDiagnostic -from ..aaz.latest.network.watcher._show_next_hop import ShowNextHop as _ShowNextHop -from ..aaz.latest.network.watcher._show_security_group_view import ShowSecurityGroupView as _ShowSecurityGroupView -from ..aaz.latest.network.watcher._show_topology import ShowTopology as _ShowTopology -from ..aaz.latest.network.watcher._test_connectivity import TestConnectivity as _TestConnectivity -from ..aaz.latest.network.watcher._test_ip_flow import TestIpFlow as _TestIPFlow - -from ..aaz.latest.network.watcher.flow_log._create import Create as _NwFlowLogCreate -from ..aaz.latest.network.watcher.flow_log._update import Update as _NwFlowLogUpdate -from ..aaz.latest.network.watcher.flow_log._list import List as _NwFlowLogList -from ..aaz.latest.network.watcher.flow_log._delete import Delete as _NwFlowLogDelete -from ..aaz.latest.network.watcher.troubleshooting._start import Start as _NwTroubleshootingStart -from ..aaz.latest.network.watcher.troubleshooting._show import Show as _NwTroubleshootingShow -from ..aaz.latest.network.watcher.packet_capture._create import Create as _PacketCaptureCreate -from ..aaz.latest.network.watcher.packet_capture._delete import Delete as _PacketCaptureDelete -from ..aaz.latest.network.watcher.packet_capture._list import List as _PacketCaptureList -from ..aaz.latest.network.watcher.packet_capture._show import Show as _PacketCaptureShow -from ..aaz.latest.network.watcher.packet_capture._show_status import ShowStatus as _PacketCaptureShowStatus -from ..aaz.latest.network.watcher.packet_capture._stop import Stop as _PacketCaptureStop - -from ..aaz.latest.network.watcher.connection_monitor._create import Create as _WatcherConnectionMonitorCreate -from ..aaz.latest.network.watcher.connection_monitor._start import Start as _WatcherConnectionMonitorStart -from ..aaz.latest.network.watcher.connection_monitor._stop import Stop as _WatcherConnectionMonitorStop -from ..aaz.latest.network.watcher.connection_monitor._show import Show as _WatcherConnectionMonitorShow -from ..aaz.latest.network.watcher.connection_monitor._list import List as _WatcherConnectionMonitorList -from ..aaz.latest.network.watcher.connection_monitor._delete import Delete as _WatcherConnectionMonitorDelete -from ..aaz.latest.network.watcher.connection_monitor._query import Query as _WatcherConnectionMonitorQuery -from ..aaz.latest.network.watcher.connection_monitor._update import Update as _WatcherConnectionMonitorUpdate -from ..aaz.latest.network.watcher.connection_monitor.output._add import Add as _WatcherConnectionMonitorOutputAdd -from ..aaz.latest.network.watcher.connection_monitor.output._list import List as _WatcherConnectionMonitorOutputList -from ..aaz.latest.network.watcher.connection_monitor.endpoint._show import Show as _WatcherConnectionMonitorEndpointShow -from ..aaz.latest.network.watcher.connection_monitor.endpoint._remove import Remove as _WatcherConnectionMonitorEndpointRemove -from ..aaz.latest.network.watcher.connection_monitor.endpoint._list import List as _WatcherConnectionMonitorEndpointList -from ..aaz.latest.network.watcher.connection_monitor.endpoint._add import Add as _WatcherConnectionMonitorEndpointAdd - -from ..aaz.latest.network.watcher.connection_monitor.test_configuration._add import Add as _MonitorTestConfigurationAdd -from ..aaz.latest.network.watcher.connection_monitor.test_configuration._show import Show as _MonitorTestConfigurationShow -from ..aaz.latest.network.watcher.connection_monitor.test_configuration._list import List as _MonitorTestConfigurationList -from ..aaz.latest.network.watcher.connection_monitor.test_configuration._remove import Remove as _MonitorTestConfigurationRemove - -from ..aaz.latest.network.watcher.connection_monitor.test_group._add import Add as _WatcherConnectionMonitorTestGroupAdd -from ..aaz.latest.network.watcher.connection_monitor.test_group._show import Show as _WatcherConnectionMonitorTestGroupShow -from ..aaz.latest.network.watcher.connection_monitor.test_group._list import List as _WatcherConnectionMonitorTestGroupList - -logger = get_logger(__name__) - - -def get_network_watcher_from_location(cmd, watcher_name="watcher_name", rg_name="watcher_rg"): - from ..aaz.latest.network.watcher._list import List - - args = cmd.ctx.args - location = args.location.to_serialized_data() - watcher_list = List(cli_ctx=cmd.cli_ctx)(command_args={}) - watcher = next((w for w in watcher_list if w["location"].lower() == location.lower()), None) - if not watcher: - raise ValidationError(f"network watcher is not enabled for region {location}.") - - id_parts = parse_resource_id(watcher["id"]) - setattr(args, rg_name, id_parts["resource_group"]) - setattr(args, watcher_name, id_parts["name"]) - - -def get_network_watcher_from_vm(cmd): - args = cmd.ctx.args - compute_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machines - vm_name = parse_resource_id(args.vm.to_serialized_data())["name"] - vm = compute_client.get(args.resource_group_name, vm_name) - args.location = vm.location - get_network_watcher_from_location(cmd) - - -def get_network_watcher_from_resource(cmd): - args = cmd.ctx.args - resource = get_arm_resource_by_id(cmd.cli_ctx, args.resource.to_serialized_data()) - args.location = resource.location - get_network_watcher_from_location(cmd) - - -def get_network_watcher_from_vmss(cmd): - args = cmd.ctx.args - compute_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machine_scale_sets - vmss_name = parse_resource_id(args.target.to_serialized_data())["name"] - vmss = compute_client.get(args.resource_group_name, vmss_name) - args.location = vmss.location - get_network_watcher_from_location(cmd) - - -class TestIPFlow(_TestIPFlow): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - args_schema.local = AAZStrArg( - options=["--local"], - help="Private IPv4 address for the VMs NIC and the port of the packet in X.X.X.X:PORT format. " - "`*` can be used for port when direction is outbound.", - required=True, - ) - args_schema.remote = AAZStrArg( - options=["--remote"], - help="IPv4 address and port for the remote side of the packet X.X.X.X:PORT format. " - "`*` can be used for port when the direction is inbound.", - required=True, - ) - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of the resource group the target VM is in.", - ) - args_schema.vm._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" - "/virtualMachines/{}", - ) - args_schema.nic._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" - "/networkInterfaces/{}", - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - args_schema.local_ip_address._required = False - args_schema.local_ip_address._registered = False - args_schema.local_port._required = False - args_schema.local_port._registered = False - args_schema.remote_ip_address._required = False - args_schema.remote_ip_address._registered = False - args_schema.remote_port._required = False - args_schema.remote_port._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - try: - args.local_ip_address, args.local_port = args.local.to_serialized_data().split(":") - args.remote_ip_address, args.remote_port = args.remote.to_serialized_data().split(":") - except: - raise ValidationError("usage error: the format of the '--local' and '--remote' should be like x.x.x.x:port") - - get_network_watcher_from_vm(self) - - -class ShowNextHop(_ShowNextHop): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of the resource group the target VM is in.", - ) - args_schema.vm._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" - "/virtualMachines/{}", - ) - args_schema.nic._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" - "/networkInterfaces/{}", - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_vm(self) - - -class ShowSecurityGroupView(_ShowSecurityGroupView): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of the resource group the target VM is in.", - ) - args_schema.vm._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" - "/virtualMachines/{}", - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_vm(self) - - -class RunConfigurationDiagnostic(_RunConfigurationDiagnostic): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - args_schema.destination = AAZStrArg( - options=["--destination"], - arg_group="Query", - help="Traffic destination. Accepted values are '*', IP address/CIDR, or Service Tag.", - ) - args_schema.direction = AAZStrArg( - options=["--direction"], - arg_group="Query", - help="Direction of the traffic.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - args_schema.port = AAZStrArg( - options=["--port"], - arg_group="Query", - help="Traffic destination port. Accepted values are '*', port number (3389) or port range (80-100).", - ) - args_schema.protocol = AAZStrArg( - options=["--protocol"], - arg_group="Query", - help="Protocol to be verified on.", - enum={"TCP": "TCP", "UDP": "UDP"}, - ) - args_schema.source = AAZStrArg( - options=["--source"], - arg_group="Query", - help="Traffic source. Accepted values are '*', IP address/CIDR, or Service Tag.", - ) - args_schema.parent = AAZStrArg( - options=["--parent"], - arg_group="Target", - help="Parent path, e.g., virtualMachineScaleSets/vmss1.", - ) - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - arg_group="Target", - help="Name of the resource group the target resource is in.", - ) - args_schema.resource_type = AAZStrArg( - options=["-t", "--resource-type"], - arg_group="Target", - help="Resource type.", - enum={ - "applicationGateways": "applicationGateways", - "networkInterfaces": "networkInterfaces", - "virtualMachines": "virtualMachines", - }, - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - args_schema.queries._required = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - # validate target resource - resource_usage = ValidationError("usage error: --resource ID | --resource NAME --resource-type TYPE --resource-group NAME [--parent PATH]") - # omit --parent since it is optional - id_params = [has_value(args.resource_group_name), has_value(args.resource_type)] - if not is_valid_resource_id(args.resource.to_serialized_data()): - if not all(id_params): - raise resource_usage - # infer resource namespace - NAMESPACES = { - "virtualMachines": "Microsoft.Compute", - "applicationGateways": "Microsoft.Network", - "networkInterfaces": "Microsoft.Network", - } - resource_namespace = NAMESPACES[args.resource_type.to_serialized_data()] - if has_value(args.parent): - # special case for virtualMachineScaleSets/NetworkInterfaces, since it is - # the only one to need `--parent` - resource_namespace = "Microsoft.Compute" - args.resource = resource_id( - subscription=self.ctx.subscription_id, - resource_group=args.resource_group_name, - namespace=resource_namespace, - type=args.resource_type, - parent=args.parent, - name=args.resource - ) - elif any(id_params) or has_value(args.parent): - raise resource_usage - # validate query - query_usage = ValidationError("usage error: --queries JSON | --destination DEST --source SRC --direction DIR --port PORT --protocol PROTOCOL") - query_params = [has_value(args.destination), has_value(args.port), has_value(args.direction), has_value(args.protocol), has_value(args.source)] - if has_value(args.queries): - if any(query_params): - raise query_usage - elif not all(query_params): - raise query_usage - else: - args.queries = [{ - "destination": args.destination, - "destination_port": args.port, - "direction": args.direction, - "protocol": args.protocol, - "source": args.source - }] - - get_network_watcher_from_resource(self) - - -class ShowTopology(_ShowTopology): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - help="Location. Defaults to the location of the target resource group. " - "Topology information is only shown for resources within the target resource group " - "that are within the specified region.", - ) - args_schema.resource_group_name._options = ["-g", "--resource-group"] - args_schema.vnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" - "/virtualNetworks/{}", - ) - args_schema.subnet._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network" - "/virtualNetworks/{vnet}/subnets/{}", - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.subnet): - rg = parse_resource_id(args.subnet.to_serialized_data())["resource_group"] - args.resource_group_name = None - args.vnet = None - elif has_value(args.vnet): - rg = parse_resource_id(args.vnet.to_serialized_data())["resource_group"] - args.resource_group_name = None - else: - rg = args.resource_group_name.to_serialized_data() - # retrieve location from resource group - if not has_value(args.location): - resource_client = \ - get_mgmt_service_client(self.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES).resource_groups - resource_group = resource_client.get(rg) - args.location = resource_group.location - - get_network_watcher_from_location(self) - - -class TestConnectivity(_TestConnectivity): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of the resource group the target resource is in.", - ) - args_schema.headers = AAZDictArg( - options=["--headers"], - arg_group="HTTP Configuration", - help="Space-separated list of headers in `KEY=VALUE` format.", - ) - args_schema.headers.Element = AAZStrArg() - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - args_schema.headers_obj._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - compute_client = get_mgmt_service_client(self.cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machines - id_parts = parse_resource_id(args.source_resource.to_serialized_data()) - vm_name = id_parts["name"] - rg = args.resource_group_name or id_parts.get("resource_group", None) - if not rg: - raise ValidationError("usage error: --source-resource ID | --source-resource NAME --resource-group NAME") - - vm = compute_client.get(rg, vm_name) - args.location = vm.location - get_network_watcher_from_location(self) - - if has_value(args.source_resource) and not is_valid_resource_id(args.source_resource.to_serialized_data()): - args.source_resource = resource_id( - subscription=self.ctx.subscription_id, - resource_group=rg, - namespace="Microsoft.Compute", - type="virtualMachines", - name=args.source_resource - ) - - if has_value(args.dest_resource) and not is_valid_resource_id(args.dest_resource.to_serialized_data()): - args.dest_resource = resource_id( - subscription=self.ctx.subscription_id, - resource_group=args.resource_group_name, - namespace="Microsoft.Compute", - type="virtualMachines", - name=args.dest_resource - ) - - if has_value(args.headers): - args.headers_obj = [{"name": k, "value": v} for k, v in args.headers.items()] - - -class PacketCaptureCreate(_PacketCaptureCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of the resource group the target resource is in.", - required=True, - ) - args_schema.vm = AAZResourceIdArg( - options=["--vm"], - help="Name or ID of the VM to target", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" - "/virtualMachines/{}", - ), - ) - args_schema.target._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute" - "/virtualMachineScaleSets/{}", - ) - args_schema.storage_account._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage" - "/storageAccounts/{}", - ) - args_schema.target._required = False - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.target_type) and args.target_type.to_serialized_data().lower() == "azurevmss": - get_network_watcher_from_vmss(self) - else: - # set the appropriate fields if target is vm - get_network_watcher_from_vm(self) - args.target = args.vm - args.include, args.exclude = None, None - - storage_usage = ValidationError("usage error: --storage-account NAME_OR_ID [--storage-path PATH] [--file-path PATH] | --file-path PATH") - if not has_value(args.storage_account) and (has_value(args.storage_path) or not has_value(args.file_path)): - raise storage_usage - - if has_value(args.file_path): - path = args.file_path.to_serialized_data() - if not path.endswith(".cap"): - raise ValidationError("usage error: --file-path PATH must end with the '*.cap' extension") - - if not path.startswith("/"): - path = path.replace("/", "\\") - args.file_path = path - - -class PacketCaptureDelete(_PacketCaptureDelete): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - required=True, - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class PacketCaptureList(_PacketCaptureList): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - required=True, - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class PacketCaptureShow(_PacketCaptureShow): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - required=True, - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class PacketCaptureShowStatus(_PacketCaptureShowStatus): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - required=True, - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class PacketCaptureStop(_PacketCaptureStop): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location = AAZResourceLocationArg( - required=True, - ) - args_schema.watcher_rg._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_name._registered = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -def process_nw_cm_v2_create_namespace(cmd): - args = cmd.ctx.args - validate_tags(args) - if not has_value(args.location): # location is None only occurs in creating a V2 connection monitor - endpoint_source_resource_id = args.endpoint_source_resource_id.to_serialized_data() - from azure.mgmt.resource import ResourceManagementClient - # parse and verify endpoint_source_resource_id - if not has_value(args.endpoint_source_resource_id): - raise ValidationError('usage error: --location/--endpoint-source-resource-id ' - 'is required to create a V2 connection monitor') - if is_valid_resource_id(endpoint_source_resource_id) is False: - raise ValidationError('usage error: "{}" is not a valid resource id'.format(endpoint_source_resource_id)) - - resource = parse_resource_id(endpoint_source_resource_id) - resource_client = get_mgmt_service_client(cmd.cli_ctx, ResourceManagementClient) - resource_api_version = _resolve_api_version(resource_client, - resource['namespace'], - resource['resource_parent'], - resource['resource_type']) - resource = resource_client.resources.get_by_id(endpoint_source_resource_id, resource_api_version) - - args.location = resource.location - if not has_value(args.location): - raise ValidationError("Can not get location from --endpoint-source-resource-id") - - if not has_value(args.test_config_protocol): - raise ValidationError('usage error: --protocol is required to create a test ' - 'configuration for V2 connection monitor') - - if has_value(args.output_type) and not has_value(args.workspace_ids): - raise ValidationError('usage error: --output-type is specified but no other resource id provided') - - -class WatcherConnectionMonitorCreate(_WatcherConnectionMonitorCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group._required = False - - args_schema.auto_start._registered = False - args_schema.monitoring_interval_in_seconds._registered = False - args_schema.source._registered = False - args_schema.destination._registered = False - args_schema.endpoints._registered = False - args_schema.test_configurations._registered = False - args_schema.test_groups._registered = False - args_schema.outputs._registered = False - - # V2 Endpoint - args_schema.endpoint_dest_address = AAZStrArg( - options=["--endpoint-dest-address"], - help="Address of the destination of connection monitor endpoint (IP or domain name)", - arg_group="V2 Endpoint", - ) - args_schema.endpoint_dest_coverage_level = AAZStrArg( - options=["--endpoint-dest-coverage-level"], - help="Test coverage for the endpoint.", - enum={"AboveAverage": "AboveAverage", "Average": "Average", "BelowAverage": "BelowAverage", - "Default": "Default", "Full": "Full", "Low": "Low"}, - arg_group="V2 Endpoint" - ) - args_schema.endpoint_dest_name = AAZStrArg( - options=["--endpoint-dest-name"], - help="The name of the destination of connection monitor endpoint. " - "If you are creating a V2 Connection Monitor, it's required.", - required=True, - arg_group="V2 Endpoint" - ) - args_schema.endpoint_dest_resource_id = AAZStrArg( - options=["--endpoint-dest-resource-id"], - help="Resource ID of the destination of connection monitor endpoint.", - arg_group="V2 Endpoint", - ) - args_schema.endpoint_dest_type = AAZStrArg( - options=["--endpoint-dest-type"], - help="The endpoint type.", - enum={"AzureArcVM": "AzureArcVM", "AzureSubnet": "AzureSubnet", "AzureVM": "AzureVM", - "AzureVMSS": "AzureVMSS", "AzureVNet": "AzureVNet", "ExternalAddress": "ExternalAddress", - "MMAWorkspaceMachine": "MMAWorkspaceMachine", "MMAWorkspaceNetwork": "MMAWorkspaceNetwork"}, - arg_group="V2 Endpoint" - ) - args_schema.endpoint_source_address = AAZStrArg( - options=["--endpoint-source-address"], - help="Address of the source of connection monitor endpoint (IP or domain name).", - arg_group="V2 Endpoint", - ) - args_schema.endpoint_source_coverage_level = AAZStrArg( - options=["--endpoint-source-coverage-level"], - help="Test coverage for the endpoint.", - enum={"AboveAverage": "AboveAverage", "Average": "Average", "BelowAverage": "BelowAverage", - "Default": "Default", "Full": "Full", "Low": "Low"}, - arg_group="V2 Endpoint" - ) - args_schema.endpoint_source_name = AAZStrArg( - options=["--endpoint-source-name"], - help="The name of the source of connection monitor endpoint. " - "If you are creating a V2 Connection Monitor, it's required.", - required=True, - arg_group="V2 Endpoint", - ) - args_schema.endpoint_source_resource_id = AAZStrArg( - options=["--endpoint-source-resource-id"], - help="Resource ID of the source of connection monitor endpoint. " - "If endpoint is intended to used as source, this option is required.", - required=True, - arg_group="V2 Endpoint", - ) - args_schema.endpoint_source_type = AAZStrArg( - options=["--endpoint-source-type"], - help="The endpoint type.", - enum={"AzureArcVM": "AzureArcVM", "AzureSubnet": "AzureSubnet", "AzureVM": "AzureVM", - "AzureVMSS": "AzureVMSS", "AzureVNet": "AzureVNet", "ExternalAddress": "ExternalAddress", - "MMAWorkspaceMachine": "MMAWorkspaceMachine", "MMAWorkspaceNetwork": "MMAWorkspaceNetwork"}, - arg_group="V2 Endpoint" - ) - - # V2 Output - args_schema.output_type = AAZStrArg( - options=["--type", "--output-type"], - help="Connection monitor output destination type. Currently, only \"Workspace\" is supported.", - enum={"Workspace": "Workspace"}, - arg_group="V2 Output" - ) - args_schema.workspace_ids = AAZListArg( - options=["--workspace-ids"], - help="Space-separated list of ids of log analytics workspace.", - arg_group="V2 Output" - ) - args_schema.workspace_ids.Element = AAZStrArg() - - # V2 Test Configuration - args_schema.test_config_name = AAZStrArg( - options=["--test-config-name"], - help="The name of the connection monitor test configuration. " - "If you are creating a V2 Connection Monitor, it's required.", - required=True, - arg_group="V2 Test Configuration", - ) - args_schema.test_config_frequency = AAZIntArg( - options=["--frequency"], - help="The frequency of test evaluation, in seconds.", - arg_group="V2 Test Configuration", - default=60, - ) - args_schema.test_config_http_method = AAZStrArg( - options=["--http-method"], - help="The HTTP method to use.", - arg_group="V2 Test Configuration", - enum={"Get": "Get", "Post": "Post"}, - ) - args_schema.test_config_http_path = AAZStrArg( - options=["--http-path"], - help='The path component of the URI. For instance, "/dir1/dir2".', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_http_port = AAZIntArg( - options=["--http-port"], - help='The port to connect to.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_http_valid_status_codes = AAZListArg( - options=["--http-valid-status-codes"], - help="Space-separated list of HTTP status codes to consider successful. For instance, '2xx 301-304 418'", - arg_group="V2 Test Configuration" - ) - args_schema.test_config_http_valid_status_codes.Element = AAZStrArg() - - args_schema.test_config_http_prefer_https = AAZBoolArg( - options=["--https-prefer"], - help='Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. ' - ' Allowed values: false, true.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_icmp_disable_trace_route = AAZBoolArg( - options=["--icmp-disable-trace-route"], - help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' - ' Allowed values: false, true.', - arg_group="V2 Test Configuration", - ) - - args_schema.test_config_preferred_ip_version = AAZStrArg( - options=["--preferred-ip-version"], - help='The preferred IP version to use in test evaluation. ' - 'The connection monitor may choose to use a different version depending on other parameters.', - arg_group="V2 Test Configuration", - enum={"IPv4": "IPv4", "IPv6": "IPv6"}, - ) - args_schema.test_config_protocol = AAZStrArg( - options=["--protocol"], - help='The protocol to use in test evaluation.', - arg_group="V2 Test Configuration", - enum={"Http": "Http", "Icmp": "Icmp", "Tcp": "Tcp"}, - ) - - args_schema.test_config_tcp_disable_trace_route = AAZBoolArg( - options=["--tcp-disable-trace-route"], - help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' - 'Allowed values: false, true.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_tcp_port = AAZIntArg( - options=["--tcp-port"], - help='The port to connect to.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_tcp_port_behavior = AAZStrArg( - options=["--tcp-port-behavior"], - help='Destination port behavior.', - arg_group="V2 Test Configuration", - enum={"ListenIfAvailable": "ListenIfAvailable", "None": "None"}, - ) - args_schema.test_config_threshold_failed_percent = AAZIntArg( - options=["--threshold-failed-percent"], - help='The maximum percentage of failed checks permitted for a test to evaluate as successful.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_threshold_round_trip_time = AAZFloatArg( - options=["--threshold-round-trip-time"], - help='The maximum round-trip time in milliseconds permitted for a test to evaluate as successful.', - arg_group="V2 Test Configuration", - ) - - # V2 Test Group - args_schema.test_group_disable = AAZBoolArg( - options=["--test-group-disable"], - help='Value indicating whether test group is disabled. false is default.', - arg_group="V2 Test Group", - ) - args_schema.test_group_name = AAZStrArg( - options=["--test-group-name"], - help='The name of the connection monitor test group.', - arg_group="V2 Test Group", - default="DefaultTestGroup" - ) - return args_schema - - def pre_operations(self): - process_nw_cm_v2_create_namespace(self) - get_network_watcher_from_location(self, watcher_name='network_watcher_name', rg_name='resource_group') - args = self.ctx.args - - # deal with endpoint - src_endpoint = { - "name": args.endpoint_source_name, - "resource_id": args.endpoint_source_resource_id, - "address": args.endpoint_source_address, - "type": args.endpoint_source_type, - "coverage_level": args.endpoint_source_coverage_level - } - dst_endpoint = { - "name": args.endpoint_dest_name, - "resource_id": args.endpoint_dest_resource_id, - "address": args.endpoint_dest_address, - "type": args.endpoint_dest_type, - "coverage_level": args.endpoint_dest_coverage_level - } - - # deal with test configuration - test_config = { - "name": args.test_config_name, - "test_frequency_sec": args.test_config_frequency, - "protocol": args.test_config_protocol, - "preferred_ip_version": args.test_config_preferred_ip_version, - } - if has_value(args.test_config_threshold_failed_percent) or \ - has_value(args.test_config_threshold_round_trip_time): - test_config['success_threshold'] = { - "checks_failed_percent": args.test_config_threshold_failed_percent, - "round_trip_time_ms": args.test_config_threshold_round_trip_time - } - if args.test_config_protocol == "Tcp": - tcp_config = { - "port": args.test_config_tcp_port, - "destination_port_behavior": args.test_config_tcp_port_behavior, - "disable_trace_route": args.test_config_tcp_disable_trace_route, - } - test_config['tcp_configuration'] = tcp_config - elif args.test_config_protocol == "Icmp": - icmp_config = {"disable_trace_route": args.test_config_icmp_disable_trace_route} - test_config['icmp_configuration'] = icmp_config - elif args.test_config_protocol == "Http": - http_config = { - "port": args.test_config_http_port, - "method": args.test_config_http_method, - "path": args.test_config_http_path, - "valid_status_code_ranges": args.test_config_http_valid_status_codes, - "prefer_https": args.test_config_http_prefer_https, - } - test_config['http_configuration'] = http_config - else: - raise ValidationError('Unsupported protocol: "{}" for test configuration'.format(args.test_config_protocol)) - - # deal with test group - test_group = { - "name": args.test_group_name, - "disable": args.test_group_disable, - "test-configurations": [tc['name'] for tc in [test_config]], - "sources": [e['name'] for e in [src_endpoint]], - "destinations": [e['name'] for e in [dst_endpoint]] - } - - # If 'workspace_ids' option is specified but 'output_type' is not - # then still it should be implicit that 'output-type' is 'Workspace' - # since only supported value for output_type is 'Workspace' currently. - if has_value(args.workspace_ids) and not has_value(args.output_type): - args.output_type = 'Workspace' - - if has_value(args.output_type) and has_value(args.workspace_ids): - if args.output_type != "Workspace": - raise ValidationError('Unsupported output type: "{}"'.format(args.output_type)) - args.outputs = [] - for workspace_id in args.workspace_ids: - output = { - "type": args.output_type, - "workspace_id": workspace_id, - } - args.outputs.append(output) - else: - args.outputs = [] - args.endpoints = [src_endpoint, dst_endpoint] - args.test_configurations = [test_config] - args.test_groups = [test_group] - - -class WatcherConnectionMonitorStart(_WatcherConnectionMonitorStart): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group_name._registered = False - args_schema.resource_group_name._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group_name' - ) - - -class WatcherConnectionMonitorStop(_WatcherConnectionMonitorStop): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group_name._registered = False - args_schema.resource_group_name._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group_name' - ) - - -class WatcherConnectionMonitorList(_WatcherConnectionMonitorList): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group_name._registered = False - args_schema.resource_group_name._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group_name' - ) - - -class WatcherConnectionMonitorShow(_WatcherConnectionMonitorShow): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group_name._registered = False - args_schema.resource_group_name._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group_name' - ) - - -class WatcherConnectionMonitorQuery(_WatcherConnectionMonitorQuery): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group_name._registered = False - args_schema.resource_group_name._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group_name' - ) - - -class WatcherConnectionMonitorDelete(_WatcherConnectionMonitorDelete): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group_name._registered = False - args_schema.resource_group_name._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group_name' - ) - - -class NwFlowLogCreate(_NwFlowLogCreate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group._required = False - args_schema.location._required = True - args_schema.flow_analytics_configuration._registered = False - args_schema.retention_policy._registered = False - args_schema.target_resource_id._registered = False - args_schema.traffic_analytics_interval = AAZIntArg( - options=['--interval'], arg_group="Traffic Analytics", - help="Interval in minutes at which to conduct flow analytics. Temporarily allowed values are 10 and 60.", - default=60, - fmt=AAZIntArgFormat( - maximum=60, - minimum=10, - ) - ) - args_schema.user_assigned_identity = AAZResourceIdArg( - options=["--user-assigned-identity"], - help="Name or ID of the ManagedIdentity Resource.", - required=False, - ) - args_schema.retention = AAZIntArg( - options=['--retention'], - help="Number of days to retain logs.", - ) - args_schema.traffic_analytics_enabled = AAZBoolArg( - options=['--traffic-analytics'], arg_group="Traffic Analytics", - help="Enable traffic analytics. Defaults to true if `--workspace` is provided." - ) - args_schema.traffic_analytics_workspace = AAZResourceIdArg( - options=['--workspace'], arg_group="Traffic Analytics", - help="Name or ID of a Log Analytics workspace. Must be in the same region of flow log", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.OperationalInsights/workspaces/{}" - ) - ) - args_schema.vnet = AAZResourceIdArg( - options=['--vnet'], - help="Name or ID of the Virtual Network Resource.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - ) - args_schema.subnet = AAZResourceIdArg( - options=['--subnet'], - help="Name or ID of Subnet.", - ) - args_schema.nic = AAZResourceIdArg( - options=['--nic'], - help="Name or ID of the Network Interface (NIC) Resource.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkInterfaces/{}" - ) - ) - args_schema.nsg = AAZResourceIdArg( - options=['--nsg'], - help="Name or ID of the network security group.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkSecurityGroups/{}" - ) - ) - args_schema.storage_account._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Storage/storageAccounts/{}" - ) - - return args_schema - - def pre_operations(self): - args = self.ctx.args - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group') - if has_value(args.subnet): - subnet = args.subnet.to_serialized_data() - if not is_valid_resource_id(subnet) and has_value(args.vnet): - args.subnet = args.vnet.to_serialized_data() + "/subnets/" + subnet - - if not has_value(args.enabled): - args.enabled = True - if sum(map(bool, [args.vnet, args.subnet, args.nic, args.nsg])) == 0: - raise RequiredArgumentMissingError("Please enter atleast one target resource ID.") - if sum(map(bool, [args.vnet, args.nic, args.nsg])) > 1: - raise MutuallyExclusiveArgumentError("Please enter only one target resource ID.") - - if has_value(args.subnet): - args.target_resource_id = args.subnet - elif has_value(args.vnet) and not has_value(args.subnet): - args.target_resource_id = args.vnet - elif has_value(args.nic): - args.target_resource_id = args.nic - elif has_value(args.nsg): - args.target_resource_id = args.nsg - - if has_value(args.user_assigned_identity): - user_assigned_identity = args.user_assigned_identity.to_serialized_data() - is_valid_miresource_id = validate_managed_identity_resource_id(user_assigned_identity) - if not is_valid_miresource_id: - raise CLIError('Managed Identity resource id is invalid') - if user_assigned_identity.lower() != 'none': - args.identity = { - "type": "UserAssigned", - "user_assigned_identities": {user_assigned_identity: {}} - } - else: - args.identity = { - "type": "None" - } - - if has_value(args.retention): - if args.retention > 0: - args.retention_policy = {"days": args.retention, "enabled": True} - - if has_value(args.traffic_analytics_workspace): - - workspace = get_arm_resource_by_id(self.cli_ctx, args.traffic_analytics_workspace.to_serialized_data()) - if not workspace: - raise CLIError('Name or ID of workspace is invalid') - - args.flow_analytics_configuration = {"workspace_id": workspace.properties['customerId'], - "workspace_region": workspace.location, - "workspace_resource_id": workspace.id} - if has_value(args.traffic_analytics_enabled): - args.flow_analytics_configuration['enabled'] = args.traffic_analytics_enabled - if has_value(args.traffic_analytics_interval): - args.flow_analytics_configuration['traffic_analytics_interval'] = args.traffic_analytics_interval - - -class NwFlowLogUpdate(_NwFlowLogUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group._required = False - args_schema.location._required = True - args_schema.flow_analytics_configuration._registered = False - args_schema.retention_policy._registered = False - args_schema.target_resource_id._registered = False - args_schema.retention = AAZIntArg( - options=['--retention'], - help="Number of days to retain logs.", - nullable=True, - ) - args_schema.traffic_analytics_interval = AAZIntArg( - options=['--interval'], arg_group="Traffic Analytics", - help="Interval in minutes at which to conduct flow analytics. Temporarily allowed values are 10 and 60.", - nullable=True, - fmt=AAZIntArgFormat( - maximum=60, - minimum=10, - ) - ) - args_schema.user_assigned_identity = AAZResourceIdArg( - options=["--user-assigned-identity"], - help="Name or ID of the ManagedIdentity Resource.", - required=False, - ) - args_schema.traffic_analytics_enabled = AAZBoolArg( - options=['--traffic-analytics'], arg_group="Traffic Analytics", nullable=True, - help="Enable traffic analytics. Defaults to true if `--workspace` is provided." - ) - args_schema.traffic_analytics_workspace = AAZResourceIdArg( - options=['--workspace'], arg_group="Traffic Analytics", nullable=True, - help="Name or ID of a Log Analytics workspace. Must be in the same region of flow log", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.OperationalInsights/workspaces/{}" - ) - ) - args_schema.vnet = AAZResourceIdArg( - options=['--vnet'], - help="Name or ID of the Virtual Network Resource.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}" - ) - ) - args_schema.subnet = AAZResourceIdArg( - options=['--subnet'], - help="Name or ID of Subnet.", - nullable=True, - ) - args_schema.nic = AAZResourceIdArg( - options=['--nic'], - help="Name or ID of the Network Interface (NIC) Resource.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkInterfaces/{}" - ) - ) - args_schema.nsg = AAZResourceIdArg( - options=['--nsg'], - help="Name or ID of the network security group.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/networkSecurityGroups/{}" - ) - ) - args_schema.storage_account._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Storage/storageAccounts/{}" - ) - - return args_schema - - def pre_operations(self): - args = self.ctx.args - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group') - if has_value(args.subnet): - subnet = args.subnet.to_serialized_data() - if not is_valid_resource_id(subnet) and has_value(args.vnet): - args.subnet = args.vnet.to_serialized_data() + "/subnets/" + subnet - - if sum(map(bool, [args.vnet, args.nic, args.nsg])) > 1: - raise MutuallyExclusiveArgumentError("Please enter only one target resource ID.") - if has_value(args.subnet): - args.target_resource_id = args.subnet - elif has_value(args.vnet) and not has_value(args.subnet): - args.target_resource_id = args.vnet - elif has_value(args.nic): - args.target_resource_id = args.nic - elif has_value(args.nsg): - args.target_resource_id = args.nsg - if has_value(args.retention) and args.retention > 0: - args.retention_policy = {"days": args.retention, "enabled": True} - - if has_value(args.user_assigned_identity): - user_assigned_identity = args.user_assigned_identity.to_serialized_data() - is_valid_miresource_id = validate_managed_identity_resource_id(user_assigned_identity) - if not is_valid_miresource_id: - raise CLIError('Managed Identity resource id is invalid') - if user_assigned_identity.lower() != 'none': - args.identity = { - "type": "UserAssigned", - "user_assigned_identities": {user_assigned_identity: {}} - } - else: - args.identity = { - "type": "None" - } - - if has_value(args.traffic_analytics_workspace): - workspace = get_arm_resource_by_id(self.cli_ctx, args.traffic_analytics_workspace.to_serialized_data()) - if not workspace: - raise CLIError('Name or ID of workspace is invalid') - - args.flow_analytics_configuration = { - "workspace_id": workspace.properties['customerId'], - "workspace_region": workspace.location, - "workspace_resource_id": workspace.id - } - if has_value(args.traffic_analytics_enabled): - args.flow_analytics_configuration['enabled'] = args.traffic_analytics_enabled - if has_value(args.traffic_analytics_interval): - args.flow_analytics_configuration['traffic_analytics_interval'] = args.traffic_analytics_interval - - -class NwFlowLogList(_NwFlowLogList): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group._registered = False - args_schema.resource_group._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location to identify the exclusive Network Watcher under a region. " - "Only one Network Watcher can be existed per subscription and region.", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group') - - -class NwFlowLogDelete(_NwFlowLogDelete): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.network_watcher_name._registered = False - args_schema.network_watcher_name._required = False - args_schema.resource_group._registered = False - args_schema.resource_group._required = False - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location to identify the exclusive Network Watcher under a region. " - "Only one Network Watcher can be existed per subscription and region.", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self, - watcher_name='network_watcher_name', - rg_name='resource_group') - - -class NwTroubleshootingStart(_NwTroubleshootingStart): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._required = False - args_schema.target_resource_id._registered = False - args_schema.target_resource_id._required = False - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - ) - args_schema.resource_type = AAZStrArg( - options=["-t", "--resource-type"], - help="The type of target resource to troubleshoot, if resource ID is not specified.", - enum={"vnetGateway": "virtualNetworkGateways", "vpnConnection": "connections"}, - ) - args_schema.resource = AAZResourceIdArg( - options=["--resource"], - help="Name or ID of the resource to troubleshoot.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/{resource_type}/{}" - ) - ) - args_schema.storage_account._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{}" - ) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - - return args_schema - - def pre_operations(self): - args = self.ctx.args - storage_usage = CLIError('usage error: --storage-account NAME_OR_ID [--storage-path PATH]') - if has_value(args.storage_path) and not has_value(args.storage_account): - raise storage_usage - if has_value(args.resource): - args.target_resource_id = args.resource - get_network_watcher_from_resource(self) - - -class NwTroubleshootingShow(_NwTroubleshootingShow): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._required = False - args_schema.target_resource_id._registered = False - args_schema.target_resource_id._required = False - args_schema.resource_group_name = AAZStrArg( - options=["-g", "--resource-group"], - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - ) - args_schema.resource_type = AAZStrArg( - options=["-t", "--resource-type"], - help="The resource type.", - enum={"vnetGateway": "virtualNetworkGateways", "vpnConnection": "connections"}, - ) - args_schema.resource = AAZResourceIdArg( - options=["--resource"], - help="Name or ID of the resource to troubleshoot.", - required=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/{resource_type}/{}" - ) - ) - args_schema.location = AAZResourceLocationArg( - registered=False, - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - get_network_watcher_from_resource(self) - if has_value(args.resource): - args.target_resource_id = args.resource - - -class WatcherConnectionMonitorOutputAdd(_WatcherConnectionMonitorOutputAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.output_type._required = True - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.output_type) and not has_value(args.workspace_id): - raise ValidationError('usage error: --type is specified but no other resource id provided') - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorOutputList(_WatcherConnectionMonitorOutputList): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorOutputRemove(_WatcherConnectionMonitorUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._required = False - args_schema.watcher_rg._required = False - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - args = self.ctx.args - args.outputs = [] - - -class WatcherConnectionMonitorEndpointAdd(_WatcherConnectionMonitorEndpointAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.filter_items._registered = False - args_schema.filter_type._registered = False - args_schema.scope_exclude._registered = False - args_schema.scope_include._registered = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True - ) - args_schema.address_exclude = AAZListArg( - options=["--address-exclude"], - help="List of address of the endpoint item which needs to be excluded to the endpoint scope.", - ) - args_schema.address_exclude.Element = AAZStrArg() - - args_schema.address_include = AAZListArg( - options=["--address-include"], - help="List of address of the endpoint item which needs to be included to the endpoint scope.", - ) - args_schema.address_include.Element = AAZStrArg() - - args_schema.dest_test_groups = AAZListArg( - options=["--dest-test-groups"], - help="Space-separated list of names for test group to reference as destination.", - arg_group="V2 Test Group" - ) - args_schema.dest_test_groups.Element = AAZStrArg() - - args_schema.source_test_groups = AAZListArg( - options=["--source-test-groups"], - help="Space-separated list of names for test group to reference as source.", - arg_group="V2 Test Group" - ) - args_schema.source_test_groups.Element = AAZStrArg() - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.dest_test_groups) or has_value(args.source_test_groups): - dest_test_groups, source_test_groups = args.dest_test_groups, args.source_test_groups - if dest_test_groups is None and source_test_groups is None: - raise ValidationError('usage error: endpoint has to be referenced from at least one existing ' - 'test group via --dest-test-groups/--source-test-groups') - get_network_watcher_from_location(self) - - args.scope_include = assign_aaz_list_arg( - args.scope_include, - args.address_include, - element_transformer=lambda _, tmp_ip: {"address": tmp_ip} - ) - - args.scope_exclude = assign_aaz_list_arg( - args.scope_exclude, - args.address_exclude, - element_transformer=lambda _, tmp_ip: {"address": tmp_ip} - ) - - def pre_instance_create(self): - args = self.ctx.args - name = args.endpoint_name.to_serialized_data() - instance = self.ctx.vars.instance - src_test_groups = set() - dst_test_groups = set() - if has_value(args.source_test_groups): - src_test_groups = set(args.source_test_groups.to_serialized_data()) - if has_value(args.dest_test_groups): - dst_test_groups = set(args.dest_test_groups.to_serialized_data()) - for test_group in instance.properties.test_groups: - if test_group.name.to_serialized_data() in src_test_groups: - test_group.sources.append(name) - if test_group.name.to_serialized_data() in dst_test_groups: - test_group.destinations.append(name) - - -class WatcherConnectionMonitorEndpointShow(_WatcherConnectionMonitorEndpointShow): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorEndpointList(_WatcherConnectionMonitorEndpointList): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorEndpointRemove(_WatcherConnectionMonitorEndpointRemove): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - args_schema.test_groups = AAZListArg( - options=["--test-groups"], - help="Space-separated list of names of test group which only need to " - "be affected if specified.", - arg_group="V2 Test Group", - ) - args_schema.test_groups.Element = AAZStrArg() - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - def post_instance_delete(self): - args = self.ctx.args - instance = self.ctx.vars.instance - name = args.endpoint_name.to_serialized_data() - # refresh test groups - - temp_test_groups = instance.properties.test_groups - if has_value(args.test_groups): - temp_test_groups = [t for t in instance.properties.test_groups - if t.name.to_serialized_data() in args.test_groups] - - for test_group in temp_test_groups: - test_group.sources = [tc for tc in test_group.sources if tc != name] - test_group.destinations = [tc for tc in test_group.destinations if tc != name] - - -class WatcherConnectionMonitorTestConfigurationAdd(_MonitorTestConfigurationAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - args_schema.http_request_headers._registered = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - args_schema.http_request_header = AAZDictArg( - options=["--http-request-header"], - help="The HTTP headers to transmit with the request. List of property=value pairs to define HTTP headers.", - arg_group="HTTP Protocol", - ) - args_schema.http_request_header.Element = AAZStrArg() - - args_schema.test_groups = AAZListArg( - options=["--test-groups"], - help="Space-separated list of names of test group which only need to be affected if specified.", - required=True, - ) - args_schema.test_groups.Element = AAZStrArg() - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - def pre_instance_create(self): - args = self.ctx.args - name = args.test_configuration_name.to_serialized_data() - - if has_value(args.http_request_header): - for tmp_name, val in args.http_request_header.items(): - args.http_request_headers.append({ - "name": tmp_name, - "value": val, - }) - - instance = self.ctx.vars.instance - if has_value(args.test_groups): - for test_group in instance.properties.test_groups: - if test_group.name.to_serialized_data() in args.test_groups: - test_group.test_configurations.append(name) - - -class WatcherConnectionMonitorTestConfigurationShow(_MonitorTestConfigurationShow): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorTestConfigurationList(_MonitorTestConfigurationList): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorTestConfigurationRemove(_MonitorTestConfigurationRemove): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - args_schema.test_groups = AAZListArg( - options=["--test-groups"], - help="Space-separated list of names of test group which only need to " - "be affected if specified.", - ) - args_schema.test_groups.Element = AAZStrArg() - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - def post_instance_delete(self): - args = self.ctx.args - instance = self.ctx.vars.instance - name = args.test_configuration_name.to_serialized_data() - - # refresh test groups - temp_test_groups = instance.properties.test_groups - if has_value(args.test_groups): - temp_test_groups = [t for t in instance.properties.test_groups - if t.name.to_serialized_data() in args.test_groups] - - for test_group in temp_test_groups: - test_group.test_configurations = [tc for tc in test_group.test_configurations if tc != name] - - -class WatcherConnectionMonitorTestGroupAdd(_WatcherConnectionMonitorTestGroupAdd): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.destinations._registered = False - args_schema.destinations._required = False - args_schema.sources._registered = False - args_schema.sources._required = False - args_schema.test_configurations._registered = False - args_schema.test_configurations._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - # V2 Endpoint - args_schema.endpoint_dest_name = AAZStrArg( - options=["--endpoint-dest-name"], - help="The name of the destination of connection monitor endpoint. " - "If you are creating a V2 Connection Monitor, it's required.", - arg_group="V2 Endpoint", - required=True - ) - args_schema.endpoint_source_name = AAZStrArg( - options=["--endpoint-source-name"], - help="The name of the source of connection monitor endpoint. " - "If you are creating a V2 Connection Monitor, it's required.", - arg_group="V2 Endpoint", - required=True - ) - args_schema.endpoint_dest_address = AAZStrArg( - options=["--endpoint-dest-address"], - help="Address of the destination of connection monitor endpoint (IP or domain name)", - arg_group="V2 Endpoint", - ) - args_schema.endpoint_dest_resource_id = AAZStrArg( - options=["--endpoint-dest-resource-id"], - help="Resource ID of the destination of connection monitor endpoint.", - arg_group="V2 Endpoint", - ) - args_schema.endpoint_source_address = AAZStrArg( - options=["--endpoint-source-address"], - help="Address of the source of connection monitor endpoint (IP or domain name).", - arg_group="V2 Endpoint", - ) - args_schema.endpoint_source_resource_id = AAZStrArg( - options=["--endpoint-source-resource-id"], - help="Resource ID of the source of connection monitor endpoint. " - "If endpoint is intended to used as source, this option is required.", - arg_group="V2 Endpoint", - ) - - # V2 Test Configuration - args_schema.test_config_name = AAZStrArg( - options=["--test-config-name"], - help="The name of the connection monitor test configuration. " - "If you are creating a V2 Connection Monitor, it's required.", - arg_group="V2 Test Configuration", - required=True - ) - args_schema.test_config_frequency = AAZStrArg( - options=["--frequency"], - help="The frequency of test evaluation, in seconds. Default: 60.", - arg_group="V2 Test Configuration", - ) - args_schema.test_config_http_method = AAZStrArg( - options=["--http-method"], - help="The HTTP method to use.", - arg_group="V2 Test Configuration", - enum={"Get": "Get", "Post": "Post"}, - ) - args_schema.test_config_http_path = AAZStrArg( - options=["--http-path"], - help='The path component of the URI. For instance, "/dir1/dir2".', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_http_port = AAZIntArg( - options=["--http-port"], - help='The port to connect to.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_http_valid_status_codes = AAZListArg( - options=["--http-valid-status-codes"], - help="Space-separated list of HTTP status codes to consider successful. For instance, '2xx 301-304 418'", - arg_group="V2 Test Configuration" - ) - args_schema.test_config_http_valid_status_codes.Element = AAZStrArg() - - args_schema.test_config_http_prefer_https = AAZBoolArg( - options=["--https-prefer"], - help='Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. ' - ' Allowed values: false, true.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_icmp_disable_trace_route = AAZBoolArg( - options=["--icmp-disable-trace-route"], - help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' - ' Allowed values: false, true.', - arg_group="V2 Test Configuration", - ) - - args_schema.test_config_preferred_ip_version = AAZStrArg( - options=["--preferred-ip-version"], - help='The preferred IP version to use in test evaluation. ' - 'The connection monitor may choose to use a different version depending on other parameters.', - arg_group="V2 Test Configuration", - enum={"IPv4": "IPv4", "IPv6": "IPv6"}, - ) - args_schema.test_config_protocol = AAZStrArg( - options=["--protocol"], - help='The protocol to use in test evaluation.', - arg_group="V2 Test Configuration", - enum={"Http": "Http", "Icmp": "Icmp", "Tcp": "Tcp"}, - ) - - args_schema.test_config_tcp_disable_trace_route = AAZBoolArg( - options=["--tcp-disable-trace-route"], - help='Value indicating whether path evaluation with trace route should be disabled. false is default. ' - 'Allowed values: false, true.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_tcp_port = AAZIntArg( - options=["--tcp-port"], - help='The port to connect to.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_threshold_failed_percent = AAZIntArg( - options=["--threshold-failed-percent"], - help='The maximum percentage of failed checks permitted for a test to evaluate as successful.', - arg_group="V2 Test Configuration", - ) - args_schema.test_config_threshold_round_trip_time = AAZFloatArg( - options=["--threshold-round-trip-time"], - help='The maximum round-trip time in milliseconds permitted for a test to evaluate as successful.', - arg_group="V2 Test Configuration", - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - # pylint: disable=too-many-boolean-expressions - def pre_instance_create(self): - args = self.ctx.args - instance = self.ctx.vars.instance - - # deal with endpoint - if has_value(args.endpoint_source_address) or has_value(args.endpoint_source_resource_id): - src_endpoint = { - "name": args.endpoint_source_name, - "resource_id": args.endpoint_source_resource_id, - "address": args.endpoint_source_address - } - instance.properties.endpoints.append(src_endpoint) - if has_value(args.endpoint_dest_address) or has_value(args.endpoint_dest_resource_id): - dst_endpoint = { - "name": args.endpoint_dest_name, - "resource_id": args.endpoint_dest_resource_id, - "address": args.endpoint_dest_address - } - instance.properties.endpoints.append(dst_endpoint) - - args.sources.append(args.endpoint_source_name) - args.destinations.append(args.endpoint_dest_name) - - # deal with test configuration - if has_value(args.test_config_protocol) or has_value(args.test_config_preferred_ip_version) or \ - has_value(args.test_config_threshold_failed_percent) or \ - has_value(args.test_config_threshold_round_trip_time) or \ - has_value(args.test_config_tcp_disable_trace_route) or has_value(args.test_config_tcp_port) or \ - has_value(args.test_config_icmp_disable_trace_route) or \ - has_value(args.test_config_http_port) or has_value(args.test_config_http_method) or \ - has_value(args.test_config_http_path) or has_value(args.test_config_http_valid_status_codes) or \ - has_value(args.test_config_http_prefer_https): - test_config = { - "name": args.test_config_name, - "test_frequency_sec": args.test_config_frequency, - "protocol": args.test_config_protocol, - "preferred_ip_version": args.test_config_preferred_ip_version, - } - if has_value(args.test_config_threshold_failed_percent) or \ - has_value(args.test_config_threshold_round_trip_time): - test_config['success_threshold'] = { - "checks_failed_percent": args.test_config_threshold_failed_percent, - "round_trip_time_ms": args.test_config_threshold_round_trip_time - } - if args.test_config_protocol == "Tcp": - tcp_config = { - "port": args.test_config_tcp_port, - "disable_trace_route": args.test_config_tcp_disable_trace_route, - } - test_config['tcp_configuration'] = tcp_config - elif args.test_config_protocol == "Icmp": - icmp_config = {"disable_trace_route": args.test_config_icmp_disable_trace_route} - test_config['icmp_configuration'] = icmp_config - elif args.test_config_protocol == "Http": - http_config = { - "port": args.test_config_http_port, - "method": args.test_config_http_method, - "path": args.test_config_http_path, - "valid_status_code_ranges": args.test_config_http_valid_status_codes, - "prefer_https": args.test_config_http_prefer_https, - } - test_config['http_configuration'] = http_config - else: - raise ValidationError('Unsupported protocol: "{}" for test configuration'.format( - args.test_config_protocol)) - instance.properties.test_configurations.append(test_config) - args.test_configurations.append(args.test_config_name) - - -class WatcherConnectionMonitorTestGroupShow(_WatcherConnectionMonitorTestGroupShow): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorTestGroupList(_WatcherConnectionMonitorTestGroupList): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._registered = False - args_schema.watcher_name._required = False - args_schema.watcher_rg._registered = False - args_schema.watcher_rg._required = False - - args_schema.location = AAZResourceLocationArg( - options=["-l", "--location"], - help="Location. Values from: `az account list-locations`. " - "You can configure the default location " - "using `az configure --defaults location=`.", - required=True, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - -class WatcherConnectionMonitorTestGroupRemove(_WatcherConnectionMonitorUpdate): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.watcher_name._required = False - args_schema.watcher_rg._required = False - args_schema.test_group_name = AAZStrArg( - options=["--test-group-name"], - help='The name of the connection monitor test group.', - required=True, - registered=False, - ) - return args_schema - - def pre_operations(self): - get_network_watcher_from_location(self) - - def pre_instance_update(self, instance): - args = self.ctx.args - name = args.test_group_name.to_serialized_data() - - instance = self.ctx.vars.instance - - new_test_groups, removed_test_group = [], None - for t in instance.properties.test_groups: - if t.name.to_serialized_data() == name: - removed_test_group = t - else: - new_test_groups.append(t) - - if removed_test_group is None: - raise ValidationError('test group: "{}" not exist'.format(name)) - instance.properties.test_groups = new_test_groups - - # deal with endpoints which are only referenced by this removed test group - removed_endpoints = [] - for e in (removed_test_group.sources.to_serialized_data() + - removed_test_group.destinations.to_serialized_data()): - tmp = [t for t in instance.properties.test_groups - if (e in t.sources.to_serialized_data() or e in t.destinations.to_serialized_data())] - if not tmp: - removed_endpoints.append(e) - instance.properties.endpoints = [e for e in instance.properties.endpoints - if e.name.to_serialized_data() not in removed_endpoints] - - # deal with test configurations which are only referenced by this remove test group - removed_test_configurations = [] - for c in removed_test_group.test_configurations.to_serialized_data(): - tmp = [t for t in instance.properties.test_groups if c in t.test_configurations.to_serialized_data()] - if not tmp: - removed_test_configurations.append(c) - instance.properties.test_configurations = [c for c in instance.properties.test_configurations - if c.name.to_serialized_data() not in removed_test_configurations] From 14f71f31739401071699f742891892565ca64522 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Tue, 24 Feb 2026 17:26:47 +1100 Subject: [PATCH 03/21] Fix docstring and condition check in _load_aaz_by_path, now we load recursively when args is empty --- src/azure-cli-core/azure/cli/core/aaz/_command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/aaz/_command.py b/src/azure-cli-core/azure/cli/core/aaz/_command.py index f8246a7842f..3f5e421b29a 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_command.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_command.py @@ -462,7 +462,7 @@ def _register_from_module(loader, mod, command_table, command_group_table): def _load_aaz_by_path(loader, base_path, base_module, args, command_table, command_group_table): """Recursively navigate the AAZ package tree guided by CLI args. - - args is None → full recursive load of all commands under this directory. + - args is None or empty → full recursive load of all commands under this directory. - args has items → try to match first arg as a command file or sub-directory, recurse with remaining args on match. - args exhausted / no match → load current level's commands and sub-group headers. @@ -513,7 +513,7 @@ def _load_aaz_by_path(loader, base_path, base_module, args, command_table, comma # Sub-directories elif not entry.startswith('_') and os.path.isdir(entry_path): sub_module = f"{base_module}.{entry}" - if args is None: + if not args: # Full load → recurse into every sub-directory _load_aaz_by_path(loader, entry_path, sub_module, None, command_table, command_group_table) else: From d86fa40ee496bbd358df6280de5de643316ec05d Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 25 Feb 2026 16:25:45 +1100 Subject: [PATCH 04/21] Fix some tests --- .../cli/command_modules/network/custom.py | 74 +++++++++++++------ .../network/dns/record_set/soa/_create.py | 23 ++++++ .../latest/network/lb/frontend_ip/_create.py | 4 + .../latest/network/nsg/rule/_create.py | 1 + .../latest/network/vnet/subnet/_create.py | 5 ++ .../latest/network/vnet/subnet/_update.py | 5 ++ .../tests/latest/test_network_commands.py | 5 +- 7 files changed, 90 insertions(+), 27 deletions(-) create mode 100644 src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_create.py diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index f6f9b3896db..86c85c44861 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -32,6 +32,8 @@ from .aaz.latest.network.vnet_gateway.vpn_client._generate_vpn_profile import GenerateVpnProfile as _VpnProfileGenerate from .aaz.latest.network.vnet_gateway.vpn_client._generate import Generate as _VpnClientPackageGenerate from .aaz.latest.network.vpn_connection._update import Update as _VpnConnectionUpdate +from .operations.latest.network.dns.record_set.soa._show import RecordSetSOAShow as DNSRecordSetSOAShow +from .operations.latest.network.public_ip._create import PublicIPCreate logger = get_logger(__name__) @@ -279,7 +281,7 @@ def show_ag_backend_health(cmd, resource_group_name, application_gateway_name, e child_name_1=http_settings ) - from .aaz.latest.network.application_gateway import HealthOnDemand + from .aaz.latest.network.application_gateway._health_on_demand import HealthOnDemand return LongRunningOperation(cmd.cli_ctx)( HealthOnDemand(cli_ctx=cmd.cli_ctx)(command_args={ "name": application_gateway_name, @@ -297,7 +299,7 @@ def show_ag_backend_health(cmd, resource_group_name, application_gateway_name, e }) ) - from .aaz.latest.network.application_gateway import Health + from .aaz.latest.network.application_gateway._health import Health return LongRunningOperation(cmd.cli_ctx)( Health(cli_ctx=cmd.cli_ctx)(command_args={ "name": application_gateway_name, @@ -409,7 +411,7 @@ def list_ag_waf_rule_sets(cmd, _type=None, version=None, group=None): # region ApplicationGatewayWAFPolicyRules PolicySettings def list_waf_policy_setting(cmd, resource_group_name, policy_name): - from .aaz.latest.network.application_gateway.waf_policy import Show + from .aaz.latest.network.application_gateway.waf_policy._show import Show return Show(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, "name": policy_name} @@ -458,7 +460,7 @@ def add_waf_managed_rule_set(cmd, resource_group_name, policy_name, "rule_group_overrides": rule_group_overrides } - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFManagedRuleSetAdd(Update): def pre_instance_update(self, instance): @@ -507,7 +509,7 @@ def update_waf_managed_rule_set(cmd, resource_group_name, policy_name, "rule_group_overrides": rule_group_overrides } - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFManagedRuleSetUpdate(Update): def pre_instance_update(self, instance): @@ -550,7 +552,7 @@ def remove_waf_managed_rule_set(cmd, resource_group_name, policy_name, """ Remove a managed rule set by rule set group name if rule_group_name is specified. Otherwise, remove all rule set. """ - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFManagedRuleSetRemove(Update): def pre_instance_update(self, instance): @@ -591,7 +593,7 @@ def pre_instance_update(self, instance): def list_waf_managed_rules(cmd, resource_group_name, policy_name): - from .aaz.latest.network.application_gateway.waf_policy import Show + from .aaz.latest.network.application_gateway.waf_policy._show import Show return Show(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, "name": policy_name @@ -601,7 +603,7 @@ def list_waf_managed_rules(cmd, resource_group_name, policy_name): # region ApplicationGatewayWAFPolicy ManagedRule Exception def remove_waf_managed_rule_exception(cmd, resource_group_name, policy_name): - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFExceptionRemove(Update): def pre_instance_update(self, instance): @@ -617,7 +619,7 @@ def pre_instance_update(self, instance): # region ApplicationGatewayWAFPolicy ManagedRule OwaspCrsExclusionEntry # pylint: disable=too-many-nested-blocks def remove_waf_managed_rule_exclusion(cmd, resource_group_name, policy_name): - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFExclusionRemove(Update): def pre_instance_update(self, instance): @@ -655,7 +657,7 @@ def add_waf_exclusion_rule_set(cmd, resource_group_name, policy_name, "rule_groups": rule_groups, } - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFExclusionRuleSetAdd(Update): def pre_instance_update(self, instance): @@ -702,7 +704,7 @@ def _has_exclusion(): def remove_waf_exclusion_rule_set(cmd, resource_group_name, policy_name, rule_set_type, rule_set_version, match_variable, selector_match_operator, selector, rule_group_name=None): - from .aaz.latest.network.application_gateway.waf_policy import Update + from .aaz.latest.network.application_gateway.waf_policy._update import Update class WAFExclusionRuleSetRemove(Update): def pre_instance_update(self, instance): @@ -1233,7 +1235,8 @@ def import_zone(cmd, resource_group_name, zone_name, file_name): rs["soa_record"]["host"] = root_soa["SOARecord"]["host"] rs_name = '@' elif rs_name == '@' and rs_type == 'ns': - root_ns = DNSRecordSetNSShow(cli_ctx=cmd.cli_ctx)(command_args={ + _DNSRecordSetNSShow = _record_show_func('ns') + root_ns = _DNSRecordSetNSShow(cli_ctx=cmd.cli_ctx)(command_args={ 'resource_group': resource_group_name, 'zone_name': zone_name, 'name': '@' @@ -1243,13 +1246,25 @@ def import_zone(cmd, resource_group_name, zone_name, file_name): try: rs["target_resource"] = rs.get("target_resource").get("id") if rs.get("target_resource") else None rs["traffic_management_profile"] = rs.get("traffic_management_profile").get("id") if rs.get("traffic_management_profile") else None - _record_create = _record_create_func(rs_type) - _record_create(cli_ctx=cmd.cli_ctx)(command_args={ - 'resource_group': resource_group_name, - 'zone_name': zone_name, - 'name': rs_name, - **rs - }) + if rs_type == 'soa': + # SOA records don't have a separate create command; use the base aaz create directly + from .aaz.latest.network.dns.record_set._create import Create as _RecordSetCreateBase + _RecordSetCreateBase(cli_ctx=cmd.cli_ctx)(command_args={ + 'resource_group': resource_group_name, + 'zone_name': zone_name, + 'name': rs_name, + 'record_type': 'SOA', + **rs + }) + else: + _record_create = _record_create_func(rs_type) + _record_create(cli_ctx=cmd.cli_ctx)(command_args={ + 'resource_group': resource_group_name, + 'zone_name': zone_name, + 'name': rs_name, + 'record_type': rs_type.upper(), + **rs + }) cum_records += record_count print("({}/{}) Imported {} records of type '{}' and name '{}'" @@ -1560,20 +1575,31 @@ def _add_record(record_set, record, record_type, is_list=False): record_set[record_property] = record +def _dns_record_set_import(record_type, operation): + """Dynamically import a DNS record set command class from the operations module.""" + import importlib + rt = record_type.lower() + op = operation.lower() + module_path = f"azure.cli.command_modules.network.operations.latest.network.dns.record_set.{rt}._{op}" + class_name = f"RecordSet{record_type.upper()}{operation.capitalize()}" + mod = importlib.import_module(module_path) + return getattr(mod, class_name) + + def _record_show_func(record_type): - return globals()["DNSRecordSet{}Show".format(record_type.upper())] + return _dns_record_set_import(record_type, "show") def _record_create_func(record_type): - return globals()["DNSRecordSet{}Create".format(record_type.upper())] + return _dns_record_set_import(record_type, "create") def _record_delete_func(record_type): - return globals()["DNSRecordSet{}Delete".format(record_type.upper())] + return _dns_record_set_import(record_type, "delete") def _record_update_func(record_type): - return globals()["DNSRecordSet{}Update".format(record_type.upper())] + return _dns_record_set_import(record_type, "update") def _add_save_record(cmd, record, record_type, record_set_name, resource_group_name, zone_name, @@ -2401,7 +2427,7 @@ def create_public_ip(cmd, resource_group_name, public_ip_address_name, location= public_ip_args["public_ip_prefix"] = public_ip_prefix # reuse prefix information - from .aaz.latest.network.public_ip.prefix import Show + from .aaz.latest.network.public_ip.prefix._show import Show pip_obj = Show(cli_ctx=cmd.cli_ctx)(command_args={'resource_group': resource_group_name, 'name': public_ip_prefix_name}) version = pip_obj['publicIPAddressVersion'] sku = pip_obj['sku']['name'] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_create.py new file mode 100644 index 00000000000..239812da4f1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_create.py @@ -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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long, protected-access, too-few-public-methods + +from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate + + +class RecordSetSOACreate(RecordSetCreate): + """Internal command for updating SOA record sets via PUT. + + SOA record sets are created automatically with the DNS zone and cannot be + created independently. This class is used only by _add_save_record in + custom.py to persist SOA record changes through the create-or-update + (PUT) API. + """ + + def pre_operations(self): + args = self.ctx.args + args.record_type = "SOA" + args.name = "@" diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py index e97971095e9..d60f14c067a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py @@ -9,6 +9,10 @@ from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate +from knack.log import get_logger + +logger = get_logger(__name__) + class LBFrontendIPCreate(_LBFrontendIPCreate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py index 7253425540a..05c2cb392c4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py @@ -7,6 +7,7 @@ from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat from azure.cli.command_modules.network.aaz.latest.network.nsg.rule._create import Create as _NSGRuleCreate +from azure.cli.command_modules.network.custom import _handle_plural_or_singular class NSGRuleCreate(_NSGRuleCreate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py index b22c05eb92f..55679856db3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py @@ -9,6 +9,11 @@ from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._create import Create as _VNetSubnetCreate +from azure.cli.command_modules.network.custom import _handle_plural_or_singular, subnet_disable_ple_msg, subnet_disable_pls_msg + +from knack.log import get_logger + +logger = get_logger(__name__) class VNetSubnetCreate(_VNetSubnetCreate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py index 6d185f96843..d85bef1eee6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py @@ -9,6 +9,11 @@ from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._update import Update as _VNetSubnetUpdate +from azure.cli.command_modules.network.custom import _handle_plural_or_singular, subnet_disable_ple_msg, subnet_disable_pls_msg + +from knack.log import get_logger + +logger = get_logger(__name__) class VNetSubnetUpdate(_VNetSubnetUpdate): diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_commands.py b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_commands.py index 33045322887..614ffd5d5f8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_commands.py @@ -7910,9 +7910,8 @@ def test_network_vnet_gateway_nat_rule_sub_cmd(self, resource_group): class NetworkSecurityPartnerProviderScenarioTest(ScenarioTest): - def __init__(self, method_name, config_file=None, recording_dir=None, recording_name=None, recording_processors=None, - replay_processors=None, recording_patches=None, replay_patches=None): - super().__init__(method_name) + def setUp(self): + super().setUp() self.cmd('extension add -n virtual-wan') @unittest.skip('Decouple with virtual-wan bump API version') From fb39a3edff5fb452b430e5d2ecfe6cc2d89e9fb0 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Thu, 26 Feb 2026 14:33:27 +1100 Subject: [PATCH 05/21] Fix import --- .../command_modules/network/_completers.py | 6 +- .../command_modules/network/_validators.py | 2 +- .../cli/command_modules/network/custom.py | 80 ++++++++++--------- 3 files changed, 46 insertions(+), 42 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/_completers.py b/src/azure-cli/azure/cli/command_modules/network/_completers.py index 734805b2a33..adbf08b339e 100644 --- a/src/azure-cli/azure/cli/command_modules/network/_completers.py +++ b/src/azure-cli/azure/cli/command_modules/network/_completers.py @@ -11,7 +11,7 @@ # pylint: disable=inconsistent-return-statements @Completer def subnet_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument - from .aaz.latest.network.vnet.subnet import List + from .aaz.latest.network.vnet.subnet._list import List if namespace.resource_group_name and namespace.virtual_network_name: rg = namespace.resource_group_name vnet = namespace.virtual_network_name @@ -27,7 +27,7 @@ def get_lb_subresource_completion_list(prop): # pylint: disable=inconsistent-return-statements @Completer def completer(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument - from .aaz.latest.network.lb import Show + from .aaz.latest.network.lb._show import Show try: lb_name = namespace.load_balancer_name except AttributeError: @@ -46,7 +46,7 @@ def get_ag_subresource_completion_list(prop): # pylint: disable=inconsistent-return-statements @Completer def completer(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument - from .aaz.latest.network.application_gateway import Show + from .aaz.latest.network.application_gateway._show import Show try: ag_name = namespace.application_gateway_name except AttributeError: diff --git a/src/azure-cli/azure/cli/command_modules/network/_validators.py b/src/azure-cli/azure/cli/command_modules/network/_validators.py index f91b15c8a7e..c2be2306088 100644 --- a/src/azure-cli/azure/cli/command_modules/network/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/network/_validators.py @@ -713,7 +713,7 @@ def get_network_watcher_from_location(remove=False, watcher_name='watcher_name', rg_name='watcher_rg'): def _validator(cmd, namespace): from azure.mgmt.core.tools import parse_resource_id - from .aaz.latest.network.watcher import List + from .aaz.latest.network.watcher._list import List location = namespace.location watcher_list = List(cli_ctx=cmd.cli_ctx)(command_args={}) diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 86c85c44861..236cb592fde 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -370,7 +370,7 @@ def _flatten(collection, expand_property_fn): def show_ag_waf_config(cmd, resource_group_name, application_gateway_name): - from .aaz.latest.network.application_gateway import Show + from .aaz.latest.network.application_gateway._show import Show return Show(cli_ctx=cmd.cli_ctx)(command_args={ "name": application_gateway_name, "resource_group": resource_group_name @@ -378,7 +378,7 @@ def show_ag_waf_config(cmd, resource_group_name, application_gateway_name): def list_ag_waf_rule_sets(cmd, _type=None, version=None, group=None): - from .aaz.latest.network.application_gateway.waf_config import ListRuleSets + from .aaz.latest.network.application_gateway.waf_config._list_rule_sets import ListRuleSets rule_sets = ListRuleSets(cli_ctx=cmd.cli_ctx)(command_args={})["value"] filtered_sets = [] @@ -772,7 +772,7 @@ def pre_instance_update(self, instance): # region DdosProtectionPlans def create_ddos_plan(cmd, resource_group_name, ddos_plan_name, location=None, tags=None, vnets=None): from azure.cli.core.commands import LongRunningOperation - from azure.cli.command_modules.network.aaz.latest.network.ddos_protection import Create + from azure.cli.command_modules.network.aaz.latest.network.ddos_protection._create import Create Create_Ddos_Protection = Create(cli_ctx=cmd.cli_ctx) args = { "name": ddos_plan_name, @@ -803,13 +803,13 @@ def create_ddos_plan(cmd, resource_group_name, ddos_plan_name, location=None, ta "name": ddos_plan_name, "resource_group": resource_group_name, } - from azure.cli.command_modules.network.aaz.latest.network.ddos_protection import Show + from azure.cli.command_modules.network.aaz.latest.network.ddos_protection._show import Show Show_Ddos_Protection = Show(cli_ctx=cmd.cli_ctx) return Show_Ddos_Protection(show_args) def update_ddos_plan(cmd, resource_group_name, ddos_plan_name, tags=None, vnets=None): - from azure.cli.command_modules.network.aaz.latest.network.ddos_protection import Update + from azure.cli.command_modules.network.aaz.latest.network.ddos_protection._update import Update Update_Ddos_Protection = Update(cli_ctx=cmd.cli_ctx) args = { "name": ddos_plan_name, @@ -818,7 +818,7 @@ def update_ddos_plan(cmd, resource_group_name, ddos_plan_name, tags=None, vnets= if tags is not None: args['tags'] = tags if vnets is not None: - from azure.cli.command_modules.network.aaz.latest.network.ddos_protection import Show + from azure.cli.command_modules.network.aaz.latest.network.ddos_protection._show import Show show_args = { "name": ddos_plan_name, "resource_group": resource_group_name, @@ -1794,7 +1794,7 @@ def download_generated_loa_as_pdf(cmd, basename = basename + '.pdf' file_path = os.path.join(dirname, basename) - from .aaz.latest.network.express_route.port import GenerateLoa + from .aaz.latest.network.express_route.port._generate_loa import GenerateLoa response = GenerateLoa(cli_ctx=cmd.cli_ctx)(command_args={'resource_group': resource_group_name, 'name': express_route_port_name, 'customer_name': customer_name}) @@ -1941,7 +1941,7 @@ def list_load_balancer_mapping(cmd, resource_group_name, load_balancer_name, bac args["ip_configuration"] = {'id': request['ip_configuration']} if 'ip_address' in request: args["ip_address"] = request['ip_address'] - from .aaz.latest.network.lb import ListMapping + from .aaz.latest.network.lb._list_mapping import ListMapping return ListMapping(cli_ctx=cmd.cli_ctx)(command_args=args) @@ -2069,8 +2069,8 @@ def _get_nic_ip_config(nic, name): def add_nic_ip_config_address_pool(cmd, resource_group_name, network_interface_name, ip_config_name, backend_address_pool, load_balancer_name=None, application_gateway_name=None): - from .aaz.latest.network.nic.ip_config.lb_pool import Add as _LBPoolAdd - from .aaz.latest.network.nic.ip_config.ag_pool import Add as _AGPoolAdd + from .aaz.latest.network.nic.ip_config.lb_pool._add import Add as _LBPoolAdd + from .aaz.latest.network.nic.ip_config.ag_pool._add import Add as _AGPoolAdd class LBPoolAdd(_LBPoolAdd): def _output(self, *args, **kwargs): @@ -2096,8 +2096,8 @@ def _output(self, *args, **kwargs): def remove_nic_ip_config_address_pool(cmd, resource_group_name, network_interface_name, ip_config_name, backend_address_pool, load_balancer_name=None, application_gateway_name=None): - from .aaz.latest.network.nic.ip_config.lb_pool import Remove as LBPoolRemove - from .aaz.latest.network.nic.ip_config.ag_pool import Remove as AGPoolRemove + from .aaz.latest.network.nic.ip_config.lb_pool._remove import Remove as LBPoolRemove + from .aaz.latest.network.nic.ip_config.ag_pool._remove import Remove as AGPoolRemove arguments = { "ip_config_name": ip_config_name, @@ -2125,7 +2125,7 @@ def _handle_plural_or_singular(args, plural_name, singular_name): def list_nsg_rules(cmd, resource_group_name, network_security_group_name, include_default=False): - from .aaz.latest.network.nsg import Show + from .aaz.latest.network.nsg._show import Show nsg = Show(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, "name": network_security_group_name @@ -2141,7 +2141,7 @@ def _create_network_watchers(cmd, resource_group_name, locations, tags): if resource_group_name is None: raise CLIError("usage error: '--resource-group' required when enabling new regions") - from .aaz.latest.network.watcher import Create + from .aaz.latest.network.watcher._create import Create for location in locations: Create(cli_ctx=cmd.cli_ctx)(command_args={ 'name': 'NetworkWatcher_{}'.format(location), @@ -2152,7 +2152,7 @@ def _create_network_watchers(cmd, resource_group_name, locations, tags): def _update_network_watchers(cmd, watchers, tags): - from .aaz.latest.network.watcher import Update + from .aaz.latest.network.watcher._update import Update for watcher in watchers: id_parts = parse_resource_id(watcher['id']) watcher_rg = id_parts['resource_group'] @@ -2167,7 +2167,7 @@ def _update_network_watchers(cmd, watchers, tags): def _delete_network_watchers(cmd, watchers): - from .aaz.latest.network.watcher import Delete + from .aaz.latest.network.watcher._delete import Delete for watcher in watchers: from azure.cli.core.commands import LongRunningOperation id_parts = parse_resource_id(watcher['id']) @@ -2184,7 +2184,7 @@ def _delete_network_watchers(cmd, watchers): def configure_network_watcher(cmd, locations, resource_group_name=None, enabled=None, tags=None): - from .aaz.latest.network.watcher import List + from .aaz.latest.network.watcher._list import List watcher_list = List(cli_ctx=cmd.cli_ctx)(command_args={}) locations_list = [location.lower() for location in locations] existing_watchers = [w for w in watcher_list if w["location"] in locations_list] @@ -2382,13 +2382,13 @@ def show_nw_flow_logging(cmd, watcher_rg, watcher_name, location=None, resource_ flow_log_name=None): # deprecated approach to show flow log if nsg is not None: - from .aaz.latest.network.watcher.flow_log import ConfigureFlowLog + from .aaz.latest.network.watcher.flow_log._configure_flow_log import ConfigureFlowLog return ConfigureFlowLog(cli_ctx=cmd.cli_ctx)(command_args={"network_watcher_name": watcher_name, "resource_group": watcher_rg, "target_resource_id": nsg}) # new approach to show flow log - from .aaz.latest.network.watcher.flow_log import Show + from .aaz.latest.network.watcher.flow_log._show import Show return Show(cli_ctx=cmd.cli_ctx)(command_args={"network_watcher_name": watcher_name, "resource_group": watcher_rg, "name": flow_log_name}) @@ -2479,7 +2479,7 @@ def create_traffic_manager_profile(cmd, traffic_manager_profile_name, resource_g profile_status="Enabled", ttl=30, tags=None, interval=None, timeout=None, max_failures=None, monitor_custom_headers=None, status_code_ranges=None, max_return=None): - from .aaz.latest.network.traffic_manager.profile import Create + from .aaz.latest.network.traffic_manager.profile._create import Create if monitor_path is None and monitor_protocol == 'HTTP': monitor_path = '/' args = { @@ -2510,7 +2510,7 @@ def update_traffic_manager_profile(cmd, traffic_manager_profile_name, resource_g monitor_protocol=None, monitor_port=None, monitor_path=None, ttl=None, timeout=None, interval=None, max_failures=None, monitor_custom_headers=None, status_code_ranges=None, max_return=None): - from .aaz.latest.network.traffic_manager.profile import Update + from .aaz.latest.network.traffic_manager.profile._update import Update args = { "name": traffic_manager_profile_name, "resource_group": resource_group_name @@ -2551,7 +2551,7 @@ def create_traffic_manager_endpoint(cmd, resource_group_name, profile_name, endp endpoint_location=None, endpoint_monitor_status=None, min_child_endpoints=None, min_child_ipv4=None, min_child_ipv6=None, geo_mapping=None, monitor_custom_headers=None, subnets=None, always_serve=None): - from .aaz.latest.network.traffic_manager.endpoint import Create + from .aaz.latest.network.traffic_manager.endpoint._create import Create args = { "name": endpoint_name, "type": endpoint_type, @@ -2583,7 +2583,7 @@ def update_traffic_manager_endpoint(cmd, resource_group_name, profile_name, endp weight=None, min_child_endpoints=None, min_child_ipv4=None, min_child_ipv6=None, geo_mapping=None, subnets=None, monitor_custom_headers=None, always_serve=None): - from .aaz.latest.network.traffic_manager.endpoint import Update + from .aaz.latest.network.traffic_manager.endpoint._update import Update args = { "name": endpoint_name, "type": endpoint_type, @@ -2623,7 +2623,7 @@ def update_traffic_manager_endpoint(cmd, resource_group_name, profile_name, endp def list_traffic_manager_endpoints(cmd, resource_group_name, profile_name, endpoint_type=None): - from .aaz.latest.network.traffic_manager.profile import Show + from .aaz.latest.network.traffic_manager.profile._show import Show profile = Show(cli_ctx=cmd.cli_ctx)(command_args={ "profile_name": profile_name, "resource_group": resource_group_name, @@ -2635,7 +2635,7 @@ def list_traffic_manager_endpoints(cmd, resource_group_name, profile_name, endpo # region VirtualNetworks def list_available_ips(cmd, resource_group_name, virtual_network_name): - from .aaz.latest.network.vnet import Show + from .aaz.latest.network.vnet._show import Show vnet = Show(cli_ctx=cmd.cli_ctx)(command_args={ "name": virtual_network_name, "resource_group": resource_group_name, @@ -2643,7 +2643,7 @@ def list_available_ips(cmd, resource_group_name, virtual_network_name): start_ip = vnet["addressSpace"]["addressPrefixes"][0].split("/")[0] - from .aaz.latest.network.vnet import CheckIpAddress + from .aaz.latest.network.vnet._check_ip_address import CheckIpAddress return CheckIpAddress(cli_ctx=cmd.cli_ctx)(command_args={ "name": virtual_network_name, "resource_group": resource_group_name, @@ -2652,7 +2652,7 @@ def list_available_ips(cmd, resource_group_name, virtual_network_name): def subnet_list_available_ips(cmd, resource_group_name, virtual_network_name, subnet_name): - from .aaz.latest.network.vnet.subnet import Show + from .aaz.latest.network.vnet.subnet._show import Show subnet = Show(cli_ctx=cmd.cli_ctx)(command_args={ "name": subnet_name, "resource_group": resource_group_name, @@ -2665,7 +2665,7 @@ def subnet_list_available_ips(cmd, resource_group_name, virtual_network_name, su address_prefix = subnet["addressPrefix"] start_ip = address_prefix.split("/")[0] - from .aaz.latest.network.vnet import CheckIpAddress + from .aaz.latest.network.vnet._check_ip_address import CheckIpAddress return CheckIpAddress(cli_ctx=cmd.cli_ctx)(command_args={ "name": virtual_network_name, "resource_group": resource_group_name, @@ -2674,7 +2674,7 @@ def subnet_list_available_ips(cmd, resource_group_name, virtual_network_name, su def sync_vnet_peering(cmd, resource_group_name, virtual_network_name, virtual_network_peering_name): - from .aaz.latest.network.vnet.peering import Show + from .aaz.latest.network.vnet.peering._show import Show try: peering = Show(cli_ctx=cmd.cli_ctx)(command_args={ "name": virtual_network_peering_name, @@ -2788,7 +2788,8 @@ def create_vpn_connection(cmd, resource_group_name, connection_name, vnet_gatewa def list_vpn_connections(cmd, resource_group_name, virtual_network_gateway_name=None): - from .aaz.latest.network.vpn_connection import List, ListConnection + from .aaz.latest.network.vpn_connection._list import List + from .aaz.latest.network.vpn_connection._list_connection import ListConnection if virtual_network_gateway_name: return ListConnection(cli_ctx=cmd.cli_ctx)(command_args={"resource_group": resource_group_name, "vnet_gateway": virtual_network_gateway_name}) @@ -2872,8 +2873,8 @@ def create_virtual_hub(cmd, tags=None): from azure.core.exceptions import HttpResponseError from azure.cli.core.commands import LongRunningOperation - from .aaz.latest.network.routeserver import Show - from .aaz.latest.network.routeserver import List + from .aaz.latest.network.routeserver._show import Show + from .aaz.latest.network.routeserver._list import List list_result = List(cli_ctx=cmd.cli_ctx)(command_args={'resource_group': resource_group_name}) for x in list_result: @@ -2890,11 +2891,12 @@ def create_virtual_hub(cmd, "hub_routing_preference": hub_routing_preference, "auto_scale_config": auto_scale_config } - from .aaz.latest.network.routeserver import Create + from .aaz.latest.network.routeserver._create import Create vhub_poller = Create(cli_ctx=cmd.cli_ctx)(command_args=args) LongRunningOperation(cmd.cli_ctx)(vhub_poller) - from .aaz.latest.network.routeserver.ip_config import Create as IPConfigCreate, Delete as IPConfigDelete + from .aaz.latest.network.routeserver.ip_config._create import Create as IPConfigCreate + from .aaz.latest.network.routeserver.ip_config._delete import Delete as IPConfigDelete try: create_poller = IPConfigCreate(cli_ctx=cmd.cli_ctx)(command_args={ 'name': 'Default', @@ -2915,7 +2917,7 @@ def create_virtual_hub(cmd, LongRunningOperation(cmd.cli_ctx)(delete_poller) except HttpResponseError: pass - from .aaz.latest.network.routeserver import Delete + from .aaz.latest.network.routeserver._delete import Delete Delete(cli_ctx=cmd.cli_ctx)(command_args={'resource_group': resource_group_name, 'name': virtual_hub_name}) raise ex @@ -2924,7 +2926,8 @@ def create_virtual_hub(cmd, def delete_virtual_hub(cmd, resource_group_name, virtual_hub_name): from azure.cli.core.commands import LongRunningOperation - from .aaz.latest.network.routeserver.ip_config import List as IPConfigList, Delete as IPConfigDelete + from .aaz.latest.network.routeserver.ip_config._list import List as IPConfigList + from .aaz.latest.network.routeserver.ip_config._delete import Delete as IPConfigDelete ip_configs = IPConfigList(cli_ctx=cmd.cli_ctx)(command_args={ 'vhub_name': virtual_hub_name, 'resource_group': resource_group_name @@ -2939,7 +2942,7 @@ def delete_virtual_hub(cmd, resource_group_name, virtual_hub_name): LongRunningOperation(cmd.cli_ctx)(poller) except StopIteration: pass - from .aaz.latest.network.routeserver import Delete + from .aaz.latest.network.routeserver._delete import Delete return Delete(cli_ctx=cmd.cli_ctx)(command_args={'resource_group': resource_group_name, 'name': virtual_hub_name}) # endregion @@ -2967,7 +2970,8 @@ def remove_nw_connection_monitor_test_group(cmd, connection_monitor_name, locati def create_ddos_custom_policy(cmd, ddos_custom_policy_name, resource_group_name, location=None, tags=None, detection_rule_name=None, detection_mode=None, traffic_type=None, packets_per_second=None, no_wait=None): - from .aaz.latest.network.ddos_custom_policy import Create as DdosCustomPolicyCreate, Show as DdosCustomPolicyShow + from .aaz.latest.network.ddos_custom_policy._create import Create as DdosCustomPolicyCreate + from .aaz.latest.network.ddos_custom_policy._show import Show as DdosCustomPolicyShow from .operations.ddos_custom_policy import convert_ddos_custom_policy_to_snake_case, combine_old_and_new_custom_policy from ._template_builder import build_ddos_custom_policy From cbb014e672413cee1379b89d1d5e6e662b7d8f83 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 27 Feb 2026 11:40:11 +1100 Subject: [PATCH 06/21] Disable compact aaz to walk around pipeline error temprorily --- .azure-pipelines/templates/automation_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/templates/automation_test.yml b/.azure-pipelines/templates/automation_test.yml index dab01694208..61c117abca7 100644 --- a/.azure-pipelines/templates/automation_test.yml +++ b/.azure-pipelines/templates/automation_test.yml @@ -35,7 +35,7 @@ steps: displayName: "Use Python ${{ parameters.pythonVersion }}" - template: ./azdev_setup.yml parameters: - EnableCompactAAZ: true + EnableCompactAAZ: false - bash: | set -ev From 60b3cf6573b6e3ca7a48a22d773bdb4453bec857 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 27 Feb 2026 15:51:42 +1100 Subject: [PATCH 07/21] Fix import error --- .../latest/network/application_gateway/private_link/_add.py | 2 +- .../network/operations/latest/network/watcher/_helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py index 8dc672ff38b..f3042f65ec3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py @@ -90,7 +90,7 @@ def pre_instance_create(self): child_name_1=args.subnet ) - from .aaz.latest.network.vnet import Show + from azure.cli.command_modules.network.aaz.latest.network.vnet._show import Show vnet = Show(cli_ctx=self.cli_ctx)(command_args={ "name": metadata["name"], "resource_group": metadata["resource_group"] diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py index 5b116ff1d3c..21284330a34 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py @@ -16,7 +16,7 @@ def get_network_watcher_from_location(cmd, watcher_name="watcher_name", rg_name="watcher_rg"): - from ..aaz.latest.network.watcher._list import List + from azure.cli.command_modules.network.aaz.latest.network.watcher._list import List args = cmd.ctx.args location = args.location.to_serialized_data() From 92273b1bb0e9b1f734ef1ab4f657127e3d46ea03 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 27 Feb 2026 16:00:33 +1100 Subject: [PATCH 08/21] Rename start stop schedule to adapt to the new load commands by folder path --- .../mi/{startstopschedule => start_stop_schedule}/__cmd_group.py | 0 .../sql/mi/{startstopschedule => start_stop_schedule}/__init__.py | 0 .../sql/mi/{startstopschedule => start_stop_schedule}/_create.py | 0 .../sql/mi/{startstopschedule => start_stop_schedule}/_delete.py | 0 .../sql/mi/{startstopschedule => start_stop_schedule}/_list.py | 0 .../sql/mi/{startstopschedule => start_stop_schedule}/_show.py | 0 .../sql/mi/{startstopschedule => start_stop_schedule}/_update.py | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/__cmd_group.py (100%) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/__init__.py (100%) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/_create.py (100%) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/_delete.py (100%) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/_list.py (100%) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/_show.py (100%) rename src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/{startstopschedule => start_stop_schedule}/_update.py (100%) diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/__cmd_group.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__cmd_group.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/__cmd_group.py diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__init__.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/__init__.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__init__.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/__init__.py diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_create.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_create.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_create.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_create.py diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_delete.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_delete.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_delete.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_delete.py diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_list.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_list.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_list.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_list.py diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_show.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_show.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_show.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_show.py diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_update.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_update.py similarity index 100% rename from src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_update.py rename to src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/start_stop_schedule/_update.py From 94107f78838c62c846183995ca569d12b9c2f57f Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 27 Feb 2026 16:55:52 +1100 Subject: [PATCH 09/21] Fix VNetSubnetCreate import issue --- .../latest/network/application_gateway/private_link/_add.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py index f3042f65ec3..a0e26e8903b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py @@ -102,6 +102,7 @@ def pre_instance_create(self): subnet_name = parse_resource_id(args.subnet.to_serialized_data())["child_name_1"] from azure.cli.core.commands import LongRunningOperation + from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._create import Create as VNetSubnetCreate poller = VNetSubnetCreate(cli_ctx=self.cli_ctx)(command_args={ "name": subnet_name, "vnet_name": metadata["name"], From b49e25d110693056584b98cf88a828395215bc9c Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 27 Feb 2026 16:59:50 +1100 Subject: [PATCH 10/21] Fix express validator import --- .../cli/command_modules/network/custom.py | 30 ------------------- .../latest/network/express_route/_create.py | 28 +++++++++++++++++ .../latest/network/express_route/_update.py | 28 +++++++++++++++++ .../network/express_route/port/_create.py | 28 +++++++++++++++++ 4 files changed, 84 insertions(+), 30 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 236cb592fde..91625b33f6f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -1742,36 +1742,6 @@ def _validate_ipv6_address_prefixes(prefixes): # region ExpressRoute ports - - -def _validate_bandwidth(bandwidth, mbps=True): - unit = 'mbps' if mbps else 'gbps' - if bandwidth is None: - return - if len(bandwidth) == 1: - bandwidth_comps = bandwidth[0].to_serialized_data().split(' ') - else: - bandwidth_comps = bandwidth.to_serialized_data() - - usage_error = InvalidArgumentValueError('--bandwidth INT {Mbps,Gbps}') - if len(bandwidth_comps) == 1: - bandwidth_comps.append(unit) - if len(bandwidth_comps) > 2: - raise usage_error - input_value = bandwidth_comps[0] - input_unit = bandwidth_comps[1].lower() - if float(input_value) and input_unit in ['mbps', 'gbps']: - if input_unit == unit: - converted_bandwidth = float(bandwidth_comps[0]) - elif input_unit == 'gbps': - converted_bandwidth = float(bandwidth_comps[0]) * 1000 - else: - converted_bandwidth = float(bandwidth_comps[0]) / 1000 - else: - raise usage_error - return converted_bandwidth - - def update_express_route_port(cmd, instance, tags=None): with cmd.update_context(instance) as c: c.set_param('tags', tags, True) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py index e3849a64837..1aadf4ec00e 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py @@ -9,6 +9,34 @@ from azure.cli.command_modules.network.aaz.latest.network.express_route._create import Create as _ExpressRouteCreate +def _validate_bandwidth(bandwidth, mbps=True): + unit = 'mbps' if mbps else 'gbps' + if bandwidth is None: + return + if len(bandwidth) == 1: + bandwidth_comps = bandwidth[0].to_serialized_data().split(' ') + else: + bandwidth_comps = bandwidth.to_serialized_data() + + usage_error = InvalidArgumentValueError('--bandwidth INT {Mbps,Gbps}') + if len(bandwidth_comps) == 1: + bandwidth_comps.append(unit) + if len(bandwidth_comps) > 2: + raise usage_error + input_value = bandwidth_comps[0] + input_unit = bandwidth_comps[1].lower() + if float(input_value) and input_unit in ['mbps', 'gbps']: + if input_unit == unit: + converted_bandwidth = float(bandwidth_comps[0]) + elif input_unit == 'gbps': + converted_bandwidth = float(bandwidth_comps[0]) * 1000 + else: + converted_bandwidth = float(bandwidth_comps[0]) / 1000 + else: + raise usage_error + return converted_bandwidth + + class ExpressRouteCreate(_ExpressRouteCreate): @classmethod diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py index 71b85e45bf1..345e2b94505 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py @@ -9,6 +9,34 @@ from azure.cli.command_modules.network.aaz.latest.network.express_route._update import Update as _ExpressRouteUpdate +def _validate_bandwidth(bandwidth, mbps=True): + unit = 'mbps' if mbps else 'gbps' + if bandwidth is None: + return + if len(bandwidth) == 1: + bandwidth_comps = bandwidth[0].to_serialized_data().split(' ') + else: + bandwidth_comps = bandwidth.to_serialized_data() + + usage_error = InvalidArgumentValueError('--bandwidth INT {Mbps,Gbps}') + if len(bandwidth_comps) == 1: + bandwidth_comps.append(unit) + if len(bandwidth_comps) > 2: + raise usage_error + input_value = bandwidth_comps[0] + input_unit = bandwidth_comps[1].lower() + if float(input_value) and input_unit in ['mbps', 'gbps']: + if input_unit == unit: + converted_bandwidth = float(bandwidth_comps[0]) + elif input_unit == 'gbps': + converted_bandwidth = float(bandwidth_comps[0]) * 1000 + else: + converted_bandwidth = float(bandwidth_comps[0]) / 1000 + else: + raise usage_error + return converted_bandwidth + + class ExpressRouteUpdate(_ExpressRouteUpdate): @classmethod def _build_arguments_schema(cls, *args, **kwargs): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py index 2645f7c3e55..550fcb44bf9 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py @@ -9,6 +9,34 @@ from azure.cli.command_modules.network.aaz.latest.network.express_route.port._create import Create as _ExpressRoutePortCreate +def _validate_bandwidth(bandwidth, mbps=True): + unit = 'mbps' if mbps else 'gbps' + if bandwidth is None: + return + if len(bandwidth) == 1: + bandwidth_comps = bandwidth[0].to_serialized_data().split(' ') + else: + bandwidth_comps = bandwidth.to_serialized_data() + + usage_error = InvalidArgumentValueError('--bandwidth INT {Mbps,Gbps}') + if len(bandwidth_comps) == 1: + bandwidth_comps.append(unit) + if len(bandwidth_comps) > 2: + raise usage_error + input_value = bandwidth_comps[0] + input_unit = bandwidth_comps[1].lower() + if float(input_value) and input_unit in ['mbps', 'gbps']: + if input_unit == unit: + converted_bandwidth = float(bandwidth_comps[0]) + elif input_unit == 'gbps': + converted_bandwidth = float(bandwidth_comps[0]) * 1000 + else: + converted_bandwidth = float(bandwidth_comps[0]) / 1000 + else: + raise usage_error + return converted_bandwidth + + class ExpressRoutePortCreate(_ExpressRoutePortCreate): @classmethod From 10917cac8c099f72717f7b670fd38f23255455c6 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Tue, 3 Mar 2026 15:57:50 +1100 Subject: [PATCH 11/21] optimize aaz and operations in private dns --- .../cli/command_modules/network/custom.py | 28 + .../command_modules/privatedns/__init__.py | 10 + .../privatedns/aaz/latest/network/__init__.py | 2 - .../latest/network/private_dns/__init__.py | 2 - .../network/private_dns/link/__init__.py | 2 - .../network/private_dns/link/vnet/__init__.py | 8 - .../private_dns/record_set/__init__.py | 8 - .../network/private_dns/zone/__init__.py | 8 - .../command_modules/privatedns/commands.py | 60 -- .../cli/command_modules/privatedns/custom.py | 627 ++---------------- .../privatedns/operations/__init__.py | 4 + .../privatedns/operations/latest/__init__.py | 6 + .../operations/latest/network/__init__.py | 6 + .../latest/network/private_dns/__init__.py | 6 + .../network/private_dns/link/__init__.py | 6 + .../network/private_dns/link/vnet/__init__.py | 6 + .../network/private_dns/link/vnet/_create.py | 28 + .../private_dns/record_set/__init__.py | 6 + .../network/private_dns/record_set/_base.py | 97 +++ .../private_dns/record_set/a/__init__.py | 6 + .../private_dns/record_set/a/_create.py | 21 + .../private_dns/record_set/a/_delete.py | 20 + .../network/private_dns/record_set/a/_list.py | 20 + .../network/private_dns/record_set/a/_show.py | 20 + .../private_dns/record_set/a/_update.py | 20 + .../private_dns/record_set/aaaa/__init__.py | 6 + .../private_dns/record_set/aaaa/_create.py | 21 + .../private_dns/record_set/aaaa/_delete.py | 20 + .../private_dns/record_set/aaaa/_list.py | 20 + .../private_dns/record_set/aaaa/_show.py | 20 + .../private_dns/record_set/aaaa/_update.py | 20 + .../private_dns/record_set/cname/__init__.py | 6 + .../private_dns/record_set/cname/_create.py | 21 + .../private_dns/record_set/cname/_delete.py | 20 + .../private_dns/record_set/cname/_list.py | 20 + .../private_dns/record_set/cname/_show.py | 20 + .../private_dns/record_set/cname/_update.py | 20 + .../private_dns/record_set/mx/__init__.py | 6 + .../private_dns/record_set/mx/_create.py | 21 + .../private_dns/record_set/mx/_delete.py | 20 + .../private_dns/record_set/mx/_list.py | 20 + .../private_dns/record_set/mx/_show.py | 20 + .../private_dns/record_set/mx/_update.py | 20 + .../private_dns/record_set/ptr/__init__.py | 6 + .../private_dns/record_set/ptr/_create.py | 21 + .../private_dns/record_set/ptr/_delete.py | 20 + .../private_dns/record_set/ptr/_list.py | 20 + .../private_dns/record_set/ptr/_show.py | 20 + .../private_dns/record_set/ptr/_update.py | 20 + .../private_dns/record_set/soa/__init__.py | 6 + .../private_dns/record_set/soa/_show.py | 29 + .../private_dns/record_set/soa/_update.py | 12 + .../private_dns/record_set/srv/__init__.py | 6 + .../private_dns/record_set/srv/_create.py | 21 + .../private_dns/record_set/srv/_delete.py | 20 + .../private_dns/record_set/srv/_list.py | 20 + .../private_dns/record_set/srv/_show.py | 20 + .../private_dns/record_set/srv/_update.py | 20 + .../private_dns/record_set/txt/__init__.py | 6 + .../private_dns/record_set/txt/_create.py | 21 + .../private_dns/record_set/txt/_delete.py | 20 + .../private_dns/record_set/txt/_list.py | 20 + .../private_dns/record_set/txt/_show.py | 20 + .../private_dns/record_set/txt/_update.py | 20 + .../network/private_dns/zone/__init__.py | 6 + .../network/private_dns/zone/_create.py | 31 + 66 files changed, 1075 insertions(+), 678 deletions(-) create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 91625b33f6f..3492e173387 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -236,6 +236,8 @@ def create_application_gateway(cmd, application_gateway_name, resource_group_nam def remove_ag_identity(cmd, resource_group_name, application_gateway_name, no_wait=False): + from .aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate + class IdentityRemove(_ApplicationGatewayUpdate): def pre_operations(self): args = self.ctx.args @@ -327,6 +329,8 @@ def set_ag_waf_config(cmd, resource_group_name, application_gateway_name, enable "rule_set_version": rule_set_version } + from .aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate + class WAFConfigSet(_ApplicationGatewayUpdate): def pre_operations(self): args = self.ctx.args @@ -913,6 +917,8 @@ def add_dns_delegation(cmd, child_zone, parent_zone, child_rg, child_zone_name): def create_dns_zone(cmd, resource_group_name, zone_name, parent_zone_name=None, tags=None, if_none_match=False): + from .aaz.latest.network.dns.zone._create import Create as _DNSZoneCreate + created_zone = _DNSZoneCreate(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, "zone_name": zone_name, @@ -928,6 +934,8 @@ def create_dns_zone(cmd, resource_group_name, zone_name, parent_zone_name=None, def show_dns_soa_record_set(cmd, resource_group_name, zone_name, record_type): + from .operations.latest.network.dns.record_set.soa._show import RecordSetSOAShow as DNSRecordSetSOAShow + return DNSRecordSetSOAShow(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, "zone_name": zone_name @@ -940,6 +948,8 @@ def update_dns_soa_record(cmd, resource_group_name, zone_name, host=None, email= record_set_name = '@' record_type = 'soa' + from .operations.latest.network.dns.record_set.soa._show import RecordSetSOAShow as DNSRecordSetSOAShow + record_set = DNSRecordSetSOAShow(cli_ctx=cmd.cli_ctx)(command_args={ "zone_name": zone_name, "resource_group": resource_group_name @@ -983,6 +993,8 @@ def _type_to_property_name(key): def export_zone(cmd, resource_group_name, zone_name, file_name=None): # pylint: disable=too-many-branches from time import localtime, strftime + from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone_file + from .aaz.latest.network.dns.record_set._list import List as _DNSRecordSetListByZone record_sets = _DNSRecordSetListByZone(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, @@ -1144,6 +1156,9 @@ def import_zone(cmd, resource_group_name, zone_name, file_name): except OSError as e: raise UnclassifiedUserFault(e) + from azure.cli.command_modules.network.zone_file.parse_zone_file import parse_zone_file + from .operations.latest.network.dns.record_set.soa._show import RecordSetSOAShow as DNSRecordSetSOAShow + zone_obj = parse_zone_file(file_text, zone_name) origin = zone_name @@ -1208,6 +1223,8 @@ def import_zone(cmd, resource_group_name, zone_name, file_name): print('== BEGINNING ZONE IMPORT: {} ==\n'.format(zone_name), file=sys.stderr) + from .aaz.latest.network.dns.zone._create import Create as _DNSZoneCreate + _DNSZoneCreate(cli_ctx=cmd.cli_ctx)(command_args={ 'resource_group': resource_group_name, 'zone_name': zone_name, @@ -2436,6 +2453,8 @@ def create_public_ip(cmd, resource_group_name, public_ip_address_name, location= if ddos_protection_plan: public_ip_args['ddos_protection_plan'] = ddos_protection_plan + from .operations.latest.network.public_ip._create import PublicIPCreate + return PublicIPCreate(cli_ctx=cmd.cli_ctx)(command_args=public_ip_args) @@ -2689,8 +2708,12 @@ def generate_vpn_client(cmd, resource_group_name, virtual_network_gateway_name, generate_args['authentication_method'] = authentication_method generate_args['radius_server_auth_certificate'] = radius_server_auth_certificate generate_args['client_root_certificates'] = client_root_certificates + from .aaz.latest.network.vnet_gateway.vpn_client._generate_vpn_profile import GenerateVpnProfile as _VpnProfileGenerate + return _VpnProfileGenerate(cli_ctx=cmd.cli_ctx)(command_args=generate_args) # legacy implementation + from .aaz.latest.network.vnet_gateway.vpn_client._generate import Generate as _VpnClientPackageGenerate + return _VpnClientPackageGenerate(cli_ctx=cmd.cli_ctx)(command_args=generate_args) # endregion @@ -2769,6 +2792,7 @@ def list_vpn_connections(cmd, resource_group_name, virtual_network_gateway_name= # region IPSec Policy Commands def clear_vnet_gateway_ipsec_policies(cmd, resource_group_name, gateway_name, no_wait=False): + from .aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate class VnetGatewayIpsecPoliciesClear(_VnetGatewayUpdate): @@ -2792,6 +2816,8 @@ def pre_instance_update(self, instance): def clear_vpn_conn_ipsec_policies(cmd, resource_group_name, connection_name, no_wait=False): + from .aaz.latest.network.vpn_connection._update import Update as _VpnConnectionUpdate + class VpnConnIpsecPoliciesClear(_VpnConnectionUpdate): def _output(self, *args, **kwargs): @@ -2812,6 +2838,8 @@ def pre_operations(self): def remove_vnet_gateway_aad(cmd, resource_group_name, gateway_name, no_wait=False): + from .aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate + class VnetGatewayAadRemove(_VnetGatewayUpdate): def pre_operations(self): args = self.ctx.args diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/__init__.py index ba88e0895c2..eb0cac8a156 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/__init__.py @@ -37,6 +37,16 @@ def load_command_table(self, args): aaz_pkg_name=aaz.__name__, args=args ) + try: + from . import operations + except ImportError: + operations = None + if operations: + load_aaz_command_table( + loader=self, + aaz_pkg_name=operations.__name__, + args=args + ) load_command_table(self, args) return self.command_table diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/__init__.py index 5a9d61963d6..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/__init__.py @@ -7,5 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/vnet/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/vnet/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/link/vnet/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/record_set/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/record_set/__init__.py index 3d2174ed2f2..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/record_set/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/record_set/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._list_by_type import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/zone/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/zone/__init__.py index db73033039b..7e832c711e8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/zone/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/aaz/latest/network/private_dns/zone/__init__.py @@ -7,11 +7,3 @@ # pylint: skip-file # flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/commands.py b/src/azure-cli/azure/cli/command_modules/privatedns/commands.py index 23cf3c8a939..6767bb52633 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/commands.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/commands.py @@ -17,69 +17,9 @@ def load_command_table(self, _): ) with self.command_group("network private-dns zone", network_privatedns_zone_sdk) as g: - from .aaz.latest.network.private_dns.zone import List as PrivateDNSZoneList, Show as PrivateDNSZoneShow - from .custom import PrivateDNSZoneCreate - self.command_table["network private-dns zone create"] = PrivateDNSZoneCreate(loader=self) - self.command_table["network private-dns zone list"] = PrivateDNSZoneList(loader=self, table_transformer=transform_privatedns_zone_table_output) - self.command_table["network private-dns zone show"] = PrivateDNSZoneShow(loader=self, table_transformer=transform_privatedns_zone_table_output) g.custom_command("import", "import_zone") g.custom_command("export", "export_zone") - with self.command_group("network private-dns link vnet"): - from .aaz.latest.network.private_dns.link.vnet import List as PrivateDNSLinkVNetList, Show as PrivateDNSLinkVNetShow - from .custom import PrivateDNSLinkVNetCreate - self.command_table["network private-dns link vnet create"] = PrivateDNSLinkVNetCreate(loader=self) - self.command_table["network private-dns link vnet list"] = PrivateDNSLinkVNetList(loader=self, table_transformer=transform_privatedns_link_table_output) - self.command_table["network private-dns link vnet show"] = PrivateDNSLinkVNetShow(loader=self, table_transformer=transform_privatedns_link_table_output) - - from .custom import RecordSetACreate, RecordSetAAAACreate, RecordSetCNAMECreate, RecordSetMXCreate, RecordSetPTRCreate, RecordSetSRVCreate, RecordSetTXTCreate - self.command_table["network private-dns record-set a create"] = RecordSetACreate(loader=self) - self.command_table["network private-dns record-set aaaa create"] = RecordSetAAAACreate(loader=self) - self.command_table["network private-dns record-set cname create"] = RecordSetCNAMECreate(loader=self) - self.command_table["network private-dns record-set mx create"] = RecordSetMXCreate(loader=self) - self.command_table["network private-dns record-set ptr create"] = RecordSetPTRCreate(loader=self) - self.command_table["network private-dns record-set srv create"] = RecordSetSRVCreate(loader=self) - self.command_table["network private-dns record-set txt create"] = RecordSetTXTCreate(loader=self) - - from .custom import RecordSetADelete, RecordSetAAAADelete, RecordSetCNAMEDelete, RecordSetMXDelete, RecordSetPTRDelete, RecordSetSRVDelete, RecordSetTXTDelete - self.command_table["network private-dns record-set a delete"] = RecordSetADelete(loader=self) - self.command_table["network private-dns record-set aaaa delete"] = RecordSetAAAADelete(loader=self) - self.command_table["network private-dns record-set cname delete"] = RecordSetCNAMEDelete(loader=self) - self.command_table["network private-dns record-set mx delete"] = RecordSetMXDelete(loader=self) - self.command_table["network private-dns record-set ptr delete"] = RecordSetPTRDelete(loader=self) - self.command_table["network private-dns record-set srv delete"] = RecordSetSRVDelete(loader=self) - self.command_table["network private-dns record-set txt delete"] = RecordSetTXTDelete(loader=self) - - from .aaz.latest.network.private_dns.record_set import List as RecordSetList - from .custom import RecordSetAList, RecordSetAAAAList, RecordSetCNAMEList, RecordSetMXList, RecordSetPTRList, RecordSetSRVList, RecordSetTXTList - self.command_table["network private-dns record-set list"] = RecordSetList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set a list"] = RecordSetAList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set aaaa list"] = RecordSetAAAAList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set cname list"] = RecordSetCNAMEList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set mx list"] = RecordSetMXList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set ptr list"] = RecordSetPTRList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set srv list"] = RecordSetSRVList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set txt list"] = RecordSetTXTList(loader=self, table_transformer=transform_privatedns_record_set_table_output) - - from .custom import RecordSetAShow, RecordSetAAAAShow, RecordSetCNAMEShow, RecordSetMXShow, RecordSetPTRShow, RecordSetSOAShow, RecordSetSRVShow, RecordSetTXTShow - self.command_table["network private-dns record-set a show"] = RecordSetAShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set aaaa show"] = RecordSetAAAAShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set cname show"] = RecordSetCNAMEShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set mx show"] = RecordSetMXShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set ptr show"] = RecordSetPTRShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set soa show"] = RecordSetSOAShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set srv show"] = RecordSetSRVShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - self.command_table["network private-dns record-set txt show"] = RecordSetTXTShow(loader=self, table_transformer=transform_privatedns_record_set_table_output) - - from .custom import RecordSetAUpdate, RecordSetAAAAUpdate, RecordSetCNAMEUpdate, RecordSetMXUpdate, RecordSetPTRUpdate, RecordSetSRVUpdate, RecordSetTXTUpdate - self.command_table["network private-dns record-set a update"] = RecordSetAUpdate(loader=self) - self.command_table["network private-dns record-set aaaa update"] = RecordSetAAAAUpdate(loader=self) - self.command_table["network private-dns record-set cname update"] = RecordSetCNAMEUpdate(loader=self) - self.command_table["network private-dns record-set mx update"] = RecordSetMXUpdate(loader=self) - self.command_table["network private-dns record-set ptr update"] = RecordSetPTRUpdate(loader=self) - self.command_table["network private-dns record-set srv update"] = RecordSetSRVUpdate(loader=self) - self.command_table["network private-dns record-set txt update"] = RecordSetTXTUpdate(loader=self) - supported_records = ['a', 'aaaa', 'mx', 'ptr', 'srv', 'txt'] for record in supported_records: with self.command_group('network private-dns record-set {}'.format(record)) as g: diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/custom.py b/src/azure-cli/azure/cli/command_modules/privatedns/custom.py index ca83af0a88d..910987a0878 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/custom.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/custom.py @@ -9,23 +9,15 @@ from azure.cli.core.util import CLIError from azure.cli.core.commands import LongRunningOperation from azure.cli.core.commands.client_factory import get_mgmt_service_client -from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone_file -from azure.cli.command_modules.network.zone_file.parse_zone_file import parse_zone_file -from azure.cli.core.aaz import register_command -from azure.core.exceptions import HttpResponseError - -from .aaz.latest.network.private_dns.link.vnet import Create as _PrivateDNSLinkVNetCreate -from .aaz.latest.network.private_dns.zone import Create as _PrivateDNSZoneCreate, Show as PrivateDNSZoneShow -from .aaz.latest.network.private_dns.record_set import Create as _RecordSetCreate, Delete as _RecordSetDelete, \ - ListByType as _RecordSetList, Show as _RecordSetShow, Update as _RecordSetUpdate logger = get_logger(__name__) # pylint: disable=too-many-statements, too-many-locals, too-many-branches def import_zone(cmd, resource_group_name, private_zone_name, file_name): - from azure.cli.core.util import read_file_content import sys + from azure.cli.core.util import read_file_content + from azure.core.exceptions import HttpResponseError from azure.mgmt.privatedns.models import RecordSet from azure.cli.core.azclierror import FileOperationError, UnclassifiedUserFault @@ -40,6 +32,8 @@ def import_zone(cmd, resource_group_name, private_zone_name, file_name): except OSError as e: raise UnclassifiedUserFault(e) + from azure.cli.command_modules.network.zone_file.parse_zone_file import parse_zone_file + zone_obj = parse_zone_file(file_text, private_zone_name) origin = private_zone_name record_sets = {} @@ -95,6 +89,9 @@ def import_zone(cmd, resource_group_name, private_zone_name, file_name): print('== BEGINNING ZONE IMPORT: {} ==\n'.format(private_zone_name), file=sys.stderr) + from .aaz.latest.network.private_dns.zone._show import Show as PrivateDNSZoneShow + from .operations.latest.network.private_dns.zone._create import PrivateDNSZoneCreate + try: PrivateDNSZoneShow(cli_ctx=cmd.cli_ctx)(command_args={ "name": private_zone_name, @@ -224,6 +221,8 @@ def export_zone(cmd, resource_group_name, private_zone_name, file_name=None): zone_obj[record_set_name][record_type].append(record_obj) + from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone_file + zone_file_content = make_zone_file(zone_obj) print(zone_file_content) if file_name: @@ -265,580 +264,6 @@ def _build_record(cmd, data): .format(record_type, data['name'], ke)) -class PrivateDNSZoneCreate(_PrivateDNSZoneCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.if_none_match._registered = False - args_schema.location._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - if args.name.to_serialized_data().endswith(".local"): - logger.warning( - "Please be aware that DNS names ending with `.local` are reserved for use with multicast DNS and " - "may not work as expected with some operating systems. " - "For details refer to your operating systems documentation." - ) - args.location = "global" - args.if_none_match = "*" - - -class PrivateDNSLinkVNetCreate(_PrivateDNSLinkVNetCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZResourceIdArgFormat - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.virtual_network._fmt = AAZResourceIdArgFormat( - template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" - "/virtualNetworks/{}" - ) - args_schema.registration_enabled._required = True - args_schema.virtual_network._required = True - args_schema.if_none_match._registered = False - args_schema.location._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.location = "global" - args.if_none_match = "*" - - -# region RecordSetCreate -class RecordSetCreate(_RecordSetCreate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.record_type._required = False - args_schema.record_type._registered = False - args_schema.if_none_match._registered = False - args_schema.a_records._registered = False - args_schema.aaaa_records._registered = False - args_schema.cname_record._registered = False - args_schema.mx_records._registered = False - args_schema.ptr_records._registered = False - args_schema.soa_record._registered = False - args_schema.srv_records._registered = False - args_schema.txt_records._registered = False - - return args_schema - - -@register_command("network private-dns record-set a create") -class RecordSetACreate(RecordSetCreate): - """ Create an empty A record set. - - :example: Create an empty A record set. - az network private-dns record-set a create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - args.if_none_match = "*" - - -@register_command("network private-dns record-set aaaa create") -class RecordSetAAAACreate(RecordSetCreate): - """ Create an empty AAAA record set. - - :example: Create an empty AAAA record set. - az network private-dns record-set aaaa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - args.if_none_match = "*" - - -@register_command("network private-dns record-set cname create") -class RecordSetCNAMECreate(RecordSetCreate): - """ Create an empty CNAME record set. - - :example: Create an empty CNAME record set. - az network private-dns record-set cname create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - args.if_none_match = "*" - - -@register_command("network private-dns record-set mx create") -class RecordSetMXCreate(RecordSetCreate): - """ Create an empty MX record set. - - :example: Create an empty MX record set. - az network private-dns record-set mx create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - args.if_none_match = "*" - - -@register_command("network private-dns record-set ptr create") -class RecordSetPTRCreate(RecordSetCreate): - """ Create an empty PTR record set. - - :example: Create an empty PTR record set. - az network private-dns record-set ptr create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - args.if_none_match = "*" - - -@register_command("network private-dns record-set srv create") -class RecordSetSRVCreate(RecordSetCreate): - """ Create an empty SRV record set. - - :example: Create an empty SRV record set. - az network private-dns record-set srv create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - args.if_none_match = "*" - - -@register_command("network private-dns record-set txt create") -class RecordSetTXTCreate(RecordSetCreate): - """ Create an empty TXT record set. - - :example: Create an empty TXT record set. - az network private-dns record-set txt create -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" - args.if_none_match = "*" -# endregion RecordSetCreate - - -# region RecordSetDelete -class RecordSetDelete(_RecordSetDelete): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.record_type._required = False - args_schema.record_type._registered = False - - return args_schema - - -@register_command("network private-dns record-set a delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetADelete(RecordSetDelete): - """ Delete an A record set and all associated records. - - :example: Delete an A record set and all associated records. - az network private-dns record-set a delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network private-dns record-set aaaa delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetAAAADelete(RecordSetDelete): - """ Delete an AAAA record set and all associated records. - - :example: Delete an AAAA record set and all associated records. - az network private-dns record-set aaaa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network private-dns record-set cname delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetCNAMEDelete(RecordSetDelete): - """ Delete a CNAME record set and its associated record. - - :example: Delete a CNAME record set and its associated record. - az network private-dns record-set cname delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - - -@register_command("network private-dns record-set mx delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetMXDelete(RecordSetDelete): - """ Delete an MX record set and all associated records. - - :example: Delete an MX record set and all associated records. - az network private-dns record-set mx delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network private-dns record-set ptr delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetPTRDelete(RecordSetDelete): - """ Delete a PTR record set and all associated records. - - :example: Delete a PTR record set and all associated records. - az network private-dns record-set ptr delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network private-dns record-set srv delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetSRVDelete(RecordSetDelete): - """ Delete an SRV record set and all associated records. - - :example: Delete an SRV record set and all associated records. - az network private-dns record-set srv delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network private-dns record-set txt delete", confirmation="Are you sure you want to perform this operation?") -class RecordSetTXTDelete(RecordSetDelete): - """ Delete a TXT record set and all associated records. - - :example: Delete a TXT record set and all associated records. - az network private-dns record-set txt delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" -# endregion RecordSetDelete - - -# region RecordSetList -class RecordSetList(_RecordSetList): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.record_type._required = False - args_schema.record_type._registered = False - - return args_schema - - -@register_command("network private-dns record-set a list") -class RecordSetAList(RecordSetList): - """ List all A record sets in a zone. - - :example: List all A record sets in a zone. - az network private-dns record-set a list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network private-dns record-set aaaa list") -class RecordSetAAAAList(RecordSetList): - """ List all AAAA record sets in a zone. - - :example: List all AAAA record sets in a zone. - az network private-dns record-set aaaa list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network private-dns record-set cname list") -class RecordSetCNAMEList(RecordSetList): - """ List the CNAME record set in a zone. - - :example: List the CNAME record set in a zone. - az network private-dns record-set cname list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - - -@register_command("network private-dns record-set mx list") -class RecordSetMXList(RecordSetList): - """ List all MX record sets in a zone. - - :example: List all MX record sets in a zone. - az network private-dns record-set mx list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network private-dns record-set ptr list") -class RecordSetPTRList(RecordSetList): - """ List all PTR record sets in a zone. - - :example: List all PTR record sets in a zone. - az network private-dns record-set ptr list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network private-dns record-set srv list") -class RecordSetSRVList(RecordSetList): - """ List all SRV record sets in a zone. - - :example: List all SRV record sets in a zone. - az network private-dns record-set srv list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network private-dns record-set txt list") -class RecordSetTXTList(RecordSetList): - """ List all TXT record sets in a zone. - - :example: List all TXT record sets in a zone. - az network private-dns record-set txt list -g MyResourceGroup -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" -# endregion RecordSetList - - -# region RecordSetShow -class RecordSetShow(_RecordSetShow): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.record_type._required = False - args_schema.record_type._registered = False - - return args_schema - - -@register_command("network private-dns record-set a show") -class RecordSetAShow(RecordSetShow): - """ Get the details of an A record set. - - :example: Get the details of an A record set. - az network private-dns record-set a show -g MyResourceGroup -n MyRecordSet -z www.mysite.com - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network private-dns record-set aaaa show") -class RecordSetAAAAShow(RecordSetShow): - """ Get the details of an AAAA record set. - - :example: Get the details of an AAAA record set. - az network private-dns record-set aaaa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network private-dns record-set cname show") -class RecordSetCNAMEShow(RecordSetShow): - """ Get the details of a CNAME record set. - - :example: Get the details of a CNAME record set. - az network private-dns record-set cname show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - - -@register_command("network private-dns record-set mx show") -class RecordSetMXShow(RecordSetShow): - """ Get the details of an MX record set. - - :example: Get the details of an MX record set. - az network private-dns record-set mx show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network private-dns record-set ptr show") -class RecordSetPTRShow(RecordSetShow): - """ Get the details of a PTR record set. - - :example: Get the details of a PTR record set. - az network private-dns record-set ptr show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -@register_command("network private-dns record-set soa show") -class RecordSetSOAShow(RecordSetShow): - """ Get the details of an SOA record. - - :example: Get the details of an SOA record. - az network private-dns record-set soa show -g MyResourceGroup -z www.mysite.com - """ - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.name._required = False - args_schema.name._registered = False - - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.name = "@" - args.record_type = "SOA" - - -@register_command("network private-dns record-set srv show") -class RecordSetSRVShow(RecordSetShow): - """ Get the details of an SRV record set. - - :example: Get the details of an SRV record set. - az network private-dns record-set srv show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network private-dns record-set txt show") -class RecordSetTXTShow(RecordSetShow): - """ Get the details of a TXT record set. - - :example: Get the details of a TXT record set. - az network private-dns record-set txt show -g MyResourceGroup -z www.mysite.com -n MyRecordSet - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" -# endregion RecordSetShow - - -# region RecordSetUpdate -class RecordSetUpdate(_RecordSetUpdate): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.record_type._required = False - args_schema.record_type._registered = False - args_schema.a_records._registered = False - args_schema.aaaa_records._registered = False - args_schema.cname_record._registered = False - args_schema.mx_records._registered = False - args_schema.ptr_records._registered = False - args_schema.soa_record._registered = False - args_schema.srv_records._registered = False - args_schema.txt_records._registered = False - - return args_schema - - -@register_command("network private-dns record-set a update") -class RecordSetAUpdate(RecordSetUpdate): - """ Update an A record set. - - :example: Update an A record set. - az network private-dns record-set a update -g MyResourceGroup -n MyRecordSet -z www.mysite.com --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "A" - - -@register_command("network private-dns record-set aaaa update") -class RecordSetAAAAUpdate(RecordSetUpdate): - """ Update an AAAA record set. - - :example: Update an AAAA record set. - az network private-dns record-set aaaa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "AAAA" - - -@register_command("network private-dns record-set cname update") -class RecordSetCNAMEUpdate(RecordSetUpdate): - """ Update a CNAME record set. - - :example: Update a CNAME record set. - az network private-dns record-set cname update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "CNAME" - - -@register_command("network private-dns record-set mx update") -class RecordSetMXUpdate(RecordSetUpdate): - """ Update an MX record set. - - :example: Update an MX record set. - az network private-dns record-set mx update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "MX" - - -@register_command("network private-dns record-set ptr update") -class RecordSetPTRUpdate(RecordSetUpdate): - """ Update a PTR record set. - - :example: Update a PTR record set. - az network private-dns record-set ptr update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "PTR" - - -class RecordSetSOAUpdate(RecordSetUpdate): - def pre_operations(self): - args = self.ctx.args - args.record_type = "SOA" - - -@register_command("network private-dns record-set srv update") -class RecordSetSRVUpdate(RecordSetUpdate): - """ Update an SRV record set. - - :example: Update an SRV record set. - az network private-dns record-set srv update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "SRV" - - -@register_command("network private-dns record-set txt update") -class RecordSetTXTUpdate(RecordSetUpdate): - """ Update a TXT record set. - - :example: Update a TXT record set. - az network private-dns record-set txt update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam - """ - def pre_operations(self): - args = self.ctx.args - args.record_type = "TXT" -# endregion RecordSetUpdate - - def _type_to_property_name(key): type_dict = { 'a': 'a_records', @@ -888,19 +313,43 @@ def _convert_to_snake_case(element): def _record_show_func(record_type): - return globals()["RecordSet{}Show".format(record_type.upper())] + import importlib + mod = importlib.import_module( + ".operations.latest.network.private_dns.record_set.{}._{}" + .format(record_type.lower(), "show"), + package="azure.cli.command_modules.privatedns" + ) + return getattr(mod, "RecordSet{}Show".format(record_type.upper())) def _record_create_func(record_type): - return globals()["RecordSet{}Create".format(record_type.upper())] + import importlib + mod = importlib.import_module( + ".operations.latest.network.private_dns.record_set.{}._{}" + .format(record_type.lower(), "create"), + package="azure.cli.command_modules.privatedns" + ) + return getattr(mod, "RecordSet{}Create".format(record_type.upper())) def _record_delete_func(record_type): - return globals()["RecordSet{}Delete".format(record_type.upper())] + import importlib + mod = importlib.import_module( + ".operations.latest.network.private_dns.record_set.{}._{}" + .format(record_type.lower(), "delete"), + package="azure.cli.command_modules.privatedns" + ) + return getattr(mod, "RecordSet{}Delete".format(record_type.upper())) def _record_update_func(record_type): - return globals()["RecordSet{}Update".format(record_type.upper())] + import importlib + mod = importlib.import_module( + ".operations.latest.network.private_dns.record_set.{}._{}" + .format(record_type.lower(), "update"), + package="azure.cli.command_modules.privatedns" + ) + return getattr(mod, "RecordSet{}Update".format(record_type.upper())) def _privatedns_type_to_property_name(key): @@ -929,6 +378,7 @@ def _privatedns_add_record(record_set, record, record_type, is_list=False): def _privatedns_add_save_record(cmd, record, record_type, relative_record_set_name, resource_group_name, private_zone_name, is_list=True): + from azure.core.exceptions import HttpResponseError record_snake, record_camel = _privatedns_type_to_property_name(record_type) is_empty = False @@ -1028,6 +478,7 @@ def update_privatedns_soa_record(cmd, resource_group_name, private_zone_name, ho relative_record_set_name = '@' record_type = 'soa' + from .operations.latest.network.private_dns.record_set.soa._show import RecordSetSOAShow record_set = RecordSetSOAShow(cli_ctx=cmd.cli_ctx)(command_args={ "resource_group": resource_group_name, "zone_name": private_zone_name, diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py new file mode 100644 index 00000000000..34f5c68f6a9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# 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.command_modules.privatedns.aaz.latest.network.private_dns.link.vnet._create import Create as _PrivateDNSLinkVNetCreate + + +class PrivateDNSLinkVNetCreate(_PrivateDNSLinkVNetCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.virtual_network._fmt = AAZResourceIdArgFormat( + template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network" + "/virtualNetworks/{}" + ) + args_schema.registration_enabled._required = True + args_schema.virtual_network._required = True + args_schema.if_none_match._registered = False + args_schema.location._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.location = "global" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py new file mode 100644 index 00000000000..1285b850b03 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py @@ -0,0 +1,97 @@ +# -------------------------------------------------------------------------------------------- +# 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.command_modules.privatedns.aaz.latest.network.private_dns.record_set._create import Create as _RecordSetCreate +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._delete import Delete as _RecordSetDelete +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._list_by_type import ListByType as _RecordSetList +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._show import Show as _RecordSetShow +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._update import Update as _RecordSetUpdate + + +# region RecordSetCreate +class RecordSetCreate(_RecordSetCreate): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.record_type._required = False + args_schema.record_type._registered = False + args_schema.if_none_match._registered = False + args_schema.a_records._registered = False + args_schema.aaaa_records._registered = False + args_schema.cname_record._registered = False + args_schema.mx_records._registered = False + args_schema.ptr_records._registered = False + args_schema.soa_record._registered = False + args_schema.srv_records._registered = False + args_schema.txt_records._registered = False + + return args_schema +# endregion RecordSetCreate + + +# region RecordSetDelete +class RecordSetDelete(_RecordSetDelete): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.record_type._required = False + args_schema.record_type._registered = False + + return args_schema +# endregion RecordSetDelete + + +# region RecordSetList +class RecordSetList(_RecordSetList): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.record_type._required = False + args_schema.record_type._registered = False + + return args_schema +# endregion RecordSetList + + +# region RecordSetShow +class RecordSetShow(_RecordSetShow): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.record_type._required = False + args_schema.record_type._registered = False + + return args_schema +# endregion RecordSetShow + + +# region RecordSetUpdate +class RecordSetUpdate(_RecordSetUpdate): + AZ_NAME = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.record_type._required = False + args_schema.record_type._registered = False + args_schema.a_records._registered = False + args_schema.aaaa_records._registered = False + args_schema.cname_record._registered = False + args_schema.mx_records._registered = False + args_schema.ptr_records._registered = False + args_schema.soa_record._registered = False + args_schema.srv_records._registered = False + args_schema.txt_records._registered = False + + return args_schema +# endregion RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_create.py new file mode 100644 index 00000000000..92028116fc1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set a create") +class RecordSetACreate(RecordSetCreate): + """ Create an empty A record set. + + :example: Create an empty A record set. + az network private-dns record-set a create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py new file mode 100644 index 00000000000..9be51216e70 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set a delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetADelete(RecordSetDelete): + """ Delete an A record set and all associated records. + + :example: Delete an A record set and all associated records. + az network private-dns record-set a delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_list.py new file mode 100644 index 00000000000..04dcfeb7841 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set a list") +class RecordSetAList(RecordSetList): + """ List all A record sets in a zone. + + :example: List all A record sets in a zone. + az network private-dns record-set a list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_show.py new file mode 100644 index 00000000000..281ad1fff33 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set a show") +class RecordSetAShow(RecordSetShow): + """ Get the details of an A record set. + + :example: Get the details of an A record set. + az network private-dns record-set a show -g MyResourceGroup -n MyRecordSet -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py new file mode 100644 index 00000000000..b1a41d0b9e3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set a update") +class RecordSetAUpdate(RecordSetUpdate): + """ Update an A record set. + + :example: Update an A record set. + az network private-dns record-set a update -g MyResourceGroup -n MyRecordSet -z www.mysite.com --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "A" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_create.py new file mode 100644 index 00000000000..0ad51dea1de --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set aaaa create") +class RecordSetAAAACreate(RecordSetCreate): + """ Create an empty AAAA record set. + + :example: Create an empty AAAA record set. + az network private-dns record-set aaaa create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py new file mode 100644 index 00000000000..67a1f67bd1f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set aaaa delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetAAAADelete(RecordSetDelete): + """ Delete an AAAA record set and all associated records. + + :example: Delete an AAAA record set and all associated records. + az network private-dns record-set aaaa delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_list.py new file mode 100644 index 00000000000..4f3a809e6ae --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set aaaa list") +class RecordSetAAAAList(RecordSetList): + """ List all AAAA record sets in a zone. + + :example: List all AAAA record sets in a zone. + az network private-dns record-set aaaa list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_show.py new file mode 100644 index 00000000000..7656b27ba47 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set aaaa show") +class RecordSetAAAAShow(RecordSetShow): + """ Get the details of an AAAA record set. + + :example: Get the details of an AAAA record set. + az network private-dns record-set aaaa show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py new file mode 100644 index 00000000000..1abd9c578e2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set aaaa update") +class RecordSetAAAAUpdate(RecordSetUpdate): + """ Update an AAAA record set. + + :example: Update an AAAA record set. + az network private-dns record-set aaaa update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "AAAA" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_create.py new file mode 100644 index 00000000000..10bd0378bce --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set cname create") +class RecordSetCNAMECreate(RecordSetCreate): + """ Create an empty CNAME record set. + + :example: Create an empty CNAME record set. + az network private-dns record-set cname create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py new file mode 100644 index 00000000000..3b32c7b80dc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set cname delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetCNAMEDelete(RecordSetDelete): + """ Delete a CNAME record set and its associated record. + + :example: Delete a CNAME record set and its associated record. + az network private-dns record-set cname delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_list.py new file mode 100644 index 00000000000..1a1f56dbb5d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set cname list") +class RecordSetCNAMEList(RecordSetList): + """ List the CNAME record set in a zone. + + :example: List the CNAME record set in a zone. + az network private-dns record-set cname list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_show.py new file mode 100644 index 00000000000..c39355a56c6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set cname show") +class RecordSetCNAMEShow(RecordSetShow): + """ Get the details of a CNAME record set. + + :example: Get the details of a CNAME record set. + az network private-dns record-set cname show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py new file mode 100644 index 00000000000..69b2f660ed6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set cname update") +class RecordSetCNAMEUpdate(RecordSetUpdate): + """ Update a CNAME record set. + + :example: Update a CNAME record set. + az network private-dns record-set cname update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "CNAME" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_create.py new file mode 100644 index 00000000000..6eab6d1ccfd --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set mx create") +class RecordSetMXCreate(RecordSetCreate): + """ Create an empty MX record set. + + :example: Create an empty MX record set. + az network private-dns record-set mx create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py new file mode 100644 index 00000000000..2f363f2df2a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set mx delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetMXDelete(RecordSetDelete): + """ Delete an MX record set and all associated records. + + :example: Delete an MX record set and all associated records. + az network private-dns record-set mx delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_list.py new file mode 100644 index 00000000000..f4f31cda8da --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set mx list") +class RecordSetMXList(RecordSetList): + """ List all MX record sets in a zone. + + :example: List all MX record sets in a zone. + az network private-dns record-set mx list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_show.py new file mode 100644 index 00000000000..050ad65b594 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set mx show") +class RecordSetMXShow(RecordSetShow): + """ Get the details of an MX record set. + + :example: Get the details of an MX record set. + az network private-dns record-set mx show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py new file mode 100644 index 00000000000..9ff0e13620a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set mx update") +class RecordSetMXUpdate(RecordSetUpdate): + """ Update an MX record set. + + :example: Update an MX record set. + az network private-dns record-set mx update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "MX" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_create.py new file mode 100644 index 00000000000..40430f0203e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set ptr create") +class RecordSetPTRCreate(RecordSetCreate): + """ Create an empty PTR record set. + + :example: Create an empty PTR record set. + az network private-dns record-set ptr create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py new file mode 100644 index 00000000000..141179ea854 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set ptr delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetPTRDelete(RecordSetDelete): + """ Delete a PTR record set and all associated records. + + :example: Delete a PTR record set and all associated records. + az network private-dns record-set ptr delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_list.py new file mode 100644 index 00000000000..d556ca4ad80 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set ptr list") +class RecordSetPTRList(RecordSetList): + """ List all PTR record sets in a zone. + + :example: List all PTR record sets in a zone. + az network private-dns record-set ptr list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_show.py new file mode 100644 index 00000000000..7413b288505 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set ptr show") +class RecordSetPTRShow(RecordSetShow): + """ Get the details of a PTR record set. + + :example: Get the details of a PTR record set. + az network private-dns record-set ptr show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py new file mode 100644 index 00000000000..58487db537c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set ptr update") +class RecordSetPTRUpdate(RecordSetUpdate): + """ Update a PTR record set. + + :example: Update a PTR record set. + az network private-dns record-set ptr update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "PTR" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py new file mode 100644 index 00000000000..740a0ec1557 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set soa show") +class RecordSetSOAShow(RecordSetShow): + """ Get the details of an SOA record. + + :example: Get the details of an SOA record. + az network private-dns record-set soa show -g MyResourceGroup -z www.mysite.com + """ + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.name._required = False + args_schema.name._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + args.name = "@" + args.record_type = "SOA" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_update.py new file mode 100644 index 00000000000..ad3fd42d0d6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_update.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +class RecordSetSOAUpdate(RecordSetUpdate): + def pre_operations(self): + args = self.ctx.args + args.record_type = "SOA" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_create.py new file mode 100644 index 00000000000..d37a812aae7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set srv create") +class RecordSetSRVCreate(RecordSetCreate): + """ Create an empty SRV record set. + + :example: Create an empty SRV record set. + az network private-dns record-set srv create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py new file mode 100644 index 00000000000..62542bea609 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set srv delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetSRVDelete(RecordSetDelete): + """ Delete an SRV record set and all associated records. + + :example: Delete an SRV record set and all associated records. + az network private-dns record-set srv delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_list.py new file mode 100644 index 00000000000..70bba4dd6fd --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set srv list") +class RecordSetSRVList(RecordSetList): + """ List all SRV record sets in a zone. + + :example: List all SRV record sets in a zone. + az network private-dns record-set srv list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_show.py new file mode 100644 index 00000000000..470d1604d6b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set srv show") +class RecordSetSRVShow(RecordSetShow): + """ Get the details of an SRV record set. + + :example: Get the details of an SRV record set. + az network private-dns record-set srv show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py new file mode 100644 index 00000000000..7fda5ae03b7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set srv update") +class RecordSetSRVUpdate(RecordSetUpdate): + """ Update an SRV record set. + + :example: Update an SRV record set. + az network private-dns record-set srv update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "SRV" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_create.py new file mode 100644 index 00000000000..bf6b8a3b685 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_create.py @@ -0,0 +1,21 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetCreate + + +@register_command("network private-dns record-set txt create") +class RecordSetTXTCreate(RecordSetCreate): + """ Create an empty TXT record set. + + :example: Create an empty TXT record set. + az network private-dns record-set txt create -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" + args.if_none_match = "*" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py new file mode 100644 index 00000000000..b093fec4bc0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete + + +@register_command("network private-dns record-set txt delete", confirmation="Are you sure you want to perform this operation?") +class RecordSetTXTDelete(RecordSetDelete): + """ Delete a TXT record set and all associated records. + + :example: Delete a TXT record set and all associated records. + az network private-dns record-set txt delete -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_list.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_list.py new file mode 100644 index 00000000000..d1cf93a8aa6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_list.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetList + + +@register_command("network private-dns record-set txt list") +class RecordSetTXTList(RecordSetList): + """ List all TXT record sets in a zone. + + :example: List all TXT record sets in a zone. + az network private-dns record-set txt list -g MyResourceGroup -z www.mysite.com + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_show.py new file mode 100644 index 00000000000..f1eb9c25d06 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_show.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow + + +@register_command("network private-dns record-set txt show") +class RecordSetTXTShow(RecordSetShow): + """ Get the details of a TXT record set. + + :example: Get the details of a TXT record set. + az network private-dns record-set txt show -g MyResourceGroup -z www.mysite.com -n MyRecordSet + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py new file mode 100644 index 00000000000..f898bbfd19e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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.aaz import register_command + +from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate + + +@register_command("network private-dns record-set txt update") +class RecordSetTXTUpdate(RecordSetUpdate): + """ Update a TXT record set. + + :example: Update a TXT record set. + az network private-dns record-set txt update -g MyResourceGroup -z www.mysite.com -n MyRecordSet --metadata owner=WebTeam + """ + def pre_operations(self): + args = self.ctx.args + args.record_type = "TXT" diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/__init__.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/__init__.py new file mode 100644 index 00000000000..68ee4bfbbe7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: skip-file +# flake8: noqa diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py new file mode 100644 index 00000000000..39fa3359116 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.log import get_logger + +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.zone._create import Create as _PrivateDNSZoneCreate + +logger = get_logger(__name__) + + +class PrivateDNSZoneCreate(_PrivateDNSZoneCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.if_none_match._registered = False + args_schema.location._registered = False + + return args_schema + + def pre_operations(self): + args = self.ctx.args + if args.name.to_serialized_data().endswith(".local"): + logger.warning( + "Please be aware that DNS names ending with `.local` are reserved for use with multicast DNS and " + "may not work as expected with some operating systems. " + "For details refer to your operating systems documentation." + ) + args.location = "global" + args.if_none_match = "*" From cc5a65ab192f141bb1582782ce86cf50d92025f5 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Tue, 3 Mar 2026 16:00:25 +1100 Subject: [PATCH 12/21] clear import in custom --- .../cli/command_modules/network/custom.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 3492e173387..613cfdd9af3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -8,33 +8,17 @@ from collections import Counter, OrderedDict -import socket from knack.log import get_logger from azure.mgmt.core.tools import parse_resource_id, is_valid_resource_id, resource_id from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat from azure.cli.core.aaz._client import AAZMgmtClient -from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.core.commands.client_factory import get_subscription_id, get_mgmt_service_client from azure.cli.core.util import CLIError, sdk_no_wait -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, \ - UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.azclierror import UnrecognizedArgumentError, ResourceNotFoundError from azure.cli.core.profiles import ResourceType -from azure.cli.command_modules.network.zone_file.parse_zone_file import parse_zone_file -from azure.cli.command_modules.network.zone_file.make_zone_file import make_zone_file - -from .aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate -from .aaz.latest.network.dns.record_set._list import List as _DNSRecordSetListByZone -from .aaz.latest.network.dns.zone._create import Create as _DNSZoneCreate -from .aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate -from .aaz.latest.network.vnet_gateway.vpn_client._generate_vpn_profile import GenerateVpnProfile as _VpnProfileGenerate -from .aaz.latest.network.vnet_gateway.vpn_client._generate import Generate as _VpnClientPackageGenerate -from .aaz.latest.network.vpn_connection._update import Update as _VpnConnectionUpdate -from .operations.latest.network.dns.record_set.soa._show import RecordSetSOAShow as DNSRecordSetSOAShow -from .operations.latest.network.public_ip._create import PublicIPCreate - logger = get_logger(__name__) remove_basic_option_msg = "It's recommended to create with `%s`. " \ From 8cba8e61e428a1357c76f9e2f138e187f4d8b3b1 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Tue, 3 Mar 2026 16:51:59 +1100 Subject: [PATCH 13/21] Disable compact aaz --- build_scripts/windows/scripts/build.cmd | 2 -- scripts/live_test/CLITest.yml | 9 --------- 2 files changed, 11 deletions(-) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index 0882015ff14..1cbc1760879 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -152,8 +152,6 @@ if %errorlevel% neq 0 goto ERROR pushd %BUILDING_DIR% -%BUILDING_DIR%\python.exe -I %REPO_ROOT%\scripts\compact_aaz.py -if %errorlevel% neq 0 goto ERROR %BUILDING_DIR%\python.exe -I %REPO_ROOT%\scripts\trim_sdk.py if %errorlevel% neq 0 goto ERROR popd diff --git a/scripts/live_test/CLITest.yml b/scripts/live_test/CLITest.yml index 69ff49977ab..8c68b08e33b 100644 --- a/scripts/live_test/CLITest.yml +++ b/scripts/live_test/CLITest.yml @@ -577,9 +577,6 @@ stages: # This helps detect issues in CI if a used SDK API version is deleted by the below script. python $workDir/s/scripts/trim_sdk.py - # Compact aaz folders of modules - python $workDir/s/scripts/compact_aaz.py - az -v az account set -s $(azure-cli-live-test-bami-sub-id) @@ -1155,9 +1152,6 @@ stages: # This helps detect issues in CI if a used SDK API version is deleted by the below script. python $workDir/s/scripts/trim_sdk.py - # Compact aaz folders of modules - python $workDir/s/scripts/compact_aaz.py - az -v az account set -s $(azure-cli-live-test-bami-sub-id) @@ -1731,9 +1725,6 @@ stages: # This helps detect issues in CI if a used SDK API version is deleted by the below script. python $workDir/s/scripts/trim_sdk.py - # Compact aaz folders of modules - python $workDir/s/scripts/compact_aaz.py - az -v az account set -s $(azure-cli-live-test-bami-sub-id) From c99f84d95bd8aef282648820a36314ff41a1b226 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 4 Mar 2026 11:24:10 +1100 Subject: [PATCH 14/21] suppress the module load warning --- src/azure-cli-core/azure/cli/core/aaz/_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/aaz/_command.py b/src/azure-cli-core/azure/cli/core/aaz/_command.py index 3f5e421b29a..6246bb7e31d 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_command.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_command.py @@ -444,7 +444,9 @@ def _try_import_module(relative_name, package): try: return importlib.import_module(relative_name, package) except (ModuleNotFoundError, ImportError): - logger.debug('Failed to import module %s relative to %s.', relative_name, package) + # Comment the debug log because it may cause confusion + # commands from different modules may patch each other. + # logger.debug('Failed to import module %s relative to %s.', relative_name, package) return None From a2a7241a32f03af75db13cd70bcce54217612837 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 4 Mar 2026 14:16:33 +1100 Subject: [PATCH 15/21] Fix missing import --- src/azure-cli/azure/cli/command_modules/network/custom.py | 3 +++ .../operations/latest/network/express_route/_create.py | 4 +++- .../operations/latest/network/express_route/_update.py | 2 ++ .../operations/latest/network/express_route/port/_create.py | 2 ++ .../network/operations/latest/network/lb/probe/_create.py | 6 +++++- .../network/operations/latest/network/lb/probe/_update.py | 5 ++++- 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/custom.py b/src/azure-cli/azure/cli/command_modules/network/custom.py index 613cfdd9af3..902adda80f4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/custom.py @@ -761,6 +761,7 @@ def pre_instance_update(self, instance): def create_ddos_plan(cmd, resource_group_name, ddos_plan_name, location=None, tags=None, vnets=None): from azure.cli.core.commands import LongRunningOperation from azure.cli.command_modules.network.aaz.latest.network.ddos_protection._create import Create + from azure.cli.command_modules.network.operations.latest.network.vnet._update import VNetUpdate Create_Ddos_Protection = Create(cli_ctx=cmd.cli_ctx) args = { "name": ddos_plan_name, @@ -807,6 +808,7 @@ def update_ddos_plan(cmd, resource_group_name, ddos_plan_name, tags=None, vnets= args['tags'] = tags if vnets is not None: from azure.cli.command_modules.network.aaz.latest.network.ddos_protection._show import Show + from azure.cli.command_modules.network.operations.latest.network.vnet._update import VNetUpdate show_args = { "name": ddos_plan_name, "resource_group": resource_group_name, @@ -2648,6 +2650,7 @@ def subnet_list_available_ips(cmd, resource_group_name, virtual_network_name, su def sync_vnet_peering(cmd, resource_group_name, virtual_network_name, virtual_network_peering_name): from .aaz.latest.network.vnet.peering._show import Show + from .operations.latest.network.vnet.peering._create import VNetPeeringCreate try: peering = Show(cli_ctx=cmd.cli_ctx)(command_args={ "name": virtual_network_peering_name, diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py index 1aadf4ec00e..0fc01f50535 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_create.py @@ -5,11 +5,13 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route._create import Create as _ExpressRouteCreate def _validate_bandwidth(bandwidth, mbps=True): + from azure.cli.core.azclierror import InvalidArgumentValueError + unit = 'mbps' if mbps else 'gbps' if bandwidth is None: return diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py index 345e2b94505..03ae3e87e75 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py @@ -10,6 +10,8 @@ def _validate_bandwidth(bandwidth, mbps=True): + from azure.cli.core.azclierror import InvalidArgumentValueError + unit = 'mbps' if mbps else 'gbps' if bandwidth is None: return diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py index 550fcb44bf9..12264702e35 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py @@ -10,6 +10,8 @@ def _validate_bandwidth(bandwidth, mbps=True): + from azure.cli.core.azclierror import InvalidArgumentValueError + unit = 'mbps' if mbps else 'gbps' if bandwidth is None: return diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py index 51052a5f196..f28b70f5e7d 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py @@ -5,9 +5,13 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +import logging + +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.lb.probe._create import Create as _LBProbeCreate +logger = logging.getLogger(__name__) + class LBProbeCreate(_LBProbeCreate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py index a154c331a36..99ed714f07a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py @@ -4,10 +4,13 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long, protected-access, too-few-public-methods +import logging -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.lb.probe._update import Update as _LBProbeUpdate +logger = logging.getLogger(__name__) + class LBProbeUpdate(_LBProbeUpdate): From e97b66d916fa5f727a7a572b5a4b48d0ceb511a7 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 4 Mar 2026 16:11:24 +1100 Subject: [PATCH 16/21] Fix style in network module --- .../cli/command_modules/network/commands.py | 26 ------------------- .../network/application_gateway/_update.py | 3 ++- .../application_gateway/auth_cert/_create.py | 2 +- .../application_gateway/auth_cert/_update.py | 2 +- .../application_gateway/client_cert/_add.py | 2 +- .../client_cert/_update.py | 2 +- .../frontend_ip/_create.py | 2 +- .../frontend_ip/_update.py | 2 +- .../http_listener/_create.py | 4 +-- .../http_listener/_update.py | 2 +- .../http_settings/_update.py | 2 +- .../application_gateway/listener/_create.py | 4 +-- .../application_gateway/listener/_update.py | 2 +- .../application_gateway/private_link/_add.py | 4 +-- .../private_link/_remove.py | 4 +-- .../private_link/ip_config/_add.py | 4 +-- .../redirect_config/_update.py | 2 +- .../rewrite_rule/_create.py | 2 +- .../rewrite_rule/_update.py | 2 +- .../application_gateway/root_cert/_create.py | 2 +- .../application_gateway/root_cert/_update.py | 2 +- .../routing_rule/_create.py | 4 +-- .../routing_rule/_update.py | 2 +- .../application_gateway/rule/_create.py | 4 +-- .../application_gateway/rule/_update.py | 2 +- .../application_gateway/settings/_update.py | 2 +- .../application_gateway/ssl_cert/_create.py | 2 +- .../application_gateway/ssl_cert/_update.py | 2 +- .../application_gateway/ssl_policy/_set.py | 2 +- .../application_gateway/ssl_profile/_add.py | 2 +- .../ssl_profile/_update.py | 2 +- .../url_path_map/_create.py | 2 +- .../url_path_map/rule/_create.py | 4 +-- .../custom_rule/match_condition/_add.py | 4 +-- .../latest/network/cross_region_lb/_delete.py | 2 +- .../latest/network/cross_region_lb/_list.py | 2 +- .../latest/network/cross_region_lb/_show.py | 2 +- .../latest/network/cross_region_lb/_update.py | 2 +- .../cross_region_lb/address_pool/_create.py | 2 +- .../cross_region_lb/address_pool/_delete.py | 2 +- .../cross_region_lb/address_pool/_list.py | 2 +- .../cross_region_lb/address_pool/_show.py | 2 +- .../cross_region_lb/address_pool/_update.py | 2 +- .../address_pool/address/_add.py | 2 +- .../address_pool/address/_list.py | 2 +- .../address_pool/address/_remove.py | 2 +- .../address_pool/address/_show.py | 2 +- .../address_pool/address/_update.py | 2 +- .../cross_region_lb/frontend_ip/_create.py | 2 +- .../cross_region_lb/frontend_ip/_delete.py | 2 +- .../cross_region_lb/frontend_ip/_list.py | 2 +- .../cross_region_lb/frontend_ip/_show.py | 2 +- .../cross_region_lb/frontend_ip/_update.py | 2 +- .../network/cross_region_lb/rule/_create.py | 2 +- .../network/cross_region_lb/rule/_delete.py | 2 +- .../network/cross_region_lb/rule/_list.py | 2 +- .../network/cross_region_lb/rule/_show.py | 2 +- .../network/cross_region_lb/rule/_update.py | 2 +- .../network/custom_ip/prefix/_create.py | 2 +- .../latest/network/dns/_list_references.py | 2 +- .../latest/network/dns/record_set/_base.py | 9 ++++--- .../network/dns/record_set/a/_create.py | 2 +- .../network/dns/record_set/a/_delete.py | 2 +- .../latest/network/dns/record_set/a/_list.py | 2 +- .../latest/network/dns/record_set/a/_show.py | 2 +- .../network/dns/record_set/a/_update.py | 2 +- .../network/dns/record_set/aaaa/_create.py | 2 +- .../network/dns/record_set/aaaa/_delete.py | 2 +- .../network/dns/record_set/aaaa/_list.py | 2 +- .../network/dns/record_set/aaaa/_show.py | 2 +- .../network/dns/record_set/aaaa/_update.py | 2 +- .../network/dns/record_set/caa/_create.py | 2 +- .../network/dns/record_set/caa/_delete.py | 2 +- .../network/dns/record_set/caa/_list.py | 2 +- .../network/dns/record_set/caa/_show.py | 2 +- .../network/dns/record_set/caa/_update.py | 2 +- .../network/dns/record_set/cname/_create.py | 2 +- .../network/dns/record_set/cname/_delete.py | 2 +- .../network/dns/record_set/cname/_list.py | 2 +- .../network/dns/record_set/cname/_show.py | 2 +- .../network/dns/record_set/cname/_update.py | 2 +- .../network/dns/record_set/ds/_create.py | 2 +- .../network/dns/record_set/ds/_delete.py | 2 +- .../latest/network/dns/record_set/ds/_list.py | 2 +- .../latest/network/dns/record_set/ds/_show.py | 2 +- .../network/dns/record_set/ds/_update.py | 2 +- .../network/dns/record_set/mx/_create.py | 2 +- .../network/dns/record_set/mx/_delete.py | 2 +- .../latest/network/dns/record_set/mx/_list.py | 2 +- .../latest/network/dns/record_set/mx/_show.py | 2 +- .../network/dns/record_set/mx/_update.py | 2 +- .../network/dns/record_set/naptr/_create.py | 2 +- .../network/dns/record_set/naptr/_delete.py | 2 +- .../network/dns/record_set/naptr/_list.py | 2 +- .../network/dns/record_set/naptr/_show.py | 2 +- .../network/dns/record_set/naptr/_update.py | 2 +- .../network/dns/record_set/ns/_create.py | 2 +- .../network/dns/record_set/ns/_delete.py | 2 +- .../latest/network/dns/record_set/ns/_list.py | 2 +- .../latest/network/dns/record_set/ns/_show.py | 2 +- .../network/dns/record_set/ns/_update.py | 2 +- .../network/dns/record_set/ptr/_create.py | 2 +- .../network/dns/record_set/ptr/_delete.py | 2 +- .../network/dns/record_set/ptr/_list.py | 2 +- .../network/dns/record_set/ptr/_show.py | 2 +- .../network/dns/record_set/ptr/_update.py | 2 +- .../network/dns/record_set/soa/_show.py | 2 +- .../network/dns/record_set/srv/_create.py | 2 +- .../network/dns/record_set/srv/_delete.py | 2 +- .../network/dns/record_set/srv/_list.py | 2 +- .../network/dns/record_set/srv/_show.py | 2 +- .../network/dns/record_set/srv/_update.py | 2 +- .../network/dns/record_set/tlsa/_create.py | 2 +- .../network/dns/record_set/tlsa/_delete.py | 2 +- .../network/dns/record_set/tlsa/_list.py | 2 +- .../network/dns/record_set/tlsa/_show.py | 2 +- .../network/dns/record_set/tlsa/_update.py | 2 +- .../network/dns/record_set/txt/_create.py | 2 +- .../network/dns/record_set/txt/_delete.py | 2 +- .../network/dns/record_set/txt/_list.py | 2 +- .../network/dns/record_set/txt/_show.py | 2 +- .../network/dns/record_set/txt/_update.py | 2 +- .../latest/network/express_route/_update.py | 2 +- .../gateway/connection/_create.py | 2 +- .../gateway/connection/_update.py | 2 +- .../network/express_route/peering/_create.py | 2 +- .../network/express_route/peering/_update.py | 2 +- .../network/express_route/port/_create.py | 2 +- .../express_route/port/link/_update.py | 2 +- .../latest/network/lb/address_pool/_create.py | 4 +-- .../latest/network/lb/address_pool/_delete.py | 2 +- .../latest/network/lb/address_pool/_update.py | 4 +-- .../network/lb/address_pool/address/_add.py | 4 +-- .../lb/address_pool/address/_update.py | 4 +-- .../latest/network/lb/frontend_ip/_create.py | 2 +- .../latest/network/lb/frontend_ip/_update.py | 2 +- .../network/lb/inbound_nat_pool/_create.py | 2 +- .../network/lb/inbound_nat_pool/_update.py | 2 +- .../network/lb/inbound_nat_rule/_create.py | 2 +- .../network/lb/inbound_nat_rule/_update.py | 2 +- .../network/lb/outbound_rule/_create.py | 2 +- .../network/lb/outbound_rule/_update.py | 2 +- .../latest/network/lb/probe/_create.py | 5 ++-- .../latest/network/lb/probe/_update.py | 4 +-- .../latest/network/lb/rule/_create.py | 2 +- .../latest/network/lb/rule/_update.py | 2 +- .../operations/latest/network/nic/_create.py | 2 +- .../operations/latest/network/nic/_update.py | 2 +- .../latest/network/nic/ip_config/_create.py | 4 +-- .../latest/network/nic/ip_config/_update.py | 4 +-- .../latest/network/nsg/rule/_create.py | 2 +- .../network/private_endpoint/_create.py | 2 +- .../network/private_endpoint/_update.py | 2 +- .../network/private_link_service/_create.py | 4 +-- .../network/private_link_service/_update.py | 2 +- .../latest/network/public_ip/_update.py | 2 +- .../network/public_ip/prefix/_create.py | 2 +- .../operations/latest/network/vnet/_create.py | 2 +- .../operations/latest/network/vnet/_update.py | 2 +- .../latest/network/vnet/subnet/_create.py | 4 +-- .../latest/network/vnet/subnet/_update.py | 4 +-- .../latest/network/vnet_gateway/_create.py | 2 +- .../latest/network/vnet_gateway/_list.py | 2 +- .../latest/network/vnet_gateway/_show.py | 2 +- .../latest/network/vnet_gateway/_update.py | 5 +++- .../network/vnet_gateway/nat_rule/_add.py | 2 +- .../network/vnet_gateway/nat_rule/_list.py | 2 +- .../network/vnet_gateway/nat_rule/_remove.py | 4 +-- .../network/vnet_gateway/root_cert/_create.py | 2 +- .../latest/network/watcher/_helpers.py | 14 +++------- .../watcher/_run_configuration_diagnostic.py | 6 ++--- .../latest/network/watcher/_show_next_hop.py | 2 +- .../watcher/_show_security_group_view.py | 2 +- .../latest/network/watcher/_show_topology.py | 4 +-- .../network/watcher/_test_connectivity.py | 4 +-- .../latest/network/watcher/_test_ip_flow.py | 4 +-- .../watcher/connection_monitor/_create.py | 5 ++-- .../watcher/connection_monitor/_delete.py | 2 +- .../watcher/connection_monitor/_list.py | 2 +- .../watcher/connection_monitor/_query.py | 2 +- .../watcher/connection_monitor/_show.py | 2 +- .../watcher/connection_monitor/_start.py | 2 +- .../watcher/connection_monitor/_stop.py | 2 +- .../connection_monitor/endpoint/_add.py | 4 +-- .../connection_monitor/endpoint/_list.py | 2 +- .../connection_monitor/endpoint/_remove.py | 2 +- .../connection_monitor/endpoint/_show.py | 2 +- .../watcher/connection_monitor/output/_add.py | 4 +-- .../connection_monitor/output/_list.py | 2 +- .../test_configuration/_add.py | 2 +- .../test_configuration/_list.py | 2 +- .../test_configuration/_remove.py | 2 +- .../test_configuration/_show.py | 2 +- .../connection_monitor/test_group/_add.py | 5 ++-- .../connection_monitor/test_group/_list.py | 2 +- .../connection_monitor/test_group/_show.py | 2 +- .../network/watcher/flow_log/_create.py | 6 ++--- .../network/watcher/flow_log/_delete.py | 2 +- .../latest/network/watcher/flow_log/_list.py | 2 +- .../network/watcher/flow_log/_update.py | 6 ++--- .../network/watcher/packet_capture/_create.py | 4 +-- .../network/watcher/packet_capture/_delete.py | 2 +- .../network/watcher/packet_capture/_list.py | 2 +- .../network/watcher/packet_capture/_show.py | 2 +- .../watcher/packet_capture/_show_status.py | 2 +- .../network/watcher/packet_capture/_stop.py | 2 +- .../network/watcher/troubleshooting/_show.py | 2 +- .../network/watcher/troubleshooting/_start.py | 2 +- 208 files changed, 254 insertions(+), 282 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/commands.py b/src/azure-cli/azure/cli/command_modules/network/commands.py index a421f228716..5637f3c9f5a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/commands.py @@ -29,9 +29,6 @@ # pylint: disable=too-many-locals, too-many-statements def load_command_table(self, _): - # region NetworkRoot - # endregion - # region ApplicationGateways with self.command_group("network application-gateway") as g: g.custom_command("show-backend-health", "show_ag_backend_health") @@ -42,13 +39,9 @@ def load_command_table(self, _): validator=process_ag_create_namespace, exception_handler=handle_template_based_exception) - - with self.command_group("network application-gateway identity") as g: g.custom_command("remove", "remove_ag_identity", supports_no_wait=True) - - with self.command_group("network application-gateway waf-config") as g: g.custom_command("list-rule-sets", "list_ag_waf_rule_sets", table_transformer=transform_waf_rule_sets_table_output) g.custom_command("set", "set_ag_waf_config", supports_no_wait=True) @@ -56,7 +49,6 @@ def load_command_table(self, _): # endregion # region ApplicationGatewayWAFPolicy - with self.command_group("network application-gateway waf-policy managed-rule exception") as g: g.custom_command("remove", "remove_waf_managed_rule_exception") g.custom_command("list", "list_waf_managed_rules") @@ -109,17 +101,10 @@ def load_command_table(self, _): # endregion # region ExpressRoutes - with self.command_group('network express-route port') as g: g.custom_command('generate-loa', 'download_generated_loa_as_pdf') # endregion - # region PrivateEndpoint - # endregion - - # region PrivateLinkServices - # endregion - # region LoadBalancers with self.command_group('network lb') as g: g.custom_command('create', 'create_load_balancer', @@ -136,9 +121,6 @@ def load_command_table(self, _): g.custom_command('create', 'create_cross_region_load_balancer', transform=DeploymentOutputLongRunningOperation(self.cli_ctx), supports_no_wait=True, table_transformer=deployment_validate_table_format, validator=process_cross_region_lb_create_namespace, exception_handler=handle_template_based_exception) # endregion - # region LocalGateways - # endregion - # region NetworkInterfaces: (NIC) with self.command_group("network nic ip-config address-pool") as g: g.custom_command("add", "add_nic_ip_config_address_pool") @@ -146,7 +128,6 @@ def load_command_table(self, _): # endregion # region NetworkSecurityGroups - with self.command_group("network nsg rule") as g: g.custom_command("list", "list_nsg_rules", table_transformer=lambda x: [transform_nsg_rule_table_output(i) for i in x]) # endregion @@ -170,9 +151,6 @@ def load_command_table(self, _): g.custom_command('create', 'create_public_ip', transform=transform_public_ip_create_output, validator=process_public_ip_create_namespace) # endregion - # region RouteFilters - # endregion - # region TrafficManagers with self.command_group('network traffic-manager profile') as g: g.custom_command('create', 'create_traffic_manager_profile', transform=transform_traffic_manager_create_output) @@ -182,7 +160,6 @@ def load_command_table(self, _): g.custom_command('create', 'create_traffic_manager_endpoint') g.custom_command('update', 'update_traffic_manager_endpoint') g.custom_command('list', 'list_traffic_manager_endpoints') - # endregion # region VirtualNetworks @@ -214,7 +191,6 @@ def load_command_table(self, _): with self.command_group('network vpn-connection ipsec-policy') as g: g.custom_command('clear', 'clear_vpn_conn_ipsec_policies', supports_no_wait=True) - # endregion # region VirtualHub @@ -235,8 +211,6 @@ def load_command_table(self, _): g.custom_command('list', 'list_private_endpoint_connection') # endregion - # endregion - # region DdosCustomPolicy with self.command_group('network ddos-custom-policy') as g: g.custom_command('create', 'create_ddos_custom_policy', supports_no_wait=True) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py index f281934b6b0..93144d3de9f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/_update.py @@ -5,7 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.command_modules.network.custom import _is_v2_sku +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway._update import Update as _ApplicationGatewayUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py index 7363e9d2ee2..5de46c44d6d 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.auth_cert._create import Create as _AuthCertCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py index 0a4ba14d8b6..03228594956 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/auth_cert/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.auth_cert._update import Update as _AuthCertUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py index b6f8d10d6fa..b4549eb72ef 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_add.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.client_cert._add import Add as _ClientCertAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py index 3dfbef4c0f2..c81b5b9c2d4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/client_cert/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.client_cert._update import Update as _ClientCertUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py index 07847a262e0..3b3eb4e378c 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.frontend_ip._create import Create as _FrontendIPCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py index 420c9d86595..9b4a0ef4d7f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/frontend_ip/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.frontend_ip._update import Update as _FrontendIPUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py index 1f0b3440278..cc17fd652fc 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_create.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_listener._create import Create as _HTTPListenerCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py index 2162fe2c53f..5b6574bfc1e 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_listener/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_listener._update import Update as _HTTPListenerUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py index 8f67e062a66..b3ab2f5063a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/http_settings/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.application_gateway.http_settings._update import Update as _HTTPSettingsUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py index 257bac90236..276656c9da6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_create.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.listener._create import Create as _ListenerCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py index 1cf84df05a0..4ec902dca46 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/listener/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.listener._update import Update as _ListenerUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py index a0e26e8903b..02f3ef72484 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_add.py @@ -6,8 +6,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.mgmt.core.tools import parse_resource_id, is_valid_resource_id, resource_id -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ValidationError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.private_link._add import Add as _AGPrivateLinkAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py index 77cba53fcf1..79bc9be0ca4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/_remove.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ValidationError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.private_link._remove import Remove as _AGPrivateLinkRemove diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py index c02eff033d0..8e7aec8b5c4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/private_link/ip_config/_add.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ValidationError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.private_link.ip_config._add import Add as _AGPrivateLinkIPConfigAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py index 824a6178c79..ffb5787e4d9 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/redirect_config/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.redirect_config._update import Update as _RedirectConfigUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py index 871fb9825d4..9d6db615856 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rewrite_rule._create import Create as _AGRewriteRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py index 87e727c42f2..633139de0e6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rewrite_rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rewrite_rule._update import Update as _AGRewriteRuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py index bf3a2839a7e..7cb1f87c4b6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.root_cert._create import Create as _RootCertCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py index 30d1a5e81e5..842d8b684dc 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/root_cert/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.root_cert._update import Update as _RootCertUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py index 84debe85eb8..15cc3bf8248 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_create.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.routing_rule._create import Create as _RoutingRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py index ead8c7b3ea8..54d29cac4dd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/routing_rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.routing_rule._update import Update as _RoutingRuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py index 973f5f1f8ad..5c1390ba157 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_create.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rule._create import Create as _RuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py index 8e41f7e0f60..973aed98a33 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.rule._update import Update as _RuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py index 98d875564ad..df0cdbea4d1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/settings/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.application_gateway.settings._update import Update as _SettingsUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py index 17c9219000d..f0e5411742d 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_cert._create import Create as _SSLCertCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py index a643f08ad4b..dd62c039ac1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_cert/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_cert._update import Update as _SSLCertUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py index b3c664ba24d..4a4e37f7877 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_policy/_set.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_policy._set import Set as _SSLPolicySet diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py index d85ab5588db..5c4a4a0e4a1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_add.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_profile._add import Add as _SSLProfileAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py index 72ad6833660..047fcb3e902 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/ssl_profile/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.application_gateway.ssl_profile._update import Update as _SSLProfileUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py index dc527ef2549..9a2bada3da7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.application_gateway.url_path_map._create import Create as _URLPathMapCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py index cb362a6e6e1..4a4406145d5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/url_path_map/rule/_create.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.url_path_map.rule._create import Create as _URLPathMapRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py index 6f183d47d33..cb068108c37 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/application_gateway/waf_policy/custom_rule/match_condition/_add.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.aaz import has_value +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.application_gateway.waf_policy.custom_rule.match_condition._add import Add as _WAFCustomRuleMatchConditionAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py index f122454d539..723148ecb61 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb._delete import Delete as _LBDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py index c9d041a7802..734e4b92bf5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb._list import List as _LBList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py index 470c2b3739c..f69439a5ecd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb._show import Show as _LBShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py index d02213dc4fc..de28d1b6e50 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb._update import Update as _LBUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py index b4072cbbbed..96af9b6efa3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZStrArg from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._create import Create as _LBAddressPoolCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py index 8c4817ea3b6..86ed6486aff 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._delete import Delete as _LBAddressPoolDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py index a1b9eabb2b3..28583e482e1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._list import List as _LBAddressPoolList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py index 5b482c9ee84..b2f9b32b24f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._show import Show as _LBAddressPoolShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py index 73035c51cb1..a4be4020c42 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZStrArg from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._update import Update as _LBAddressPoolUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py index 9511922cc99..323b8c66201 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_add.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._add import Add as _LBAddressPoolAddressAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py index 46bbbe32b5f..b1f4df2edd8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._list import List as _LBAddressPoolAddressList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py index 3f1f6a4f4c2..3d98ccd9268 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_remove.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._remove import Remove as _LBAddressPoolAddressRemove diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py index 087c43b6cac..88a78a546eb 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._show import Show as _LBAddressPoolAddressShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py index d6a50b074d8..a121e239eba 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/address_pool/address/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._update import Update as _LBAddressPoolAddressUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py index 6b0be4ef043..581066831d1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, AAZArgEnum from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py index ddf914ac0dd..94f78c88a13 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._delete import Delete as _LBFrontendIPDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py index 4927c31bd53..4e16a791d22 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._list import List as _LBFrontendIPList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py index 9670bb8b14a..fd7403aaa27 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._show import Show as _LBFrontendIPShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py index 963f5249663..85982bf31a7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/frontend_ip/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, AAZArgEnum from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._update import Update as _LBFrontendIPUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py index d344528a3fe..13aa1317ac4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_create.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZResourceIdArg from azure.cli.command_modules.network.aaz.latest.network.lb.rule._create import Create as _LBRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py index be5c560253f..5fe84db117b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.rule._delete import Delete as _LBRuleDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py index 73484e09b1b..99026ffa824 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.rule._list import List as _LBRuleList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py index 95d808aad99..a20b9e447d0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.rule._show import Show as _LBRuleShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py index c088b9e21a2..aff0d9bd7b1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/cross_region_lb/rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZResourceIdArg from azure.cli.command_modules.network.aaz.latest.network.lb.rule._update import Update as _LBRuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py index c15a86dd4e3..df6bdf48c6d 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/custom_ip/prefix/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.custom_ip.prefix._create import Create as _CustomIpPrefixCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py index 2f5acea06bd..80994abba84 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/_list_references.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command, AAZListArg, AAZResourceIdArg from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.dns._list_references import ListReferences as _DNSListReferences diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py index 24601cdcf6a..afdada7bd95 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/_base.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import has_value, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._update import Update as _RecordSetUpdate from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._show import Show as _RecordSetShow from azure.cli.command_modules.network.aaz.latest.network.dns.record_set._list_by_type import ListByType as _RecordSetListByType @@ -15,6 +15,7 @@ class RecordSetUpdate(_RecordSetUpdate): AZ_NAME = None # Base class + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -48,6 +49,7 @@ def post_instance_update(self, instance): class RecordSetShow(_RecordSetShow): AZ_NAME = None # Base class + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -60,6 +62,7 @@ def _build_arguments_schema(cls, *args, **kwargs): class RecordSetList(_RecordSetListByType): AZ_NAME = None # Base class + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -72,6 +75,7 @@ def _build_arguments_schema(cls, *args, **kwargs): class RecordSetDelete(_RecordSetDelete): AZ_NAME = None # Base class + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -84,6 +88,7 @@ def _build_arguments_schema(cls, *args, **kwargs): class RecordSetCreate(_RecordSetCreate): AZ_NAME = None # Base class + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -107,5 +112,3 @@ def _build_arguments_schema(cls, *args, **kwargs): args_schema.naptr_records._registered = False return args_schema - - diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py index 83b9d667eca..201ee8dbaca 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py index caba5ed718e..66a015bf916 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py index 48e5f21daf5..8b3229152e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py index 2825a70e4c3..82b3969a940 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py index 5f042bbd6d7..c3c6b75f412 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/a/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py index 497796b650a..474926c9378 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py index d7fac29e69a..d2b564e3e0c 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py index 485837ef6d1..142ba1f334b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py index 2e0439c01cb..2a1a97ca8a0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py index 9b22e3cb869..8072ba96575 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/aaaa/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py index fdc5e089bea..f1e6ba6ba40 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py index b2a26761703..43c13ce0e9b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py index f912963702c..146db91ebd9 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py index 4f8c43fe2fa..1b2cbde2a0b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py index 629f6ce0a9c..a49182259fc 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/caa/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py index f9a05d95f59..185381c203f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py index 3549ed89b2a..fbe5f0e8a8b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py index 8c810616f8f..faf4b287953 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py index 8aad10c8fbb..61abf960cc0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py index 6c07eb5970d..9c407f8a3c1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/cname/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py index 528593759ef..b25af65674b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py index 00fb3008c3a..314a7ca122b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py index 0336388b341..9996de92faa 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py index 4f56ea1f6f7..0a63043ca5a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py index 9f65a95118c..dd7ffa29d41 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ds/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py index 802f031d9a6..f081eb0e0d6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py index d34b51f1278..5de9522496d 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py index e53f6e8588b..f26aa3058c7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py index e3490b30264..decb0f29317 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py index 24461d84fc8..82a7b030de8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/mx/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py index c1200e36bf8..67dfc888533 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py index 82a29436339..af9d7335918 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py index 9b3b31d0dcc..060b46cce20 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py index a00565b0130..57c8c7d5023 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py index 26652618792..792ed23a311 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/naptr/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py index 07316f88406..31d8d884eea 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py index a9babac46c1..d63b2d532b2 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py index 62519686aa4..78cf33af107 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py index e6d2a61dd53..7b2b64bd468 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py index 81ed682f5b3..3889bc477b6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ns/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py index 470b75c501b..dd093fb2cdb 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py index 1c42a686940..6d2d91181b2 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py index 2c043cd34d4..0c6b0a4b020 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py index 9f1b324ccbe..68428732eb7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py index 2ace8d5af7c..13fe17564c2 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/ptr/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py index 671fd2b8339..662e5fa7ec9 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/soa/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py index 0c28845540e..e74adbe2801 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py index 326a6f4ae28..271bc6ac287 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py index 3e8316af61a..054bd90c7a0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py index 7ba9eee3b9a..c7e2778d708 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py index 6dc5bd7b298..7562f070d96 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/srv/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py index c1f77e078f2..a246dc66c18 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py index 16a4b2ac9df..ae11f8c9b44 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py index a0f6d8ec29a..a5875239e1f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py index c631e24036d..fd8f11b0fdd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py index 2eb9529fb77..d8c0e1554db 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/tlsa/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py index 5e8d04415b5..15bd745b287 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py index 29b49f4d406..6e5ebcddad8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py index b0de125bb96..adbf9b3c397 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py index 8b6827e8ece..4afc3d63b28 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py index 808b5e166ba..25601c51214 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/dns/record_set/txt/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, register_command, AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.operations.latest.network.dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py index 03ae3e87e75..7bd68e7d3b3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route._update import Update as _ExpressRouteUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py index 655bb4877b2..46588c38587 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route.gateway.connection._create import Create as _ExpressRouteConnectionCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py index 2b20930a5a3..3a08436a2e6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/gateway/connection/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.express_route.gateway.connection._update import Update as _ExpressRouteConnectionUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py index 0de5ffe15cd..fd91a406d59 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route.peering._create import Create as _ExpressRoutePeeringCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py index 120c6d761f1..4debc83b4e3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/peering/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route.peering._update import Update as _ExpressRoutePeeringUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py index 12264702e35..57c1dfd2358 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route.port._create import Create as _ExpressRoutePortCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py index 80c5c1cfaf7..7c59f3f31e8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/express_route/port/link/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.express_route.port.link._update import Update as _ExpressRoutePortLinkUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py index 13dc7089ee4..7dfeee150e1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_create.py @@ -6,8 +6,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZResourceIdArg, AAZStrArg +from azure.mgmt.core.tools import is_valid_resource_id from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._create import Create as _LBAddressPoolCreate from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.basic._create import Create as _LBAddressPoolBasicCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py index e2608ec637b..3410a9370e9 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import register_command from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.basic._delete import Delete as _LBAddressPoolBasicDelete diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py index c05a4df3def..dd20e353a65 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/_update.py @@ -6,8 +6,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value, AAZResourceIdArg, AAZStrArg +from azure.mgmt.core.tools import is_valid_resource_id from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool._update import Update as _LBAddressPoolUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py index e3dee11c2af..1d0f9533c24 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_add.py @@ -6,8 +6,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.core.aaz import AAZResourceIdArgFormat +from azure.mgmt.core.tools import is_valid_resource_id from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._add import Add as _LBAddressPoolAddressAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py index f21db11911f..9ff4c6e329a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/address_pool/address/_update.py @@ -6,8 +6,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value +from azure.mgmt.core.tools import is_valid_resource_id from azure.cli.command_modules.network.aaz.latest.network.lb.address_pool.address._update import Update as _LBAddressPoolAddressUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py index d60f14c067a..52c746734d5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_create.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value, AAZStrArg, AAZArgEnum from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._create import Create as _LBFrontendIPCreate from knack.log import get_logger diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py index ad8c41bbf1d..3f3059e09d8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/frontend_ip/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value, AAZStrArg, AAZArgEnum from azure.cli.command_modules.network.aaz.latest.network.lb.frontend_ip._update import Update as _LBFrontendIPUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py index 1b302793545..fb4fac849b4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_create.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_pool._create import Create as _LBInboundNatPoolCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py index 673122cc0db..ac3ed4152df 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_pool/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_pool._update import Update as _LBInboundNatPoolUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py index 67ddd1dd443..89dc5bff2d0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_create.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_rule._create import Create as _LBInboundNatRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py index 5f254823a34..d33cca1ccd2 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/inbound_nat_rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value from azure.cli.command_modules.network.aaz.latest.network.lb.inbound_nat_rule._update import Update as _LBInboundNatRuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py index 95f6c83e2d0..e505f37492f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg from azure.cli.command_modules.network.aaz.latest.network.lb.outbound_rule._create import Create as _LBOutboundRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py index 3e624e15d8d..46aab758e85 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/outbound_rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, AAZListArg, AAZResourceIdArg from azure.cli.command_modules.network.aaz.latest.network.lb.outbound_rule._update import Update as _LBOutboundRuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py index f28b70f5e7d..c97b252a159 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_create.py @@ -5,12 +5,11 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -import logging - from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.lb.probe._create import Create as _LBProbeCreate +from knack.log import get_logger -logger = logging.getLogger(__name__) +logger = get_logger(__name__) class LBProbeCreate(_LBProbeCreate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py index 99ed714f07a..725699710ed 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/probe/_update.py @@ -4,12 +4,12 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long, protected-access, too-few-public-methods -import logging from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.lb.probe._update import Update as _LBProbeUpdate +from knack.log import get_logger -logger = logging.getLogger(__name__) +logger = get_logger(__name__) class LBProbeUpdate(_LBProbeUpdate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py index 9f7b811a5e9..da5715bb054 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_create.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id from azure.cli.command_modules.network.aaz.latest.network.lb.rule._create import Create as _LBRuleCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py index 67f3b9803e7..a03fb8828e0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/lb/rule/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import register_command, AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg, AAZStrArg, AAZArgEnum +from azure.cli.core.aaz import AAZResourceIdArgFormat, has_value, AAZListArg, AAZResourceIdArg from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id from azure.cli.command_modules.network.aaz.latest.network.lb.rule._update import Update as _LBRuleUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py index 8c2b0567526..c149e6dc66a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.nic._create import Create as _NICCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py index 71c5230c73e..645cdfdcfb5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.nic._update import Update as _NICUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py index 64b73daf867..9213bb91a81 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_create.py @@ -5,9 +5,9 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.nic.ip_config._create import Create as _NICIPConfigCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py index bd83666ec42..64eb06fe5da 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nic/ip_config/_update.py @@ -5,9 +5,9 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.nic.ip_config._update import Update as _NICIPConfigUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py index 05c2cb392c4..827d5fe7b5d 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/nsg/rule/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.nsg.rule._create import Create as _NSGRuleCreate from azure.cli.command_modules.network.custom import _handle_plural_or_singular diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py index b10617ef691..278f142547f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.private_endpoint._create import Create as _PrivateEndpointCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py index e48322ec379..02da45e0b0a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_endpoint/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.private_endpoint._update import Update as _PrivateEndpointUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py index 6ddceef7905..3852478fd05 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_create.py @@ -5,9 +5,9 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg -from azure.cli.core.util import CLIError, sdk_no_wait +from azure.cli.core.util import CLIError from azure.cli.command_modules.network.aaz.latest.network.private_link_service._create import Create as _PrivateLinkServiceCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py index 870308afaef..b11653f270a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/private_link_service/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.private_link_service._update import Update as _PrivateLinkServiceUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py index f7d281b7899..e65ff33b0b0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.public_ip._update import Update as _PublicIPUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py index e956ca39ad8..0688d6c61bd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/public_ip/prefix/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.public_ip.prefix._create import Create as _PublicIpPrefixCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py index 4affada6622..9caa99c9de3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet._create import Create as _VNetCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py index 0092b2a0d3d..a1fe32394c7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/_update.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet._update import Update as _VNetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py index 55679856db3..cfb404d35cf 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_create.py @@ -5,9 +5,9 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._create import Create as _VNetSubnetCreate from azure.cli.command_modules.network.custom import _handle_plural_or_singular, subnet_disable_ple_msg, subnet_disable_pls_msg diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py index d85bef1eee6..a6c9a55e3f2 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet/subnet/_update.py @@ -5,9 +5,9 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg -from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError, UnrecognizedArgumentError, ResourceNotFoundError, ArgumentUsageError +from azure.cli.core.azclierror import ArgumentUsageError from azure.cli.command_modules.network.aaz.latest.network.vnet.subnet._update import Update as _VNetSubnetUpdate from azure.cli.command_modules.network.custom import _handle_plural_or_singular, subnet_disable_ple_msg, subnet_disable_pls_msg diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py index 240a088b6a7..5df0fd55d41 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.custom import RootCertFormat from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._create import Create as _VnetGatewayCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py index b62bd492f02..5ebe2ebfb96 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._list import List as _VNetGatewayList diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py index 572dbdcaacc..902aca871f5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._show import Show as _VNetGatewayShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py index f354e5ff592..eef51c7b0b4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/_update.py @@ -5,9 +5,12 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.custom import RootCertFormat from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway._update import Update as _VnetGatewayUpdate +from knack.log import get_logger + +logger = get_logger(__name__) class VnetGatewayUpdate(_VnetGatewayUpdate): diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py index c97b0c97b9b..7084e944d32 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_add.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._add import Add as _VnetGatewayNatRuleAdd diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py index 50537587525..8a5cdfc1353 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._list import List as _VnetGatewayNatRuleShow diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py index 922c37b2b69..971fb840dde 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py @@ -3,9 +3,9 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -# pylint: disable=line-too-long, protected-access, too-few-public-methods +# pylint: disable=no-self-use, no-member, too-many-lines, unused-argument -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._remove import Remove as _VnetGatewayNatRuleRemove diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py index 5e9ae09a21f..fa4d9b9e3f5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/root_cert/_create.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import AAZClientConfiguration, has_value, register_client, AAZFileArgTextFormat +from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.root_cert._create import Create as _VnetGatewayRootCertCreate diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py index 21284330a34..5b35581d3e4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_helpers.py @@ -5,14 +5,15 @@ # pylint: disable=line-too-long, protected-access -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id +from azure.cli.core.azclierror import ValidationError from azure.cli.core.commands.arm import get_arm_resource_by_id -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZStrArg from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.profiles import ResourceType from azure.cli.core.commands.validators import validate_tags from azure.cli.command_modules.network._validators import _resolve_api_version +from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._update import Update as _WatcherConnectionMonitorUpdate def get_network_watcher_from_location(cmd, watcher_name="watcher_name", rg_name="watcher_rg"): @@ -87,13 +88,6 @@ def process_nw_cm_v2_create_namespace(cmd): raise ValidationError('usage error: --output-type is specified but no other resource id provided') -# These are helper classes used by custom.py functions, not registered commands. -# They inherit AZ_NAME from the aaz parent but should NOT be auto-registered. -# They are placed here (not in a _.py file) to avoid autoloading. - -from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._update import Update as _WatcherConnectionMonitorUpdate - - class WatcherConnectionMonitorOutputRemove(_WatcherConnectionMonitorUpdate): AZ_NAME = None diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py index ff861ca2389..43b61a29088 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_run_configuration_diagnostic.py @@ -5,9 +5,9 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.mgmt.core.tools import is_valid_resource_id, resource_id +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZStrArg from azure.cli.command_modules.network.aaz.latest.network.watcher._run_configuration_diagnostic import RunConfigurationDiagnostic as _RunConfigurationDiagnostic from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_resource diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py index 0d451923bc8..6d1fd244de8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_next_hop.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg, AAZStrArg, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher._show_next_hop import ShowNextHop as _ShowNextHop from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py index ae38409d9a1..c5f014c1649 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_security_group_view.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg, AAZStrArg, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher._show_security_group_view import ShowSecurityGroupView as _ShowSecurityGroupView from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py index 1a5b43c7d32..95124b58387 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_show_topology.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.mgmt.core.tools import parse_resource_id +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceIdArgFormat from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.profiles import ResourceType from azure.cli.command_modules.network.aaz.latest.network.watcher._show_topology import ShowTopology as _ShowTopology diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py index 812a48ef3ac..acffddff780 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_connectivity.py @@ -6,8 +6,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZStrArg, AAZDictArg from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.profiles import ResourceType from azure.cli.command_modules.network.aaz.latest.network.watcher._test_connectivity import TestConnectivity as _TestConnectivity diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py index e1d4260e2e2..7521fe27b7c 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/_test_ip_flow.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import AAZResourceLocationArg, AAZStrArg, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher._test_ip_flow import TestIpFlow as _TestIPFlow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py index c7b5aa23782..a63e1c66302 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_create.py @@ -5,9 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._create import Create as _WatcherConnectionMonitorCreate from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location, process_nw_cm_v2_create_namespace diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py index 73e502e0713..f91985ee2f0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._delete import Delete as _WatcherConnectionMonitorDelete from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py index e39546ec611..848838cb3ef 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._list import List as _WatcherConnectionMonitorList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py index f72bce56709..cc19f3ed1b8 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_query.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._query import Query as _WatcherConnectionMonitorQuery from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py index f55659346ab..e0adc3df396 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._show import Show as _WatcherConnectionMonitorShow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py index c873ac79275..57f1486fea4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_start.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._start import Start as _WatcherConnectionMonitorStart from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py index 0bd97624b67..0ff77fd02c1 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/_stop.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor._stop import Stop as _WatcherConnectionMonitorStop from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py index c955d6ffdcc..37672880eaf 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_add.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZListArg, AAZStrArg from azure.cli.core.aaz.utils import assign_aaz_list_arg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._add import Add as _WatcherConnectionMonitorEndpointAdd from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py index 31b6347c984..a827ebe71dc 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._list import List as _WatcherConnectionMonitorEndpointList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py index 85c920ba462..508481c9a89 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_remove.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZListArg, AAZStrArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._remove import Remove as _WatcherConnectionMonitorEndpointRemove from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py index 179f867b9d3..f067b88bcf9 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/endpoint/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.endpoint._show import Show as _WatcherConnectionMonitorEndpointShow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py index 6b9eaeffe0b..4e9c796dbba 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_add.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.output._add import Add as _WatcherConnectionMonitorOutputAdd from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py index c32e5806424..94af2654861 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/output/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.output._list import List as _WatcherConnectionMonitorOutputList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py index bea213f07f7..5b9d2b33e44 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_add.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZListArg, AAZStrArg, AAZDictArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._add import Add as _MonitorTestConfigurationAdd from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py index 5092660b0e1..f370379ef53 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._list import List as _MonitorTestConfigurationList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py index 8db67469ba2..5e6089b5fbf 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_remove.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZListArg, AAZStrArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._remove import Remove as _MonitorTestConfigurationRemove from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py index 3ce3b5fbef5..7a71eca62c7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_configuration/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_configuration._show import Show as _MonitorTestConfigurationShow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py index 0efd23a021c..3e7fef8ccc7 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_add.py @@ -5,9 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_group._add import Add as _WatcherConnectionMonitorTestGroupAdd from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py index 45cb00b96b8..e0647a3f652 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_group._list import List as _WatcherConnectionMonitorTestGroupList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py index 562b61c1f5b..e885c9a03ab 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/connection_monitor/test_group/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.connection_monitor.test_group._show import Show as _WatcherConnectionMonitorTestGroupShow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py index 1ba6b42e630..cc9760ec7d5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_create.py @@ -6,10 +6,10 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from knack.util import CLIError -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.mgmt.core.tools import is_valid_resource_id +from azure.cli.core.azclierror import RequiredArgumentMissingError, MutuallyExclusiveArgumentError from azure.cli.core.commands.arm import get_arm_resource_by_id -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZBoolArg, AAZIntArg, AAZIntArgFormat, AAZResourceIdArg, AAZResourceIdArgFormat from azure.cli.command_modules.network._validators import validate_managed_identity_resource_id from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._create import Create as _NwFlowLogCreate from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py index e5f02cd07ca..4eb149eecfd 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg, AAZResourceLocationArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._delete import Delete as _NwFlowLogDelete from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py index 7f294384c63..3477e0ac5a6 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg, AAZResourceLocationArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._list import List as _NwFlowLogList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py index f0a2eacd1d8..7e3b36b71aa 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/flow_log/_update.py @@ -6,10 +6,10 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from knack.util import CLIError -from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id, resource_id -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError +from azure.mgmt.core.tools import is_valid_resource_id +from azure.cli.core.azclierror import MutuallyExclusiveArgumentError from azure.cli.core.commands.arm import get_arm_resource_by_id -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZBoolArg, AAZIntArg, AAZIntArgFormat, AAZResourceIdArg, AAZResourceIdArgFormat from azure.cli.command_modules.network._validators import validate_managed_identity_resource_id from azure.cli.command_modules.network.aaz.latest.network.watcher.flow_log._update import Update as _NwFlowLogUpdate from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py index 0bb9a2ec398..87c6ab64226 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_create.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.azclierror import ValidationError, RequiredArgumentMissingError, MutuallyExclusiveArgumentError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.azclierror import ValidationError +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._create import Create as _PacketCaptureCreate from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_vm, get_network_watcher_from_vmss diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py index 5d220aecdc1..66c436da99f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_delete.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._delete import Delete as _PacketCaptureDelete from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py index ec22fcf42cb..ee28a0e3942 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_list.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._list import List as _PacketCaptureList from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py index 5bea51f5c95..a0596630f0e 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._show import Show as _PacketCaptureShow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py index 7dbde9cc249..1cff40634f4 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_show_status.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._show_status import ShowStatus as _PacketCaptureShowStatus from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py index 3983c332921..5e51ba7879f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/packet_capture/_stop.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import AAZResourceLocationArg from azure.cli.command_modules.network.aaz.latest.network.watcher.packet_capture._stop import Stop as _PacketCaptureStop from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_location diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py index afc425cb516..37b4cfc821a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_show.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher.troubleshooting._show import Show as _NwTroubleshootingShow from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_resource diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py index 9d58f735298..f0dfc0b0c79 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/watcher/troubleshooting/_start.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, protected-access, too-few-public-methods from knack.util import CLIError -from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZResourceLocationArgFormat, AAZListArg, AAZStrArg, AAZBoolArg, AAZFloatArg, AAZIntArg, AAZIntArgFormat, AAZDictArg, AAZResourceIdArg, AAZResourceIdArgFormat +from azure.cli.core.aaz import has_value, AAZResourceLocationArg, AAZStrArg, AAZResourceIdArg, AAZResourceIdArgFormat from azure.cli.command_modules.network.aaz.latest.network.watcher.troubleshooting._start import Start as _NwTroubleshootingStart from azure.cli.command_modules.network.operations.latest.network.watcher._helpers import get_network_watcher_from_resource From ba93af6bdeea359a0db061cc384eb9afdc0bfdb0 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 4 Mar 2026 16:21:13 +1100 Subject: [PATCH 17/21] Fix style --- .../operations/latest/network/vnet_gateway/nat_rule/_remove.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py index 971fb840dde..ff5276953aa 100644 --- a/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py +++ b/src/azure-cli/azure/cli/command_modules/network/operations/latest/network/vnet_gateway/nat_rule/_remove.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, no-member, too-many-lines, unused-argument +# pylint: disable=no-self-use, no-member, too-many-lines, unused-argument, line-too-long, protected-access, too-few-public-methods from azure.cli.core.aaz import has_value from azure.cli.command_modules.network.aaz.latest.network.vnet_gateway.nat_rule._remove import Remove as _VnetGatewayNatRuleRemove From 7ff6a909979399bb18608fd0ada0aca6f3e008a2 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 4 Mar 2026 16:47:27 +1100 Subject: [PATCH 18/21] Fix style of privatedns --- .../latest/network/private_dns/link/vnet/_create.py | 5 ++++- .../latest/network/private_dns/record_set/_base.py | 1 + .../latest/network/private_dns/record_set/a/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/a/_update.py | 1 + .../latest/network/private_dns/record_set/aaaa/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/aaaa/_update.py | 1 + .../latest/network/private_dns/record_set/cname/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/cname/_update.py | 1 + .../latest/network/private_dns/record_set/mx/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/mx/_update.py | 1 + .../latest/network/private_dns/record_set/ptr/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/ptr/_update.py | 1 + .../latest/network/private_dns/record_set/soa/_show.py | 1 + .../latest/network/private_dns/record_set/srv/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/srv/_update.py | 1 + .../latest/network/private_dns/record_set/txt/_delete.py | 5 ++++- .../latest/network/private_dns/record_set/txt/_update.py | 1 + .../operations/latest/network/private_dns/zone/_create.py | 5 ++++- 18 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py index 34f5c68f6a9..7cc2bd9087d 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/link/vnet/_create.py @@ -3,7 +3,10 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.link.vnet._create import Create as _PrivateDNSLinkVNetCreate +# pylint: disable=protected-access +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.link.vnet._create import ( + Create as _PrivateDNSLinkVNetCreate +) class PrivateDNSLinkVNetCreate(_PrivateDNSLinkVNetCreate): diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py index 1285b850b03..d3ccc9bf73c 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/_base.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=too-few-public-methods, no-self-use, line-too-long, protected-access, unused-argument from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._create import Create as _RecordSetCreate from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._delete import Delete as _RecordSetDelete from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.record_set._list_by_type import ListByType as _RecordSetList diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py index 9be51216e70..45136c39ae3 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set a delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set a delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetADelete(RecordSetDelete): """ Delete an A record set and all associated records. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py index b1a41d0b9e3..f04fbb92e77 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/a/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py index 67a1f67bd1f..0cb760a9b82 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set aaaa delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set aaaa delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetAAAADelete(RecordSetDelete): """ Delete an AAAA record set and all associated records. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py index 1abd9c578e2..a1848a063d8 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/aaaa/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py index 3b32c7b80dc..6053e0afc12 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set cname delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set cname delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetCNAMEDelete(RecordSetDelete): """ Delete a CNAME record set and its associated record. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py index 69b2f660ed6..bb0e81c7c05 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/cname/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py index 2f363f2df2a..f898a796d09 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set mx delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set mx delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetMXDelete(RecordSetDelete): """ Delete an MX record set and all associated records. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py index 9ff0e13620a..db2d90fe493 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/mx/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py index 141179ea854..5e864fecb56 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set ptr delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set ptr delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetPTRDelete(RecordSetDelete): """ Delete a PTR record set and all associated records. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py index 58487db537c..a9ede24c9b2 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/ptr/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py index 740a0ec1557..53dc9c63d62 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/soa/_show.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetShow diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py index 62542bea609..391f18fd3eb 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set srv delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set srv delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetSRVDelete(RecordSetDelete): """ Delete an SRV record set and all associated records. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py index 7fda5ae03b7..af9e17f1a14 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/srv/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py index b093fec4bc0..7e7f691d1af 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_delete.py @@ -8,7 +8,10 @@ from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetDelete -@register_command("network private-dns record-set txt delete", confirmation="Are you sure you want to perform this operation?") +@register_command( + "network private-dns record-set txt delete", + confirmation="Are you sure you want to perform this operation?" +) class RecordSetTXTDelete(RecordSetDelete): """ Delete a TXT record set and all associated records. diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py index f898bbfd19e..fb35e6322c3 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/record_set/txt/_update.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long from azure.cli.core.aaz import register_command from azure.cli.command_modules.privatedns.operations.latest.network.private_dns.record_set._base import RecordSetUpdate diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py index 39fa3359116..e2b6ed308dc 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/operations/latest/network/private_dns/zone/_create.py @@ -3,9 +3,12 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access from knack.log import get_logger -from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.zone._create import Create as _PrivateDNSZoneCreate +from azure.cli.command_modules.privatedns.aaz.latest.network.private_dns.zone._create import ( + Create as _PrivateDNSZoneCreate +) logger = get_logger(__name__) From b47809c7784ab2ace291533e322623053c6a70ab Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Wed, 4 Mar 2026 16:54:31 +1100 Subject: [PATCH 19/21] Fix unused import --- src/azure-cli/azure/cli/command_modules/privatedns/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/privatedns/commands.py b/src/azure-cli/azure/cli/command_modules/privatedns/commands.py index 6767bb52633..98dda81a1ac 100644 --- a/src/azure-cli/azure/cli/command_modules/privatedns/commands.py +++ b/src/azure-cli/azure/cli/command_modules/privatedns/commands.py @@ -6,7 +6,7 @@ # pylint: disable=line-too-long, too-many-locals from azure.cli.core.commands import CliCommandType from azure.cli.command_modules.privatedns._client_factory import cf_privatedns_mgmt_zones -from azure.cli.command_modules.privatedns._format import (transform_privatedns_zone_table_output, transform_privatedns_link_table_output, transform_privatedns_record_set_output, transform_privatedns_record_set_table_output) +from azure.cli.command_modules.privatedns._format import transform_privatedns_record_set_output def load_command_table(self, _): From fa5da3532ea2dbcc32fd0d85025346980b94c8d4 Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 6 Mar 2026 12:50:47 +1100 Subject: [PATCH 20/21] Fix style --- src/azure-cli-core/azure/cli/core/aaz/_command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/aaz/_command.py b/src/azure-cli-core/azure/cli/core/aaz/_command.py index 6246bb7e31d..5926c522c7b 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_command.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_command.py @@ -506,8 +506,8 @@ def _load_aaz_by_path(loader, base_path, base_module, args, command_table, comma entry_path = os.path.join(base_path, entry) # Command files: _create.py, _list.py, etc. - if (entry.startswith('_') and not entry.startswith('__') - and entry.endswith('.py') and os.path.isfile(entry_path)): + if (entry.startswith('_') and not entry.startswith('__') and + entry.endswith('.py') and os.path.isfile(entry_path)): mod = _try_import_module(f'.{entry[:-3]}', base_module) if mod: _register_from_module(loader, mod, command_table, command_group_table) From 81717b2b03547744a16a67b4e991d5a4e00f11ea Mon Sep 17 00:00:00 2001 From: Qinkai Wu Date: Fri, 6 Mar 2026 15:32:14 +1100 Subject: [PATCH 21/21] remove register on unused command group policy-insights --- .../policyinsights/aaz/latest/policy_insights/__cmd_group.py | 3 --- .../aaz/latest/policy_insights/attestation/__cmd_group.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/__cmd_group.py index 828bbf5bf90..7259eb11114 100644 --- a/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/__cmd_group.py +++ b/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/__cmd_group.py @@ -11,9 +11,6 @@ from azure.cli.core.aaz import * -@register_command_group( - "policy-insights", -) class __CMDGroup(AAZCommandGroup): """Manage resource policies. diff --git a/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/attestation/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/attestation/__cmd_group.py index f13c88d0e34..acb215d57be 100644 --- a/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/attestation/__cmd_group.py +++ b/src/azure-cli/azure/cli/command_modules/policyinsights/aaz/latest/policy_insights/attestation/__cmd_group.py @@ -11,9 +11,6 @@ from azure.cli.core.aaz import * -@register_command_group( - "policy-insights attestation", -) class __CMDGroup(AAZCommandGroup): """Manage resource policy attestation.