From 651c18b37cbd23f25a669fd35142797ec4173d71 Mon Sep 17 00:00:00 2001 From: "RuiJun Hu (MSFT)" Date: Mon, 26 May 2025 17:17:41 +0800 Subject: [PATCH] add examples --- .../command_modules/cdn/custom/custom_afdx.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_afdx.py b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_afdx.py index 765d8c45d12..9ba5f2c9206 100644 --- a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_afdx.py +++ b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom_afdx.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # pylint: disable=too-many-locals, too-many-statements too-many-boolean-expressions too-many-branches protected-access +# pylint: disable=line-too-long from azure.mgmt.cdn.models import SkuName from azure.cli.core.aaz._base import has_value @@ -26,7 +27,7 @@ Create as _AFDEndpointCreate, Update as _AFDEndpointUpdate from azure.cli.command_modules.cdn.aaz.latest.afd.origin_group import Show as _AFDOriginGroupShow, \ Create as _AFDOriginGroupCreate, Update as _AFDOriginGroupUpdate -from azure.cli.core.aaz import AAZStrArg, AAZBoolArg, AAZListArg, AAZTimeArg, AAZIntArg, AAZIntArgFormat +from azure.cli.core.aaz import register_command, AAZStrArg, AAZBoolArg, AAZListArg, AAZTimeArg, AAZIntArg, AAZIntArgFormat from knack.util import CLIError from knack.log import get_logger from .custom_rule_util import (create_condition, create_action, @@ -978,7 +979,15 @@ def pre_operations(self): args.actions = actions +@register_command( + "afd rule condition add", +) class AFDRuleconditionAdd(_AFDRuleUpdate): + """Add a condition to a delivery rule within the specified rule set. + + :example: Add a condition to an Azure Front Door rule to match requests based on geographic location. + az afd rule condition add -g rg --rule-set-name ruleset --profile-name profile --rule-name rule --match-variable RemoteAddress --operator GeoMatch --match-values "TH" "US" + """ @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -1063,7 +1072,15 @@ def pre_operations(self): args.conditions = conditions +@register_command( + "afd rule action add", +) class AFDRuleActionCreate(_AFDRuleUpdate): + """Add an action to a delivery rule within the specified rule set. + + :example: Add an action to a delivery rule in an Azure Front Door rule set to perform URL rewriting. + az afd rule action add -g rg --rule-set-name ruleset --profile-name profile --rule-name rule --action-name "UrlRewrite" --source-pattern "/abc" --destination "/def" + """ @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs)