Skip to content

Commit a46887d

Browse files
authored
AGC-v2025.01.01 WAF (#8451)
* waf cli * waf-cli * fix linter * udpate history
1 parent 3f2b5ad commit a46887d

33 files changed

+4736
-1404
lines changed

src/alb/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
2.0.0
7+
++++++
8+
* Upgrade API version to 2025-01-01, introducing Security Policy WAF.
9+
610
1.0.0
711
++++++
812
* Upgrade API version to 2023-11-01 for GA.

src/alb/azext_alb/aaz/latest/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
#
55
# Code generated by aaz-dev-tools
66
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+

src/alb/azext_alb/aaz/latest/network/alb/_create.py

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class Create(AAZCommand):
1818
"""Create an Application Gateway for Containers resource
1919
2020
:example: Create an Application Gateway for Containers resource
21-
az network alb create -g test-rg -n test-alb
21+
az network alb create -g test-rg -n test-alb --waf-policy-id /subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/securityPolicies/test-wp
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2023-11-01",
25+
"version": "2025-01-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.servicenetworking/trafficcontrollers/{}", "2023-11-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.servicenetworking/trafficcontrollers/{}", "2025-01-01"],
2828
]
2929
}
3030

@@ -76,6 +76,15 @@ def _build_arguments_schema(cls, *args, **kwargs):
7676

7777
tags = cls._args_schema.tags
7878
tags.Element = AAZStrArg()
79+
80+
# define Arg Group "SecurityPolicyConfigurations"
81+
82+
_args_schema = cls._args_schema
83+
_args_schema.waf_policy_id = AAZStrArg(
84+
options=["--waf-policy-id"],
85+
arg_group="SecurityPolicyConfigurations",
86+
help="Resource ID of the Waf Security Policy",
87+
)
7988
return cls._args_schema
8089

8190
def _execute_operations(self):
@@ -159,7 +168,7 @@ def url_parameters(self):
159168
def query_parameters(self):
160169
parameters = {
161170
**self.serialize_query_param(
162-
"api-version", "2023-11-01",
171+
"api-version", "2025-01-01",
163172
required=True,
164173
),
165174
}
@@ -185,8 +194,21 @@ def content(self):
185194
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
186195
)
187196
_builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}})
197+
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
188198
_builder.set_prop("tags", AAZDictType, ".tags")
189199

200+
properties = _builder.get(".properties")
201+
if properties is not None:
202+
properties.set_prop("securityPolicyConfigurations", AAZObjectType)
203+
204+
security_policy_configurations = _builder.get(".properties.securityPolicyConfigurations")
205+
if security_policy_configurations is not None:
206+
security_policy_configurations.set_prop("wafSecurityPolicy", AAZObjectType)
207+
208+
waf_security_policy = _builder.get(".properties.securityPolicyConfigurations.wafSecurityPolicy")
209+
if waf_security_policy is not None:
210+
waf_security_policy.set_prop("id", AAZStrType, ".waf_policy_id", typ_kwargs={"flags": {"required": True}})
211+
190212
tags = _builder.get(".tags")
191213
if tags is not None:
192214
tags.set_elements(AAZStrType, ".")
@@ -245,6 +267,14 @@ def _build_schema_on_200_201(cls):
245267
)
246268
properties.provisioning_state = AAZStrType(
247269
serialized_name="provisioningState",
270+
flags={"read_only": True},
271+
)
272+
properties.security_policies = AAZListType(
273+
serialized_name="securityPolicies",
274+
flags={"read_only": True},
275+
)
276+
properties.security_policy_configurations = AAZObjectType(
277+
serialized_name="securityPolicyConfigurations",
248278
)
249279

250280
associations = cls._schema_on_200_201.properties.associations
@@ -258,6 +288,20 @@ def _build_schema_on_200_201(cls):
258288
frontends.Element = AAZObjectType()
259289
_CreateHelper._build_schema_resource_id_read(frontends.Element)
260290

291+
security_policies = cls._schema_on_200_201.properties.security_policies
292+
security_policies.Element = AAZObjectType()
293+
_CreateHelper._build_schema_resource_id_read(security_policies.Element)
294+
295+
security_policy_configurations = cls._schema_on_200_201.properties.security_policy_configurations
296+
security_policy_configurations.waf_security_policy = AAZObjectType(
297+
serialized_name="wafSecurityPolicy",
298+
)
299+
300+
waf_security_policy = cls._schema_on_200_201.properties.security_policy_configurations.waf_security_policy
301+
waf_security_policy.id = AAZStrType(
302+
flags={"required": True},
303+
)
304+
261305
system_data = cls._schema_on_200_201.system_data
262306
system_data.created_at = AAZStrType(
263307
serialized_name="createdAt",

src/alb/azext_alb/aaz/latest/network/alb/_delete.py

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

2525
_aaz_info = {
26-
"version": "2023-11-01",
26+
"version": "2025-01-01",
2727
"resources": [
28-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.servicenetworking/trafficcontrollers/{}", "2023-11-01"],
28+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.servicenetworking/trafficcontrollers/{}", "2025-01-01"],
2929
]
3030
}
3131

@@ -83,25 +83,25 @@ def __call__(self, *args, **kwargs):
8383
return self.client.build_lro_polling(
8484
self.ctx.args.no_wait,
8585
session,
86-
self.on_200,
86+
self.on_200_201,
8787
self.on_error,
8888
lro_options={"final-state-via": "location"},
8989
path_format_arguments=self.url_parameters,
9090
)
91-
if session.http_response.status_code in [200]:
91+
if session.http_response.status_code in [204]:
9292
return self.client.build_lro_polling(
9393
self.ctx.args.no_wait,
9494
session,
95-
self.on_200,
95+
self.on_204,
9696
self.on_error,
9797
lro_options={"final-state-via": "location"},
9898
path_format_arguments=self.url_parameters,
9999
)
100-
if session.http_response.status_code in [204]:
100+
if session.http_response.status_code in [200, 201]:
101101
return self.client.build_lro_polling(
102102
self.ctx.args.no_wait,
103103
session,
104-
self.on_204,
104+
self.on_200_201,
105105
self.on_error,
106106
lro_options={"final-state-via": "location"},
107107
path_format_arguments=self.url_parameters,
@@ -146,16 +146,16 @@ def url_parameters(self):
146146
def query_parameters(self):
147147
parameters = {
148148
**self.serialize_query_param(
149-
"api-version", "2023-11-01",
149+
"api-version", "2025-01-01",
150150
required=True,
151151
),
152152
}
153153
return parameters
154154

155-
def on_200(self, session):
155+
def on_204(self, session):
156156
pass
157157

158-
def on_204(self, session):
158+
def on_200_201(self, session):
159159
pass
160160

161161

src/alb/azext_alb/aaz/latest/network/alb/_list.py

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class List(AAZCommand):
2525
"""
2626

2727
_aaz_info = {
28-
"version": "2023-11-01",
28+
"version": "2025-01-01",
2929
"resources": [
30-
["mgmt-plane", "/subscriptions/{}/providers/microsoft.servicenetworking/trafficcontrollers", "2023-11-01"],
31-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.servicenetworking/trafficcontrollers", "2023-11-01"],
30+
["mgmt-plane", "/subscriptions/{}/providers/microsoft.servicenetworking/trafficcontrollers", "2025-01-01"],
31+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.servicenetworking/trafficcontrollers", "2025-01-01"],
3232
]
3333
}
3434

@@ -54,12 +54,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
5454

5555
def _execute_operations(self):
5656
self.pre_operations()
57-
condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
58-
condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
57+
condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
58+
condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
5959
if condition_0:
60-
self.TrafficControllerInterfaceListByResourceGroup(ctx=self.ctx)()
61-
if condition_1:
6260
self.TrafficControllerInterfaceListBySubscription(ctx=self.ctx)()
61+
if condition_1:
62+
self.TrafficControllerInterfaceListByResourceGroup(ctx=self.ctx)()
6363
self.post_operations()
6464

6565
@register_callback
@@ -75,7 +75,7 @@ def _output(self, *args, **kwargs):
7575
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
7676
return result, next_link
7777

78-
class TrafficControllerInterfaceListByResourceGroup(AAZHttpOperation):
78+
class TrafficControllerInterfaceListBySubscription(AAZHttpOperation):
7979
CLIENT_TYPE = "MgmtClient"
8080

8181
def __call__(self, *args, **kwargs):
@@ -89,7 +89,7 @@ def __call__(self, *args, **kwargs):
8989
@property
9090
def url(self):
9191
return self.client.format_url(
92-
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers",
92+
"/subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers",
9393
**self.url_parameters
9494
)
9595

@@ -104,10 +104,6 @@ def error_format(self):
104104
@property
105105
def url_parameters(self):
106106
parameters = {
107-
**self.serialize_url_param(
108-
"resourceGroupName", self.ctx.args.resource_group,
109-
required=True,
110-
),
111107
**self.serialize_url_param(
112108
"subscriptionId", self.ctx.subscription_id,
113109
required=True,
@@ -119,7 +115,7 @@ def url_parameters(self):
119115
def query_parameters(self):
120116
parameters = {
121117
**self.serialize_query_param(
122-
"api-version", "2023-11-01",
118+
"api-version", "2025-01-01",
123119
required=True,
124120
),
125121
}
@@ -197,6 +193,14 @@ def _build_schema_on_200(cls):
197193
)
198194
properties.provisioning_state = AAZStrType(
199195
serialized_name="provisioningState",
196+
flags={"read_only": True},
197+
)
198+
properties.security_policies = AAZListType(
199+
serialized_name="securityPolicies",
200+
flags={"read_only": True},
201+
)
202+
properties.security_policy_configurations = AAZObjectType(
203+
serialized_name="securityPolicyConfigurations",
200204
)
201205

202206
associations = cls._schema_on_200.value.Element.properties.associations
@@ -210,6 +214,20 @@ def _build_schema_on_200(cls):
210214
frontends.Element = AAZObjectType()
211215
_ListHelper._build_schema_resource_id_read(frontends.Element)
212216

217+
security_policies = cls._schema_on_200.value.Element.properties.security_policies
218+
security_policies.Element = AAZObjectType()
219+
_ListHelper._build_schema_resource_id_read(security_policies.Element)
220+
221+
security_policy_configurations = cls._schema_on_200.value.Element.properties.security_policy_configurations
222+
security_policy_configurations.waf_security_policy = AAZObjectType(
223+
serialized_name="wafSecurityPolicy",
224+
)
225+
226+
waf_security_policy = cls._schema_on_200.value.Element.properties.security_policy_configurations.waf_security_policy
227+
waf_security_policy.id = AAZStrType(
228+
flags={"required": True},
229+
)
230+
213231
system_data = cls._schema_on_200.value.Element.system_data
214232
system_data.created_at = AAZStrType(
215233
serialized_name="createdAt",
@@ -235,7 +253,7 @@ def _build_schema_on_200(cls):
235253

236254
return cls._schema_on_200
237255

238-
class TrafficControllerInterfaceListBySubscription(AAZHttpOperation):
256+
class TrafficControllerInterfaceListByResourceGroup(AAZHttpOperation):
239257
CLIENT_TYPE = "MgmtClient"
240258

241259
def __call__(self, *args, **kwargs):
@@ -249,7 +267,7 @@ def __call__(self, *args, **kwargs):
249267
@property
250268
def url(self):
251269
return self.client.format_url(
252-
"/subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers",
270+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers",
253271
**self.url_parameters
254272
)
255273

@@ -264,6 +282,10 @@ def error_format(self):
264282
@property
265283
def url_parameters(self):
266284
parameters = {
285+
**self.serialize_url_param(
286+
"resourceGroupName", self.ctx.args.resource_group,
287+
required=True,
288+
),
267289
**self.serialize_url_param(
268290
"subscriptionId", self.ctx.subscription_id,
269291
required=True,
@@ -275,7 +297,7 @@ def url_parameters(self):
275297
def query_parameters(self):
276298
parameters = {
277299
**self.serialize_query_param(
278-
"api-version", "2023-11-01",
300+
"api-version", "2025-01-01",
279301
required=True,
280302
),
281303
}
@@ -353,6 +375,14 @@ def _build_schema_on_200(cls):
353375
)
354376
properties.provisioning_state = AAZStrType(
355377
serialized_name="provisioningState",
378+
flags={"read_only": True},
379+
)
380+
properties.security_policies = AAZListType(
381+
serialized_name="securityPolicies",
382+
flags={"read_only": True},
383+
)
384+
properties.security_policy_configurations = AAZObjectType(
385+
serialized_name="securityPolicyConfigurations",
356386
)
357387

358388
associations = cls._schema_on_200.value.Element.properties.associations
@@ -366,6 +396,20 @@ def _build_schema_on_200(cls):
366396
frontends.Element = AAZObjectType()
367397
_ListHelper._build_schema_resource_id_read(frontends.Element)
368398

399+
security_policies = cls._schema_on_200.value.Element.properties.security_policies
400+
security_policies.Element = AAZObjectType()
401+
_ListHelper._build_schema_resource_id_read(security_policies.Element)
402+
403+
security_policy_configurations = cls._schema_on_200.value.Element.properties.security_policy_configurations
404+
security_policy_configurations.waf_security_policy = AAZObjectType(
405+
serialized_name="wafSecurityPolicy",
406+
)
407+
408+
waf_security_policy = cls._schema_on_200.value.Element.properties.security_policy_configurations.waf_security_policy
409+
waf_security_policy.id = AAZStrType(
410+
flags={"required": True},
411+
)
412+
369413
system_data = cls._schema_on_200.value.Element.system_data
370414
system_data.created_at = AAZStrType(
371415
serialized_name="createdAt",

0 commit comments

Comments
 (0)