Skip to content

Commit 17a4bbb

Browse files
authored
[Network] az network vnet-gateway create/update: Add parameter --resiliency-model (#30410)
* codegen, unregister Identity params * update test * update recording
1 parent d73676d commit 17a4bbb

30 files changed

+2058
-1547
lines changed

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/_create.py

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class Create(AAZCommand):
3131
"""
3232

3333
_aaz_info = {
34-
"version": "2023-09-01",
34+
"version": "2024-03-01",
3535
"resources": [
36-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways/{}", "2023-09-01"],
36+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways/{}", "2024-03-01"],
3737
]
3838
}
3939

@@ -106,6 +106,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
106106
options=["--ip-configurations"],
107107
help="IP configurations for virtual network gateway.",
108108
)
109+
_args_schema.resiliency_model = AAZStrArg(
110+
options=["--resiliency-model"],
111+
help="Indicates if the Express Route Gateway has resiliency model of MultiHomed or SingleHomed",
112+
enum={"MultiHomed": "MultiHomed", "SingleHomed": "SingleHomed"},
113+
)
109114
_args_schema.sku = AAZStrArg(
110115
options=["--sku"],
111116
help="VNet gateway SKU.",
@@ -219,6 +224,25 @@ def _build_arguments_schema(cls, *args, **kwargs):
219224

220225
# define Arg Group "BgpSettings"
221226

227+
# define Arg Group "Identity"
228+
229+
_args_schema = cls._args_schema
230+
_args_schema.mi_system_assigned = AAZStrArg(
231+
options=["--system-assigned", "--mi-system-assigned"],
232+
arg_group="Identity",
233+
help="Set the system managed identity.",
234+
blank="True",
235+
)
236+
_args_schema.mi_user_assigned = AAZListArg(
237+
options=["--user-assigned", "--mi-user-assigned"],
238+
arg_group="Identity",
239+
help="Set the user managed identities.",
240+
blank=[],
241+
)
242+
243+
mi_user_assigned = cls._args_schema.mi_user_assigned
244+
mi_user_assigned.Element = AAZStrArg()
245+
222246
# define Arg Group "Nat Rule"
223247

224248
_args_schema = cls._args_schema
@@ -488,7 +512,7 @@ def url_parameters(self):
488512
def query_parameters(self):
489513
parameters = {
490514
**self.serialize_query_param(
491-
"api-version", "2023-09-01",
515+
"api-version", "2024-03-01",
492516
required=True,
493517
),
494518
}
@@ -514,6 +538,7 @@ def content(self):
514538
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
515539
)
516540
_builder.set_prop("extendedLocation", AAZObjectType)
541+
_builder.set_prop("identity", AAZIdentityObjectType)
517542
_builder.set_prop("location", AAZStrType, ".location")
518543
_builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}})
519544
_builder.set_prop("tags", AAZDictType, ".tags")
@@ -523,6 +548,15 @@ def content(self):
523548
extended_location.set_prop("name", AAZStrType, ".edge_zone")
524549
extended_location.set_prop("type", AAZStrType, ".edge_zone_type")
525550

551+
identity = _builder.get(".identity")
552+
if identity is not None:
553+
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
554+
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})
555+
556+
user_assigned = _builder.get(".identity.userAssigned")
557+
if user_assigned is not None:
558+
user_assigned.set_elements(AAZStrType, ".")
559+
526560
properties = _builder.get(".properties")
527561
if properties is not None:
528562
properties.set_prop("activeActive", AAZBoolType, ".active")
@@ -537,6 +571,7 @@ def content(self):
537571
properties.set_prop("gatewayType", AAZStrType, ".gateway_type")
538572
properties.set_prop("ipConfigurations", AAZListType, ".ip_configurations")
539573
properties.set_prop("natRules", AAZListType, ".nat_rules")
574+
properties.set_prop("resiliencyModel", AAZStrType, ".resiliency_model")
540575
properties.set_prop("sku", AAZObjectType)
541576
properties.set_prop("vNetExtendedLocationResourceId", AAZStrType, ".edge_zone_vnet_id")
542577
properties.set_prop("vpnClientConfiguration", AAZObjectType)
@@ -704,6 +739,7 @@ def _build_schema_on_200_201(cls):
704739
serialized_name="extendedLocation",
705740
)
706741
_schema_on_200_201.id = AAZStrType()
742+
_schema_on_200_201.identity = AAZIdentityObjectType()
707743
_schema_on_200_201.location = AAZStrType()
708744
_schema_on_200_201.name = AAZStrType(
709745
flags={"read_only": True},
@@ -720,6 +756,33 @@ def _build_schema_on_200_201(cls):
720756
extended_location.name = AAZStrType()
721757
extended_location.type = AAZStrType()
722758

759+
identity = cls._schema_on_200_201.identity
760+
identity.principal_id = AAZStrType(
761+
serialized_name="principalId",
762+
flags={"read_only": True},
763+
)
764+
identity.tenant_id = AAZStrType(
765+
serialized_name="tenantId",
766+
flags={"read_only": True},
767+
)
768+
identity.type = AAZStrType()
769+
identity.user_assigned_identities = AAZDictType(
770+
serialized_name="userAssignedIdentities",
771+
)
772+
773+
user_assigned_identities = cls._schema_on_200_201.identity.user_assigned_identities
774+
user_assigned_identities.Element = AAZObjectType()
775+
776+
_element = cls._schema_on_200_201.identity.user_assigned_identities.Element
777+
_element.client_id = AAZStrType(
778+
serialized_name="clientId",
779+
flags={"read_only": True},
780+
)
781+
_element.principal_id = AAZStrType(
782+
serialized_name="principalId",
783+
flags={"read_only": True},
784+
)
785+
723786
properties = cls._schema_on_200_201.properties
724787
properties.active_active = AAZBoolType(
725788
serialized_name="activeActive",
@@ -779,6 +842,9 @@ def _build_schema_on_200_201(cls):
779842
serialized_name="provisioningState",
780843
flags={"read_only": True},
781844
)
845+
properties.resiliency_model = AAZStrType(
846+
serialized_name="resiliencyModel",
847+
)
782848
properties.resource_guid = AAZStrType(
783849
serialized_name="resourceGuid",
784850
flags={"read_only": True},

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/_delete.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class Delete(AAZCommand):
2424
"""
2525

2626
_aaz_info = {
27-
"version": "2023-09-01",
27+
"version": "2024-03-01",
2828
"resources": [
29-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways/{}", "2023-09-01"],
29+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways/{}", "2024-03-01"],
3030
]
3131
}
3232

@@ -144,7 +144,7 @@ def url_parameters(self):
144144
def query_parameters(self):
145145
parameters = {
146146
**self.serialize_query_param(
147-
"api-version", "2023-09-01",
147+
"api-version", "2024-03-01",
148148
required=True,
149149
),
150150
}

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/_list.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class List(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2023-09-01",
25+
"version": "2024-03-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways", "2023-09-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways", "2024-03-01"],
2828
]
2929
}
3030

