Skip to content

Commit dfc68a7

Browse files
authored
{Network} az network application-gateway address-pool/auth-cert/client-cert/root-cert: Migrate commands to codegen v2 (#25159)
1 parent dec8a11 commit dfc68a7

47 files changed

Lines changed: 96040 additions & 7416 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/azure-cli/azure/cli/command_modules/network/_params.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from azure.cli.core.commands.template_create import get_folded_parameter_help_string
1717
from azure.cli.core.local_context import LocalContextAttribute, LocalContextAction, ALL
1818
from azure.cli.command_modules.network._validators import (
19-
dns_zone_name_type, validate_cert, validate_inbound_nat_rule_id_list,
19+
dns_zone_name_type, validate_inbound_nat_rule_id_list,
2020
validate_address_pool_id_list, validate_inbound_nat_rule_name_or_id,
2121
validate_address_pool_name_or_id, load_cert_file, validate_metadata,
2222
validate_dns_record_type, validate_target_listener,
@@ -33,8 +33,7 @@
3333
validate_user_assigned_identity, validate_virtul_network_gateway,
3434
NWConnectionMonitorEndpointFilterItemAction, NWConnectionMonitorTestConfigurationHTTPRequestHeaderAction,
3535
process_private_link_resource_id_argument, process_private_endpoint_connection_id_argument,
36-
validate_vpn_connection_name_or_id,
37-
process_vnet_name_or_id, validate_trusted_client_cert)
36+
validate_vpn_connection_name_or_id, process_vnet_name_or_id)
3837
from azure.cli.command_modules.network._completers import (
3938
subnet_completion_list, get_lb_subresource_completion_list, get_ag_subresource_completion_list,
4039
ag_url_map_rule_completion_list, tm_endpoint_completion_list, get_sdk_completer)
@@ -180,10 +179,8 @@ def load_arguments(self, _):
180179
c.argument('capacity', help='The number of instances to use with the application gateway.', type=int)
181180

182181
ag_subresources = [
183-
{'name': 'auth-cert', 'display': 'authentication certificate', 'ref': 'authentication_certificates'},
184182
{'name': 'frontend-ip', 'display': 'frontend IP configuration', 'ref': 'frontend_ip_configurations'},
185183
{'name': 'frontend-port', 'display': 'frontend port', 'ref': 'frontend_ports'},
186-
{'name': 'address-pool', 'display': 'backend address pool', 'ref': 'backend_address_pools'},
187184
{'name': 'http-settings', 'display': 'backed HTTP settings', 'ref': 'backend_http_settings_collection'},
188185
{'name': 'http-listener', 'display': 'HTTP listener', 'ref': 'http_listeners'},
189186
{'name': 'rule', 'display': 'request routing rule', 'ref': 'request_routing_rules'},
@@ -192,8 +189,6 @@ def load_arguments(self, _):
192189
{'name': 'redirect-config', 'display': 'redirect configuration', 'ref': 'redirect_configurations'},
193190
{'name': 'private-link', 'display': 'private link', 'ref': 'private_link_configurations'}
194191
]
195-
if self.supported_api_version(min_api='2018-08-01'):
196-
ag_subresources.append({'name': 'root-cert', 'display': 'trusted root certificate', 'ref': 'trusted_root_certificates'})
197192
if self.supported_api_version(min_api='2018-12-01'):
198193
ag_subresources.append({'name': 'rewrite-rule set', 'display': 'rewrite rule set', 'ref': 'rewrite_rule_sets'})
199194
if self.supported_api_version(min_api='2021-08-01'):
@@ -219,16 +214,6 @@ def load_arguments(self, _):
219214
with self.argument_context('network application-gateway {}'.format(item)) as c:
220215
c.argument('connection_draining_timeout', min_api='2016-12-01', type=int, help='The time in seconds after a backend server is removed during which on open connection remains active. Range: 0 (disabled) to 3600', arg_group='Gateway' if item == 'create' else None)
221216

222-
with self.argument_context('network application-gateway address-pool') as c:
223-
c.argument('servers', ag_servers_type, arg_group=None)
224-
225-
for scope in ['auth-cert', 'root-cert']:
226-
with self.argument_context('network application-gateway {}'.format(scope)) as c:
227-
c.argument('cert_data', options_list='--cert-file', help='Certificate file path.', type=file_type, completer=FilesCompleter(), validator=validate_cert)
228-
229-
with self.argument_context('network application-gateway root-cert') as c:
230-
c.argument('keyvault_secret', help='KeyVault secret ID.')
231-
232217
with self.argument_context('network application-gateway frontend-ip create') as c:
233218
c.argument('public_ip_address', validator=get_public_ip_validator(), help='The name or ID of the public IP address.', completer=get_resource_name_completion_list('Microsoft.Network/publicIPAddresses'))
234219

@@ -456,16 +441,6 @@ def load_arguments(self, _):
456441
with self.argument_context('network application-gateway identity', min_api='2019-04-01') as c:
457442
c.argument('application_gateway_name', app_gateway_name_type)
458443

459-
with self.argument_context('network application-gateway client-cert', min_api='2020-06-01', id_part=None) as c:
460-
c.argument('application_gateway_name', app_gateway_name_type)
461-
c.argument('client_cert_name', options_list='--name', help='Name of the trusted client certificate that is unique within an Application Gateway')
462-
463-
with self.argument_context('network application-gateway client-cert add', min_api='2020-06-01') as c:
464-
c.argument('client_cert_data', options_list='--data', type=file_type, completer=FilesCompleter(), help='Certificate public data.', validator=validate_trusted_client_cert)
465-
466-
with self.argument_context('network application-gateway client-cert update', min_api='2020-06-01') as c:
467-
c.argument('client_cert_data', options_list='--data', type=file_type, completer=FilesCompleter(), help='Certificate public data.', validator=validate_trusted_client_cert)
468-
469444
with self.argument_context('network application-gateway show-backend-health') as c:
470445
c.argument('expand', help='Expands BackendAddressPool and BackendHttpSettings referenced in backend health.')
471446

src/azure-cli/azure/cli/command_modules/network/_validators.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from azure.cli.core.commands.client_factory import get_subscription_id, get_mgmt_service_client
2020
from azure.cli.core.commands.validators import validate_parameter_set
2121
from azure.cli.core.profiles import ResourceType
22-
from azure.cli.core.azclierror import RequiredArgumentMissingError
2322

2423
logger = get_logger(__name__)
2524

@@ -235,17 +234,6 @@ def read_base_64_file(filename):
235234
return str(base64_data)
236235

237236

238-
def validate_cert(namespace):
239-
if namespace.cert_data:
240-
namespace.cert_data = read_base_64_file(namespace.cert_data)
241-
242-
243-
def validate_trusted_client_cert(namespace):
244-
if namespace.client_cert_data is None or namespace.client_cert_name is None:
245-
raise RequiredArgumentMissingError('To use this cmd, you must specify both name and data')
246-
namespace.client_cert_data = read_base_64_file(namespace.client_cert_data)
247-
248-
249237
def validate_ssl_cert(namespace):
250238
params = [namespace.cert_data, namespace.cert_password]
251239
if all(not x for x in params) and not namespace.key_vault_secret_id:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"network application-gateway address-pool",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage address pools of an application gateway.
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._create import *
13+
from ._delete import *
14+
from ._list import *
15+
from ._show import *
16+
from ._update import *
17+
from ._wait import *

0 commit comments

Comments
 (0)