Skip to content

Commit 5699d13

Browse files
Ptnan7Jingnan Xu
andauthored
{AFD} Bug fix for origin group enable health probe (#31452)
Co-authored-by: Jingnan Xu <[email protected]>
1 parent a7b18fb commit 5699d13

File tree

14 files changed

+3208
-1981
lines changed

14 files changed

+3208
-1981
lines changed

src/azure-cli/azure/cli/command_modules/cdn/aaz/latest/afd/origin_group/_create.py

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class Create(AAZCommand):
1818
"""Create a new origin group within the specified profile.
1919
2020
:example: Creates a new origin group within the specified profile.
21-
az afd origin-group create -g group --origin-group-name og1 --profile-name profile --probe-request-type GET --probe-protocol Http --probe-interval-in-seconds 120 --probe-path /test1/azure.txt --sample-size 4 --successful-samples-required 3 --additional-latency-in-milliseconds 50 --enable-health-probe true
21+
az afd origin-group create --resource-group RG --profile-name profile1 --origin-group-name origingroup1 --sample-size 3 --successful-samples-required 3 --additional-latency-in-milliseconds 1000 --health-probe-settings "{probe-path:/path2,probe-request-type:NotSet,probe-protocol:NotSet,probe-interval-in-seconds:10}" --traffic-restoration-time-to-healed-or-new-endpoints-in-minutes 5
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-09-01",
25+
"version": "2025-04-15",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2024-09-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2025-04-15"],
2828
]
2929
}
3030

@@ -52,43 +52,18 @@ def _build_arguments_schema(cls, *args, **kwargs):
5252
)
5353
_args_schema.profile_name = AAZStrArg(
5454
options=["--profile-name"],
55-
help="Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique within the resource group.",
55+
help="Name of the Azure Front Door Standard or Azure Front Door Premium which is unique within the resource group.",
5656
required=True,
57+
fmt=AAZStrArgFormat(
58+
pattern="^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$",
59+
max_length=260,
60+
min_length=1,
61+
),
5762
)
5863
_args_schema.resource_group = AAZResourceGroupNameArg(
5964
required=True,
6065
)
6166

62-
# define Arg Group "HealthProbeSettings"
63-
64-
_args_schema = cls._args_schema
65-
_args_schema.probe_interval_in_seconds = AAZIntArg(
66-
options=["--probe-interval-in-seconds"],
67-
arg_group="HealthProbeSettings",
68-
help="The number of seconds between health probes.Default is 240sec.",
69-
fmt=AAZIntArgFormat(
70-
maximum=255,
71-
minimum=1,
72-
),
73-
)
74-
_args_schema.probe_path = AAZStrArg(
75-
options=["--probe-path"],
76-
arg_group="HealthProbeSettings",
77-
help="The path relative to the origin that is used to determine the health of the origin.",
78-
)
79-
_args_schema.probe_protocol = AAZStrArg(
80-
options=["--probe-protocol"],
81-
arg_group="HealthProbeSettings",
82-
help="Protocol to use for health probe.",
83-
enum={"Http": "Http", "Https": "Https", "NotSet": "NotSet"},
84-
)
85-
_args_schema.probe_request_type = AAZStrArg(
86-
options=["--probe-request-type"],
87-
arg_group="HealthProbeSettings",
88-
help="The type of health probe request that is made.",
89-
enum={"GET": "GET", "HEAD": "HEAD", "NotSet": "NotSet"},
90-
)
91-
9267
# define Arg Group "LoadBalancingSettings"
9368

9469
_args_schema = cls._args_schema
@@ -111,6 +86,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
11186
# define Arg Group "Properties"
11287

11388
_args_schema = cls._args_schema
89+
_args_schema.health_probe_settings = AAZObjectArg(
90+
options=["--health-probe-settings"],
91+
arg_group="Properties",
92+
help="Health probe settings to the origin that is used to determine the health of the origin.",
93+
)
11494
_args_schema.session_affinity_state = AAZStrArg(
11595
options=["--session-affinity-state"],
11696
arg_group="Properties",
@@ -126,6 +106,30 @@ def _build_arguments_schema(cls, *args, **kwargs):
126106
minimum=0,
127107
),
128108
)
109+
110+
health_probe_settings = cls._args_schema.health_probe_settings
111+
health_probe_settings.probe_interval_in_seconds = AAZIntArg(
112+
options=["probe-interval-in-seconds"],
113+
help="The number of seconds between health probes.Default is 240sec.",
114+
fmt=AAZIntArgFormat(
115+
maximum=255,
116+
minimum=1,
117+
),
118+
)
119+
health_probe_settings.probe_path = AAZStrArg(
120+
options=["probe-path"],
121+
help="The path relative to the origin that is used to determine the health of the origin.",
122+
)
123+
health_probe_settings.probe_protocol = AAZStrArg(
124+
options=["probe-protocol"],
125+
help="Protocol to use for health probe.",
126+
enum={"Http": "Http", "Https": "Https", "NotSet": "NotSet"},
127+
)
128+
health_probe_settings.probe_request_type = AAZStrArg(
129+
options=["probe-request-type"],
130+
help="The type of health probe request that is made.",
131+
enum={"GET": "GET", "HEAD": "HEAD", "NotSet": "NotSet"},
132+
)
129133
return cls._args_schema
130134

131135
def _execute_operations(self):
@@ -213,7 +217,7 @@ def url_parameters(self):
213217
def query_parameters(self):
214218
parameters = {
215219
**self.serialize_query_param(
216-
"api-version", "2024-09-01",
220+
"api-version", "2025-04-15",
217221
required=True,
218222
),
219223
}
@@ -242,7 +246,7 @@ def content(self):
242246

243247
properties = _builder.get(".properties")
244248
if properties is not None:
245-
properties.set_prop("healthProbeSettings", AAZObjectType)
249+
properties.set_prop("healthProbeSettings", AAZObjectType, ".health_probe_settings")
246250
properties.set_prop("loadBalancingSettings", AAZObjectType)
247251
properties.set_prop("sessionAffinityState", AAZStrType, ".session_affinity_state")
248252
properties.set_prop("trafficRestorationTimeToHealedOrNewEndpointsInMinutes", AAZIntType, ".traffic_restoration_time_to_healed_or_new_endpoints_in_minutes")

src/azure-cli/azure/cli/command_modules/cdn/aaz/latest/afd/origin_group/_delete.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class Delete(AAZCommand):
2323
"""
2424

2525
_aaz_info = {
26-
"version": "2024-09-01",
26+
"version": "2025-04-15",
2727
"resources": [
28-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2024-09-01"],
28+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2025-04-15"],
2929
]
3030
}
3131

@@ -54,9 +54,14 @@ def _build_arguments_schema(cls, *args, **kwargs):
5454
)
5555
_args_schema.profile_name = AAZStrArg(
5656
options=["--profile-name"],
57-
help="Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique within the resource group.",
57+
help="Name of the Azure Front Door Standard or Azure Front Door Premium which is unique within the resource group.",
5858
required=True,
5959
id_part="name",
60+
fmt=AAZStrArgFormat(
61+
pattern="^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$",
62+
max_length=260,
63+
min_length=1,
64+
),
6065
)
6166
_args_schema.resource_group = AAZResourceGroupNameArg(
6267
required=True,
@@ -153,7 +158,7 @@ def url_parameters(self):
153158
def query_parameters(self):
154159
parameters = {
155160
**self.serialize_query_param(
156-
"api-version", "2024-09-01",
161+
"api-version", "2025-04-15",
157162
required=True,
158163
),
159164
}

src/azure-cli/azure/cli/command_modules/cdn/aaz/latest/afd/origin_group/_list.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class List(AAZCommand):
1919
"""
2020

2121
_aaz_info = {
22-
"version": "2024-09-01",
22+
"version": "2025-04-15",
2323
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups", "2024-09-01"],
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups", "2025-04-15"],
2525
]
2626
}
2727

@@ -46,6 +46,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
4646
options=["--profile-name"],
4747
help="Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique within the resource group.",
4848
required=True,
49+
fmt=AAZStrArgFormat(
50+
pattern="^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$",
51+
max_length=260,
52+
min_length=1,
53+
),
4954
)
5055
_args_schema.resource_group = AAZResourceGroupNameArg(
5156
required=True,
@@ -118,7 +123,7 @@ def url_parameters(self):
118123
def query_parameters(self):
119124
parameters = {
120125
**self.serialize_query_param(
121-
"api-version", "2024-09-01",
126+
"api-version", "2025-04-15",
122127
required=True,
123128
),
124129
}

src/azure-cli/azure/cli/command_modules/cdn/aaz/latest/afd/origin_group/_show.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
)
1717
class Show(AAZCommand):
1818
"""Get an existing origin group within a profile.
19+
20+
:example: Get an existing origin group within a profile.
21+
az afd origin-group show --resource-group RG --profile-name profile1 --origin-group-name origingroup1
1922
"""
2023

2124
_aaz_info = {
22-
"version": "2024-09-01",
25+
"version": "2025-04-15",
2326
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2024-09-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2025-04-15"],
2528
]
2629
}
2730

@@ -49,9 +52,14 @@ def _build_arguments_schema(cls, *args, **kwargs):
4952
)
5053
_args_schema.profile_name = AAZStrArg(
5154
options=["--profile-name"],
52-
help="Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique within the resource group.",
55+
help="Name of the Azure Front Door Standard or Azure Front Door Premium which is unique within the resource group.",
5356
required=True,
5457
id_part="name",
58+
fmt=AAZStrArgFormat(
59+
pattern="^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$",
60+
max_length=260,
61+
min_length=1,
62+
),
5563
)
5664
_args_schema.resource_group = AAZResourceGroupNameArg(
5765
required=True,
@@ -127,7 +135,7 @@ def url_parameters(self):
127135
def query_parameters(self):
128136
parameters = {
129137
**self.serialize_query_param(
130-
"api-version", "2024-09-01",
138+
"api-version", "2025-04-15",
131139
required=True,
132140
),
133141
}

src/azure-cli/azure/cli/command_modules/cdn/aaz/latest/afd/origin_group/_update.py

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
class Update(AAZCommand):
1818
"""Update a new origin group within the specified profile.
1919
20-
:example: Update the probe setting of the specified origin group.
20+
:example: Update a new origin group within the specified profile.
2121
az afd origin-group update -g group --origin-group-name og1 --profile-name profile --probe-request-type HEAD --probe-protocol Https --probe-interval-in-seconds 120 --probe-path /test1/azure.txt
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-09-01",
25+
"version": "2025-04-15",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2024-09-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.cdn/profiles/{}/origingroups/{}", "2025-04-15"],
2828
]
2929
}
3030