@@ -112,7 +112,7 @@ def url_parameters(self):
112112
def query_parameters(self):
113113
parameters = {
114114
**self.serialize_query_param(
115-
"api-version", "2023-09-01",
115+
"api-version", "2024-03-01",
116116
required=True,
117117
),
118118
}
@@ -162,6 +162,7 @@ def _build_schema_on_200(cls):
162162
serialized_name="extendedLocation",
163163
)
164164
_element.id = AAZStrType()
165+
_element.identity = AAZIdentityObjectType()
165166
_element.location = AAZStrType()
166167
_element.name = AAZStrType(
167168
flags={"read_only": True},
@@ -178,6 +179,33 @@ def _build_schema_on_200(cls):
178179
extended_location.name = AAZStrType()
179180
extended_location.type = AAZStrType()
180181

182+
identity = cls._schema_on_200.value.Element.identity
183+
identity.principal_id = AAZStrType(
184+
serialized_name="principalId",
185+
flags={"read_only": True},
186+
)
187+
identity.tenant_id = AAZStrType(
188+
serialized_name="tenantId",
189+
flags={"read_only": True},
190+
)
191+
identity.type = AAZStrType()
192+
identity.user_assigned_identities = AAZDictType(
193+
serialized_name="userAssignedIdentities",
194+
)
195+
196+
user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities
197+
user_assigned_identities.Element = AAZObjectType()
198+
199+
_element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element
200+
_element.client_id = AAZStrType(
201+
serialized_name="clientId",
202+
flags={"read_only": True},
203+
)
204+
_element.principal_id = AAZStrType(
205+
serialized_name="principalId",
206+
flags={"read_only": True},
207+
)
208+
181209
properties = cls._schema_on_200.value.Element.properties
182210
properties.active_active = AAZBoolType(
183211
serialized_name="activeActive",
@@ -237,6 +265,9 @@ def _build_schema_on_200(cls):
237265
serialized_name="provisioningState",
238266
flags={"read_only": True},
239267
)
268+
properties.resiliency_model = AAZStrType(
269+
serialized_name="resiliencyModel",
270+
)
240271
properties.resource_guid = AAZStrType(
241272
serialized_name="resourceGuid",
242273
flags={"read_only": True},

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/vnet_gateway/_show.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Show(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2023-09-01",
25+
"version": "2024-03-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways/{}", "2023-09-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkgateways/{}", "2024-03-01"],
2828
]
2929
}
3030

