Skip to content

Commit 4b20d47

Browse files
committed
Support NvaInterfaceConfiguration in network virtual-appliance
1 parent 1d853bd commit 4b20d47

File tree

17 files changed

+8518
-120
lines changed

17 files changed

+8518
-120
lines changed

src/azure-cli/azure/cli/command_modules/network/_help.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6239,3 +6239,19 @@
62396239
--resource-type vpnConnection --storage-account MyStorageAccount \\
62406240
--storage-path https://{storageAccountName}.blob.core.windows.net/{containerName}
62416241
"""
6242+
6243+
helps['network virtual-appliance create'] = """
6244+
type: command
6245+
short-summary: Create a Network Virtual Appliance (NVA) in a Virtual Network.
6246+
long-summary: >
6247+
Supports providing either a Virtual Hub or an interface configuration file for VNet deployment.
6248+
parameters:
6249+
- name: --interface-config
6250+
short-summary: Path to a JSON file specifying NIC configurations for the NVA.
6251+
examples:
6252+
- name: Create an NVA in a VNet with two NICs using an interface configuration file.
6253+
text: |
6254+
az network virtual-appliance create -n MyNva -g MyRG --vendor barracudasdwanrelease \\
6255+
--scale-unit 2 --version latest --asn 10000 \\
6256+
--interface-config @nva-interface-config-example.json
6257+
"""

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

Lines changed: 85 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
@register_command(
15-
"network virtual-appliance create"
15+
"network virtual-appliance create",
1616
)
1717
class Create(AAZCommand):
1818
"""Create an Azure network virtual appliance.
@@ -22,9 +22,9 @@ class Create(AAZCommand):
2222
"""
2323

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

@@ -70,28 +70,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
7070
help="Space-separated tags: key[=value] [key[=value] ...]. Use \"\" to clear existing tags.",
7171
)
7272

73-
_args_schema.identity = AAZObjectArg(
74-
options=["--identity"],
75-
arg_group="Parameters",
76-
help="The identity of the Network Virtual Appliance, if configured.",
77-
)
78-
79-
identity = cls._args_schema.identity
80-
identity.type = AAZStrArg(
81-
options=["type"],
82-
help="The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the Network Virtual Appliance.",
83-
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned, UserAssigned": "SystemAssigned, UserAssigned", "UserAssigned": "UserAssigned"},
84-
)
85-
identity.user_assigned_identities = AAZDictArg(
86-
options=["user-assigned-identities"],
87-
help="The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
88-
)
89-
90-
user_assigned_identities = cls._args_schema.identity.user_assigned_identities
91-
user_assigned_identities.Element = AAZObjectArg(
92-
blank={},
93-
)
94-
9573
tags = cls._args_schema.tags
9674
tags.Element = AAZStrArg()
9775

@@ -123,11 +101,8 @@ def _build_arguments_schema(cls, *args, **kwargs):
123101
arg_group="Properties",
124102
help="The delegation for the Virtual Appliance",
125103
)
126-
127-
#Manually changed --internet-ingress-public-ips to --internet-ingress-ips to make it lint compliant.
128-
#Will fix in Swagger in next release.
129104
_args_schema.internet_ingress_public_ips = AAZListArg(
130-
options=["--internet-ingress-ips"],
105+
options=["--internet-ingress-public-ips"],
131106
arg_group="Properties",
132107
help="List of Resource Uri of Public IPs for Internet Ingress Scenario.",
133108
)
@@ -136,6 +111,14 @@ def _build_arguments_schema(cls, *args, **kwargs):
136111
arg_group="Properties",
137112
help="Network Profile containing configurations for Public and Private NIC.",
138113
)
114+
_args_schema.nva_interface_configurations = AAZListArg(
115+
options=["--interface-config", "--nva-interface-configurations"],
116+
arg_group="Properties",
117+
help="The NVA in VNet interface configurations",
118+
fmt=AAZListArgFormat(
119+
max_length=3,
120+
),
121+
)
139122
_args_schema.asn = AAZIntArg(
140123
options=["--asn"],
141124
arg_group="Properties",
@@ -211,6 +194,37 @@ def _build_arguments_schema(cls, *args, **kwargs):
211194
help="Whether or not this is primary IP configuration of the NIC.",
212195
)
213196

197+
nva_interface_configurations = cls._args_schema.nva_interface_configurations
198+
nva_interface_configurations.Element = AAZObjectArg()
199+
200+
_element = cls._args_schema.nva_interface_configurations.Element
201+
_element.name = AAZStrArg(
202+
options=["name"],
203+
help="Specifies the name of the interface. Maximum length is 70 characters.",
204+
fmt=AAZStrArgFormat(
205+
max_length=70,
206+
),
207+
)
208+
_element.subnet = AAZObjectArg(
209+
options=["subnet"],
210+
help="A subnet resource id where the NIC will be deployed. Each subnet resource uri should be unique.",
211+
)
212+
_element.type = AAZListArg(
213+
options=["type"],
214+
help="Specifies the NIC types for the NVA interface configuration. Allowed values: PrivateNic, PublicNic, AdditionalPrivateNic, AdditionalPublicNic. Only the combination of PrivateNic and PublicNic is currently supported.",
215+
)
216+
217+
subnet = cls._args_schema.nva_interface_configurations.Element.subnet
218+
subnet.id = AAZResourceIdArg(
219+
options=["id"],
220+
help="Resource Uri of Subnet",
221+
)
222+
223+
type = cls._args_schema.nva_interface_configurations.Element.type
224+
type.Element = AAZStrArg(
225+
enum={"AdditionalPrivateNic": "AdditionalPrivateNic", "AdditionalPublicNic": "AdditionalPublicNic", "PrivateNic": "PrivateNic", "PublicNic": "PublicNic"},
226+
)
227+
214228
# define Arg Group "Sku"
215229

216230
_args_schema = cls._args_schema
@@ -321,7 +335,7 @@ def url_parameters(self):
321335
def query_parameters(self):
322336
parameters = {
323337
**self.serialize_query_param(
324-
"api-version", "2023-11-01",
338+
"api-version", "2024-10-01",
325339
required=True,
326340
),
327341
}
@@ -347,19 +361,9 @@ def content(self):
347361
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
348362
)
349363
_builder.set_prop("location", AAZStrType, ".location")
350-
_builder.set_prop("identity", AAZObjectType, ".identity")
351364
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
352365
_builder.set_prop("tags", AAZDictType, ".tags")
353366

354-
identity = _builder.get(".identity")
355-
if identity is not None:
356-
identity.set_prop("type", AAZStrType, ".type")
357-
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
358-
359-
user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
360-
if user_assigned_identities is not None:
361-
user_assigned_identities.set_elements(AAZObjectType, ".")
362-
363367
properties = _builder.get(".properties")
364368
if properties is not None:
365369
properties.set_prop("additionalNics", AAZListType, ".additional_nics")
@@ -369,6 +373,7 @@ def content(self):
369373
properties.set_prop("delegation", AAZObjectType, ".delegation")
370374
properties.set_prop("internetIngressPublicIps", AAZListType, ".internet_ingress_public_ips")
371375
properties.set_prop("networkProfile", AAZObjectType, ".network_profile")
376+
properties.set_prop("nvaInterfaceConfigurations", AAZListType, ".nva_interface_configurations")
372377
properties.set_prop("nvaSku", AAZObjectType)
373378
properties.set_prop("virtualApplianceAsn", AAZIntType, ".asn")
374379
properties.set_prop("virtualHub", AAZObjectType)
@@ -432,6 +437,24 @@ def content(self):
432437
if properties is not None:
433438
properties.set_prop("primary", AAZBoolType, ".primary")
434439

440+
nva_interface_configurations = _builder.get(".properties.nvaInterfaceConfigurations")
441+
if nva_interface_configurations is not None:
442+
nva_interface_configurations.set_elements(AAZObjectType, ".")
443+
444+
_elements = _builder.get(".properties.nvaInterfaceConfigurations[]")
445+
if _elements is not None:
446+
_elements.set_prop("name", AAZStrType, ".name")
447+
_elements.set_prop("subnet", AAZObjectType, ".subnet")
448+
_elements.set_prop("type", AAZListType, ".type")
449+
450+
subnet = _builder.get(".properties.nvaInterfaceConfigurations[].subnet")
451+
if subnet is not None:
452+
subnet.set_prop("id", AAZStrType, ".id")
453+
454+
type = _builder.get(".properties.nvaInterfaceConfigurations[].type")
455+
if type is not None:
456+
type.set_elements(AAZStrType, ".")
457+
435458
nva_sku = _builder.get(".properties.nvaSku")
436459
if nva_sku is not None:
437460
nva_sku.set_prop("bundledScaleUnit", AAZStrType, ".scale_unit")
@@ -470,7 +493,7 @@ def _build_schema_on_200_201(cls):
470493
flags={"read_only": True},
471494
)
472495
_schema_on_200_201.id = AAZStrType()
473-
_schema_on_200_201.identity = AAZObjectType()
496+
_schema_on_200_201.identity = AAZIdentityObjectType()
474497
_schema_on_200_201.location = AAZStrType()
475498
_schema_on_200_201.name = AAZStrType(
476499
flags={"read_only": True},
@@ -542,12 +565,19 @@ def _build_schema_on_200_201(cls):
542565
properties.network_profile = AAZObjectType(
543566
serialized_name="networkProfile",
544567
)
568+
properties.nva_interface_configurations = AAZListType(
569+
serialized_name="nvaInterfaceConfigurations",
570+
)
545571
properties.nva_sku = AAZObjectType(
546572
serialized_name="nvaSku",
547573
)
548574
properties.partner_managed_resource = AAZObjectType(
549575
serialized_name="partnerManagedResource",
550576
)
577+
properties.private_ip_address = AAZStrType(
578+
serialized_name="privateIpAddress",
579+
flags={"read_only": True},
580+
)
551581
properties.provisioning_state = AAZStrType(
552582
serialized_name="provisioningState",
553583
flags={"read_only": True},
@@ -636,6 +666,20 @@ def _build_schema_on_200_201(cls):
636666
properties = cls._schema_on_200_201.properties.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties
637667
properties.primary = AAZBoolType()
638668

669+
nva_interface_configurations = cls._schema_on_200_201.properties.nva_interface_configurations
670+
nva_interface_configurations.Element = AAZObjectType()
671+
672+
_element = cls._schema_on_200_201.properties.nva_interface_configurations.Element
673+
_element.name = AAZStrType()
674+
_element.subnet = AAZObjectType()
675+
_element.type = AAZListType()
676+
677+
subnet = cls._schema_on_200_201.properties.nva_interface_configurations.Element.subnet
678+
subnet.id = AAZStrType()
679+
680+
type = cls._schema_on_200_201.properties.nva_interface_configurations.Element.type
681+
type.Element = AAZStrType()
682+
639683
nva_sku = cls._schema_on_200_201.properties.nva_sku
640684
nva_sku.bundled_scale_unit = AAZStrType(
641685
serialized_name="bundledScaleUnit",

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

Lines changed: 3 additions & 3 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": "2024-10-01",
2727
"resources": [
28-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkvirtualappliances/{}", "2023-11-01"],
28+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkvirtualappliances/{}", "2024-10-01"],
2929
]
3030
}
3131

@@ -143,7 +143,7 @@ def url_parameters(self):
143143
def query_parameters(self):
144144
parameters = {
145145
**self.serialize_query_param(
146-
"api-version", "2023-11-01",
146+
"api-version", "2024-10-01",
147147
required=True,
148148
),
149149
}

0 commit comments

Comments
 (0)