@@ -55,48 +55,19 @@ def _build_arguments_schema(cls, *args, **kwargs):
5555
)
5656
_args_schema.profile_name = AAZStrArg(
5757
options=["--profile-name"],
58-
help="Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique within the resource group.",
58+
help="Name of the Azure Front Door Standard or Azure Front Door Premium which is unique within the resource group.",
5959
required=True,
6060
id_part="name",
61+
fmt=AAZStrArgFormat(
62+
pattern="^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$",
63+
max_length=260,
64+
min_length=1,
65+
),
6166
)
6267
_args_schema.resource_group = AAZResourceGroupNameArg(
6368
required=True,
6469
)
6570

66-
# define Arg Group "HealthProbeSettings"
67-
68-
_args_schema = cls._args_schema
69-
_args_schema.probe_interval_in_seconds = AAZIntArg(
70-
options=["--probe-interval-in-seconds"],
71-
arg_group="HealthProbeSettings",
72-
help="The number of seconds between health probes.Default is 240sec.",
73-
nullable=True,
74-
fmt=AAZIntArgFormat(
75-
maximum=255,
76-
minimum=1,
77-
),
78-
)
79-
_args_schema.probe_path = AAZStrArg(
80-
options=["--probe-path"],
81-
arg_group="HealthProbeSettings",
82-
help="The path relative to the origin that is used to determine the health of the origin.",
83-
nullable=True,
84-
)
85-
_args_schema.probe_protocol = AAZStrArg(
86-
options=["--probe-protocol"],
87-
arg_group="HealthProbeSettings",
88-
help="Protocol to use for health probe.",
89-
nullable=True,
90-
enum={"Http": "Http", "Https": "Https", "NotSet": "NotSet"},
91-
)
92-
_args_schema.probe_request_type = AAZStrArg(
93-
options=["--probe-request-type"],
94-
arg_group="HealthProbeSettings",
95-
help="The type of health probe request that is made.",
96-
nullable=True,
97-
enum={"GET": "GET", "HEAD": "HEAD", "NotSet": "NotSet"},
98-
)
99-
10071
# define Arg Group "LoadBalancingSettings"
10172