@@ -120,7 +120,7 @@ def url_parameters(self):
120120
def query_parameters(self):
121121
parameters = {
122122
**self.serialize_query_param(
123-
"api-version", "2023-09-01",
123+
"api-version", "2024-03-01",
124124
required=True,
125125
),
126126
}
@@ -160,6 +160,7 @@ def _build_schema_on_200(cls):
160160
serialized_name="extendedLocation",
161161
)
162162
_schema_on_200.id = AAZStrType()
163+
_schema_on_200.identity = AAZIdentityObjectType()
163164
_schema_on_200.location = AAZStrType()
164165
_schema_on_200.name = AAZStrType(
165166
flags={"read_only": True},
@@ -176,6 +177,33 @@ def _build_schema_on_200(cls):
176177
extended_location.name = AAZStrType()
177178
extended_location.type = AAZStrType()
178179

180+
identity = cls._schema_on_200.identity
181+
identity.principal_id = AAZStrType(
182+
serialized_name="principalId",
183+
flags={"read_only": True},
184+
)
185+
identity.tenant_id = AAZStrType(
186+
serialized_name="tenantId",
187+
flags={"read_only": True},
188+
)
189+
identity.type = AAZStrType()
190+
identity.user_assigned_identities = AAZDictType(
191+
serialized_name="userAssignedIdentities",
192+
)
193+
194+
user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities
195+
user_assigned_identities.Element = AAZObjectType()
196+
197+
_element = cls._schema_on_200.identity.user_assigned_identities.Element
198+
_element.client_id = AAZStrType(
199+
serialized_name="clientId",
200+
flags={"read_only": True},
201+
)
202+
_element.principal_id = AAZStrType(
203+
serialized_name="principalId",
204+
flags={"read_only": True},
205+
)
206+
179207
properties = cls._schema_on_200.properties
180208
properties.active_active = AAZBoolType(
181209
serialized_name="activeActive",
@@ -235,6 +263,9 @@ def _build_schema_on_200(cls):
235263
serialized_name="provisioningState",
236264
flags={"read_only": True},
237265
)
266+
properties.resiliency_model = AAZStrType(
267+
serialized_name="resiliencyModel",
268+
)
238269
properties.resource_guid = AAZStrType(
239270
serialized_name="resourceGuid",
240271
flags={"read_only": True},

0 commit comments

Comments
 (0)