Skip to content

Commit e7ca949

Browse files
{Network} Add Virtual Network Appliance feature (#32645)
1 parent 6afa03a commit e7ca949

File tree

10 files changed

+16630
-0
lines changed

10 files changed

+16630
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"network virtual-network-appliance",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Virtual Network Appliance
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._create import *
13+
from ._delete import *
14+
from ._list import *
15+
from ._show import *
16+
from ._update import *
17+
from ._wait import *

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

Lines changed: 3284 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"network virtual-network-appliance delete",
16+
confirmation="Are you sure you want to perform this operation?",
17+
)
18+
class Delete(AAZCommand):
19+
"""Delete the specified virtual network appliance.
20+
21+
:example: Delete virtual network appliance
22+
az network virtual-network-appliance delete --resource-group rg1 --virtual-network-appliance-name test-vna
23+
"""
24+
25+
_aaz_info = {
26+
"version": "2025-05-01",
27+
"resources": [
28+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworkappliances/{}", "2025-05-01"],
29+
]
30+
}
31+
32+
AZ_SUPPORT_NO_WAIT = True
33+
34+
def _handler(self, command_args):
35+
super()._handler(command_args)
36+
return self.build_lro_poller(self._execute_operations, None)
37+
38+
_args_schema = None
39+
40+
@classmethod
41+
def _build_arguments_schema(cls, *args, **kwargs):
42+
if cls._args_schema is not None:
43+
return cls._args_schema
44+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
45+
46+
# define Arg Group ""
47+
48+
_args_schema = cls._args_schema
49+
_args_schema.resource_group = AAZResourceGroupNameArg(
50+
required=True,
51+
)
52+
_args_schema.virtual_network_appliance_name = AAZStrArg(
53+
options=["-n", "--name", "--virtual-network-appliance-name"],
54+
help="The name of the virtual network appliance.",
55+
required=True,
56+
id_part="name",
57+
fmt=AAZStrArgFormat(
58+
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
59+
),
60+
)
61+
return cls._args_schema
62+
63+
def _execute_operations(self):
64+
self.pre_operations()
65+
yield self.VirtualNetworkAppliancesDelete(ctx=self.ctx)()
66+
self.post_operations()
67+
68+
@register_callback
69+
def pre_operations(self):
70+
pass
71+
72+
@register_callback
73+
def post_operations(self):
74+
pass
75+
76+
class VirtualNetworkAppliancesDelete(AAZHttpOperation):
77+
CLIENT_TYPE = "MgmtClient"
78+
79+
def __call__(self, *args, **kwargs):
80+
request = self.make_request()
81+
session = self.client.send_request(request=request, stream=False, **kwargs)
82+
if session.http_response.status_code in [202]:
83+
return self.client.build_lro_polling(
84+
self.ctx.args.no_wait,
85+
session,
86+
self.on_200_201,
87+
self.on_error,
88+
lro_options={"final-state-via": "location"},
89+
path_format_arguments=self.url_parameters,
90+
)
91+
if session.http_response.status_code in [204]:
92+
return self.client.build_lro_polling(
93+
self.ctx.args.no_wait,
94+
session,
95+
self.on_204,
96+
self.on_error,
97+
lro_options={"final-state-via": "location"},
98+
path_format_arguments=self.url_parameters,
99+
)
100+
if session.http_response.status_code in [200, 201]:
101+
return self.client.build_lro_polling(
102+
self.ctx.args.no_wait,
103+
session,
104+
self.on_200_201,
105+
self.on_error,
106+
lro_options={"final-state-via": "location"},
107+
path_format_arguments=self.url_parameters,
108+
)
109+
110+
return self.on_error(session.http_response)
111+
112+
@property
113+
def url(self):
114+
return self.client.format_url(
115+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkAppliances/{virtualNetworkApplianceName}",
116+
**self.url_parameters
117+
)
118+
119+
@property
120+
def method(self):
121+
return "DELETE"
122+
123+
@property
124+
def error_format(self):
125+
return "ODataV4Format"
126+
127+
@property
128+
def url_parameters(self):
129+
parameters = {
130+
**self.serialize_url_param(
131+
"resourceGroupName", self.ctx.args.resource_group,
132+
required=True,
133+
),
134+
**self.serialize_url_param(
135+
"subscriptionId", self.ctx.subscription_id,
136+
required=True,
137+
),
138+
**self.serialize_url_param(
139+
"virtualNetworkApplianceName", self.ctx.args.virtual_network_appliance_name,
140+
required=True,
141+
),
142+
}
143+
return parameters
144+
145+
@property
146+
def query_parameters(self):
147+
parameters = {
148+
**self.serialize_query_param(
149+
"api-version", "2025-05-01",
150+
required=True,
151+
),
152+
}
153+
return parameters
154+
155+
def on_204(self, session):
156+
pass
157+
158+
def on_200_201(self, session):
159+
pass
160+
161+
162+
class _DeleteHelper:
163+
"""Helper class for Delete"""
164+
165+
166+
__all__ = ["Delete"]

0 commit comments

Comments
 (0)