10273
_args_schema = cls._args_schema
@@ -122,6 +93,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
12293
# define Arg Group "Properties"
12394

12495
_args_schema = cls._args_schema
96+
_args_schema.health_probe_settings = AAZObjectArg(
97+
options=["--health-probe-settings"],
98+
arg_group="Properties",
99+
help="Health probe settings to the origin that is used to determine the health of the origin.",
100+
nullable=True,
101+
)
125102
_args_schema.session_affinity_state = AAZStrArg(
126103
options=["--session-affinity-state"],
127104
arg_group="Properties",
@@ -139,6 +116,34 @@ def _build_arguments_schema(cls, *args, **kwargs):
139116
minimum=0,
140117
),
141118
)
119+
120+
health_probe_settings = cls._args_schema.health_probe_settings
121+
health_probe_settings.probe_interval_in_seconds = AAZIntArg(
122+
options=["probe-interval-in-seconds"],
123+
help="The number of seconds between health probes.Default is 240sec.",
124+
nullable=True,
125+
fmt=AAZIntArgFormat(
126+
maximum=255,
127+
minimum=1,
128+
),
129+
)
130+
health_probe_settings.probe_path = AAZStrArg(
131+
options=["probe-path"],
132+
help="The path relative to the origin that is used to determine the health of the origin.",
133+
nullable=True,
134+
)
135+
health_probe_settings.probe_protocol = AAZStrArg(
136+
options=["probe-protocol"],
137+
help="Protocol to use for health probe.",
138+
nullable=True,
139+
enum={"Http": "Http", "Https": "Https", "NotSet": "NotSet"},
140+
)
141+
health_probe_settings.probe_request_type = AAZStrArg(
142+
options=["probe-request-type"],
143+
help="The type of health probe request that is made.",
144+
nullable=True,
145+
enum={"GET": "GET", "HEAD": "HEAD", "NotSet": "NotSet"},
146+
)
142147
return cls._args_schema
143148

