Skip to content

Commit b2d3de3

Browse files
committed
codegen + test
1 parent bb2b31a commit b2d3de3

File tree

7 files changed

+744
-264
lines changed

7 files changed

+744
-264
lines changed

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/_create.py

Lines changed: 74 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class Create(AAZCommand):
2525
"""
2626

2727
_aaz_info = {
28-
"version": "2024-03-01",
28+
"version": "2024-10-01",
2929
"resources": [
30-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgatewaywebapplicationfirewallpolicies/{}", "2024-03-01", "properties.customRules[]"],
30+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgatewaywebapplicationfirewallpolicies/{}", "2024-10-01", "properties.customRules[]"],
3131
]
3232
}
3333

@@ -136,7 +136,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
136136
options=["variable-name"],
137137
help="User Session clause variable.",
138138
required=True,
139-
enum={"ClientAddr": "ClientAddr", "GeoLocation": "GeoLocation", "None": "None"},
139+
enum={"ClientAddr": "ClientAddr", "ClientAddrXFFHeader": "ClientAddrXFFHeader", "GeoLocation": "GeoLocation", "GeoLocationXFFHeader": "GeoLocationXFFHeader", "None": "None"},
140140
)
141141

142142
match_conditions = cls._args_schema.match_conditions
@@ -146,6 +146,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
146146
_element.values = AAZListArg(
147147
options=["values"],
148148
help="Space-separated list of values to match.",
149+
required=True,
149150
)
150151
_element.variables = AAZListArg(
151152
options=["variables"],
@@ -293,7 +294,7 @@ def url_parameters(self):
293294
def query_parameters(self):
294295
parameters = {
295296
**self.serialize_query_param(
296-
"api-version", "2024-03-01",
297+
"api-version", "2024-10-01",
297298
required=True,
298299
),
299300
}
@@ -376,7 +377,7 @@ def url_parameters(self):
376377
def query_parameters(self):
377378
parameters = {
378379
**self.serialize_query_param(
379-
"api-version", "2024-03-01",
380+
"api-version", "2024-10-01",
380381
required=True,
381382
),
382383
}
@@ -465,7 +466,7 @@ def _create_instance(self):
465466

466467
_elements = _builder.get(".matchConditions[]")
467468
if _elements is not None:
468-
_elements.set_prop("matchValues", AAZListType, ".values")
469+
_elements.set_prop("matchValues", AAZListType, ".values", typ_kwargs={"flags": {"required": True}})
469470
_elements.set_prop("matchVariables", AAZListType, ".variables", typ_kwargs={"flags": {"required": True}})
470471
_elements.set_prop("negationConditon", AAZBoolType, ".negate")
471472
_elements.set_prop("operator", AAZStrType, ".operator", typ_kwargs={"flags": {"required": True}})
@@ -970,7 +971,7 @@ def _build_schema_managed_service_identity_read(cls, _schema):
970971
_schema.user_assigned_identities = cls._schema_managed_service_identity_read.user_assigned_identities
971972
return
972973

973-
cls._schema_managed_service_identity_read = _schema_managed_service_identity_read = AAZObjectType()
974+
cls._schema_managed_service_identity_read = _schema_managed_service_identity_read = AAZIdentityObjectType()
974975

975976
managed_service_identity_read = _schema_managed_service_identity_read
976977
managed_service_identity_read.principal_id = AAZStrType(
@@ -1392,6 +1393,10 @@ def _build_schema_network_interface_read(cls, _schema):
13921393
properties.auxiliary_sku = AAZStrType(
13931394
serialized_name="auxiliarySku",
13941395
)
1396+
properties.default_outbound_connectivity_enabled = AAZBoolType(
1397+
serialized_name="defaultOutboundConnectivityEnabled",
1398+
flags={"read_only": True},
1399+
)
13951400
properties.disable_tcp_state_tracking = AAZBoolType(
13961401
serialized_name="disableTcpStateTracking",
13971402
)
@@ -1745,7 +1750,7 @@ def _build_schema_network_security_group_read(cls, _schema):
17451750
flags={"read_only": True},
17461751
)
17471752
_element.id = AAZStrType()
1748-
_element.identity = AAZObjectType()
1753+
_element.identity = AAZIdentityObjectType()
17491754
cls._build_schema_managed_service_identity_read(_element.identity)
17501755
_element.location = AAZStrType()
17511756
_element.name = AAZStrType(
@@ -2215,13 +2220,23 @@ def _build_schema_public_ip_address_read(cls, _schema):
22152220
properties.public_ip_addresses = AAZListType(
22162221
serialized_name="publicIpAddresses",
22172222
)
2223+
properties.public_ip_addresses_v6 = AAZListType(
2224+
serialized_name="publicIpAddressesV6",
2225+
)
22182226
properties.public_ip_prefixes = AAZListType(
22192227
serialized_name="publicIpPrefixes",
22202228
)
2229+
properties.public_ip_prefixes_v6 = AAZListType(
2230+
serialized_name="publicIpPrefixesV6",
2231+
)
22212232
properties.resource_guid = AAZStrType(
22222233
serialized_name="resourceGuid",
22232234
flags={"read_only": True},
22242235
)
2236+
properties.source_virtual_network = AAZObjectType(
2237+
serialized_name="sourceVirtualNetwork",
2238+
)
2239+
cls._build_schema_sub_resource_read(properties.source_virtual_network)
22252240
properties.subnets = AAZListType(
22262241
flags={"read_only": True},
22272242
)
@@ -2230,10 +2245,18 @@ def _build_schema_public_ip_address_read(cls, _schema):
22302245
public_ip_addresses.Element = AAZObjectType()
22312246
cls._build_schema_sub_resource_read(public_ip_addresses.Element)
22322247

2248+
public_ip_addresses_v6 = _schema_public_ip_address_read.properties.nat_gateway.properties.public_ip_addresses_v6
2249+
public_ip_addresses_v6.Element = AAZObjectType()
2250+
cls._build_schema_sub_resource_read(public_ip_addresses_v6.Element)
2251+
22332252
public_ip_prefixes = _schema_public_ip_address_read.properties.nat_gateway.properties.public_ip_prefixes
22342253
public_ip_prefixes.Element = AAZObjectType()
22352254
cls._build_schema_sub_resource_read(public_ip_prefixes.Element)
22362255

2256+
public_ip_prefixes_v6 = _schema_public_ip_address_read.properties.nat_gateway.properties.public_ip_prefixes_v6
2257+
public_ip_prefixes_v6.Element = AAZObjectType()
2258+
cls._build_schema_sub_resource_read(public_ip_prefixes_v6.Element)
2259+
22372260
subnets = _schema_public_ip_address_read.properties.nat_gateway.properties.subnets
22382261
subnets.Element = AAZObjectType()
22392262
cls._build_schema_sub_resource_read(subnets.Element)
@@ -2433,6 +2456,9 @@ def _build_schema_subnet_read(cls, _schema):
24332456
serialized_name="ipConfigurations",
24342457
flags={"read_only": True},
24352458
)
2459+
properties.ipam_pool_prefix_allocations = AAZListType(
2460+
serialized_name="ipamPoolPrefixAllocations",
2461+
)
24362462
properties.nat_gateway = AAZObjectType(
24372463
serialized_name="natGateway",
24382464
)
@@ -2547,6 +2573,27 @@ def _build_schema_subnet_read(cls, _schema):
25472573
ip_configurations.Element = AAZObjectType()
25482574
cls._build_schema_ip_configuration_read(ip_configurations.Element)
25492575

2576+
ipam_pool_prefix_allocations = _schema_subnet_read.properties.ipam_pool_prefix_allocations
2577+
ipam_pool_prefix_allocations.Element = AAZObjectType()
2578+
2579+
_element = _schema_subnet_read.properties.ipam_pool_prefix_allocations.Element
2580+
_element.allocated_address_prefixes = AAZListType(
2581+
serialized_name="allocatedAddressPrefixes",
2582+
flags={"read_only": True},
2583+
)
2584+
_element.number_of_ip_addresses = AAZStrType(
2585+
serialized_name="numberOfIpAddresses",
2586+
)
2587+
_element.pool = AAZObjectType(
2588+
flags={"client_flatten": True},
2589+
)
2590+
2591+
allocated_address_prefixes = _schema_subnet_read.properties.ipam_pool_prefix_allocations.Element.allocated_address_prefixes
2592+
allocated_address_prefixes.Element = AAZStrType()
2593+
2594+
pool = _schema_subnet_read.properties.ipam_pool_prefix_allocations.Element.pool
2595+
pool.id = AAZStrType()
2596+
25502597
private_endpoints = _schema_subnet_read.properties.private_endpoints
25512598
private_endpoints.Element = AAZObjectType()
25522599
cls._build_schema_private_endpoint_read(private_endpoints.Element)
@@ -2952,7 +2999,7 @@ def _build_schema_web_application_firewall_policy_read(cls, _schema):
29522999
flags={"read_only": True},
29533000
)
29543001
_element.id = AAZStrType()
2955-
_element.identity = AAZObjectType()
3002+
_element.identity = AAZIdentityObjectType()
29563003
cls._build_schema_managed_service_identity_read(_element.identity)
29573004
_element.location = AAZStrType()
29583005
_element.name = AAZStrType(
@@ -4182,6 +4229,7 @@ def _build_schema_web_application_firewall_policy_read(cls, _schema):
41824229
_element = _schema_web_application_firewall_policy_read.properties.custom_rules.Element.match_conditions.Element
41834230
_element.match_values = AAZListType(
41844231
serialized_name="matchValues",
4232+
flags={"required": True},
41854233
)
41864234
_element.match_variables = AAZListType(
41874235
serialized_name="matchVariables",
@@ -4278,6 +4326,10 @@ def _build_schema_web_application_firewall_policy_read(cls, _schema):
42784326
managed_rule_sets.Element = AAZObjectType()
42794327

42804328
_element = _schema_web_application_firewall_policy_read.properties.managed_rules.managed_rule_sets.Element
4329+
_element.computed_disabled_rules = AAZListType(
4330+
serialized_name="computedDisabledRules",
4331+
flags={"read_only": True},
4332+
)
42814333
_element.rule_group_overrides = AAZListType(
42824334
serialized_name="ruleGroupOverrides",
42834335
)
@@ -4290,6 +4342,19 @@ def _build_schema_web_application_firewall_policy_read(cls, _schema):
42904342
flags={"required": True},
42914343
)
42924344

4345+
computed_disabled_rules = _schema_web_application_firewall_policy_read.properties.managed_rules.managed_rule_sets.Element.computed_disabled_rules
4346+
computed_disabled_rules.Element = AAZObjectType()
4347+
4348+
_element = _schema_web_application_firewall_policy_read.properties.managed_rules.managed_rule_sets.Element.computed_disabled_rules.Element
4349+
_element.rule_group_name = AAZStrType(
4350+
serialized_name="ruleGroupName",
4351+
flags={"required": True},
4352+
)
4353+
_element.rules = AAZListType()
4354+
4355+
rules = _schema_web_application_firewall_policy_read.properties.managed_rules.managed_rule_sets.Element.computed_disabled_rules.Element.rules
4356+
rules.Element = AAZStrType()
4357+
42934358
rule_group_overrides = _schema_web_application_firewall_policy_read.properties.managed_rules.managed_rule_sets.Element.rule_group_overrides
42944359
rule_group_overrides.Element = AAZObjectType()
42954360

0 commit comments

Comments
 (0)