[Network] `az network application-gateway rewrite-rule`: Add `--request-header-configurations` and `--response-header-configurations` (#29126)

This commit is contained in:
Zeng Taoxu 2024-06-11 16:13:32 +08:00 коммит произвёл GitHub
Родитель 017450a395
Коммит 1a1c76299b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 2216 добавлений и 1478 удалений

Просмотреть файл

@ -1346,8 +1346,6 @@ class AGRewriteRuleCreate(_AGRewriteRuleCreate):
"Values from: `az network application-gateway rewrite-rule list-response-headers`.",
)
args_schema.response_headers.Element = AAZStrArg()
args_schema.request_header_configurations._registered = False
args_schema.response_header_configurations._registered = False
return args_schema
def pre_operations(self):
@ -1387,8 +1385,6 @@ class AGRewriteRuleUpdate(_AGRewriteRuleUpdate):
args_schema.response_headers.Element = AAZStrArg(
nullable=True,
)
args_schema.request_header_configurations._registered = False
args_schema.response_header_configurations._registered = False
return args_schema
def pre_operations(self):

Просмотреть файл

@ -83,6 +83,22 @@ network application-gateway rewrite-rule set:
network application-gateway rewrite-rule:
rule_exclusions:
- require_wait_command_if_no_wait
network application-gateway rewrite-rule create:
parameters:
request_header_configurations:
rule_exclusions:
- option_length_too_long
response_header_configurations:
rule_exclusions:
- option_length_too_long
network application-gateway rewrite-rule update:
parameters:
request_header_configurations:
rule_exclusions:
- option_length_too_long
response_header_configurations:
rule_exclusions:
- option_length_too_long
network application-gateway root-cert:
rule_exclusions:
- require_wait_command_if_no_wait

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -2140,6 +2140,7 @@ class NetworkAppGatewayRewriteRuleset(ScenarioTest):
'rule': 'rule1',
'rule2': 'rule2',
'rule3': 'rule3',
'rule4': 'rule4',
'var': 'http_req_Authorization'
})
self.cmd('network public-ip create -g {rg} -n {ip} --sku Standard')
@ -2182,6 +2183,30 @@ class NetworkAppGatewayRewriteRuleset(ScenarioTest):
# ISSUE#17373 create rewrite rule without
self.cmd('network application-gateway rewrite-rule create -g {rg} --gateway-name {gw} --rule-set-name {set} -n {rule3} --sequence 123 --modified-path "/" --no-wait')
# manage rewrite rules with response-header-configurations
self.cmd('network application-gateway rewrite-rule create -g {rg} --gateway-name {gw} --rule-set-name {set} -n {rule4} '
'--sequence 123 --response-header-configurations [{{"header-name":Set-Cookie,"header-value":hat1,"header-value-matcher":{{"ignore-case":true,"negate":true,"pattern":"(https?)\/\/.*azurewebsites\.net(.*)$"}}}}] --request-headers foo=bar '
'--modified-path "/def" --modified-query-string "a=b&c=d%20f"',
checks=[
self.check('actionSet.responseHeaderConfigurations[0].headerName', 'Set-Cookie'),
self.check('actionSet.responseHeaderConfigurations[0].headerValue', 'hat1'),
self.check('actionSet.responseHeaderConfigurations[0].headerValueMatcher.ignoreCase', True),
self.check('actionSet.responseHeaderConfigurations[0].headerValueMatcher.negate', True),
self.check('actionSet.responseHeaderConfigurations[0].headerValueMatcher.pattern', "(https?)\/\/.*azurewebsites\.net(.*)$"),
])
self.cmd(
'network application-gateway rewrite-rule update -g {rg} --gateway-name {gw} --rule-set-name {set} -n {rule4} '
'--sequence 123 --response-header-configurations [{{"header-name":Set-Cookie,"header-value":hat2,"header-value-matcher":{{"ignore-case":true,"negate":false,"pattern":"(https?)\/\/.*azurewebsites\.net(.*)$"}}}}] --request-headers foo=bar '
'--modified-path "/def" --modified-query-string "a=b&c=d%20f"',
checks=[
self.check('actionSet.responseHeaderConfigurations[0].headerName', 'Set-Cookie'),
self.check('actionSet.responseHeaderConfigurations[0].headerValue', 'hat2'),
self.check('actionSet.responseHeaderConfigurations[0].headerValueMatcher.ignoreCase', True),
self.check('actionSet.responseHeaderConfigurations[0].headerValueMatcher.negate', False),
self.check('actionSet.responseHeaderConfigurations[0].headerValueMatcher.pattern',
"(https?)\/\/.*azurewebsites\.net(.*)$"),
])
# manage rewrite rule conditions
self.cmd('network application-gateway rewrite-rule condition create -g {rg} --gateway-name {gw} --rule-set-name {set} --rule-name {rule} --variable {var} --pattern "^Bearer" --ignore-case false --negate --no-wait')
self.cmd('network application-gateway rewrite-rule condition update -g {rg} --gateway-name {gw} --rule-set-name {set} --rule-name {rule} --variable {var} --pattern "^Bearers" --no-wait')