144149
def _execute_operations(self):
@@ -223,7 +228,7 @@ def url_parameters(self):
223228
def query_parameters(self):
224229
parameters = {
225230
**self.serialize_query_param(
226-
"api-version", "2024-09-01",
231+
"api-version", "2025-04-15",
227232
required=True,
228233
),
229234
}
@@ -326,7 +331,7 @@ def url_parameters(self):
326331
def query_parameters(self):
327332
parameters = {
328333
**self.serialize_query_param(
329-
"api-version", "2024-09-01",
334+
"api-version", "2025-04-15",
330335
required=True,
331336
),
332337
}
@@ -388,7 +393,7 @@ def _update_instance(self, instance):
388393

389394
properties = _builder.get(".properties")
390395
if properties is not None:
391-
properties.set_prop("healthProbeSettings", AAZObjectType)
396+
properties.set_prop("healthProbeSettings", AAZObjectType, ".health_probe_settings")
392397
properties.set_prop("loadBalancingSettings", AAZObjectType)
393398
properties.set_prop("sessionAffinityState", AAZStrType, ".session_affinity_state")
394399
properties.set_prop("trafficRestorationTimeToHealedOrNewEndpointsInMinutes", AAZIntType, ".traffic_restoration_time_to_healed_or_new_endpoints_in_minutes")

0 commit comments

Comments
 (0)