Skip to content

Commit fed4be4

Browse files
Bhavana-KalivemulaBhavana Kalivemula
andauthored
[Network] Add Az Cli commands for Vwan gateways Resiliency APIs (#32941)
Co-authored-by: Bhavana Kalivemula <bhkalivemula@microsoft.com>
1 parent 6d88aa1 commit fed4be4

11 files changed

+5104
-0
lines changed

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/express_route/gateway/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@
1515
from ._show import *
1616
from ._update import *
1717
from ._wait import *
18+
from ._get_failover_all_tests_detail import *
19+
from ._get_failover_single_test_detail import *
20+
from ._get_resiliency_information import *
21+
from ._get_routes_information import *
22+
from ._start_site_failover_test import *
23+
from ._stop_site_failover_test import *
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
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 express-route gateway get-failover-all-tests-detail",
16+
)
17+
class GetFailoverAllTestsDetail(AAZCommand):
18+
"""This operation retrieves the details of all the failover tests performed on the Virtual Wan ExpressRoute gateways for different peering locations
19+
20+
:example: VwanExpressRouteGatewayFailoverAllTestsDetails
21+
az network express-route gateway get-failover-all-tests-detail --resource-group "rg1" --name "ergw1" --type "SingleSiteFailover" --fetch-latest True
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2025-07-01",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/expressroutegateways/{}/getfailoveralltestsdetails", "2025-07-01"],
28+
]
29+
}
30+
31+
AZ_SUPPORT_NO_WAIT = True
32+
33+
def _handler(self, command_args):
34+
super()._handler(command_args)
35+
return self.build_lro_poller(self._execute_operations, self._output)
36+
37+
_args_schema = None
38+
39+
@classmethod
40+
def _build_arguments_schema(cls, *args, **kwargs):
41+
if cls._args_schema is not None:
42+
return cls._args_schema
43+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
44+
45+
# define Arg Group ""
46+
47+
_args_schema = cls._args_schema
48+
_args_schema.name = AAZStrArg(
49+
options=["--name"],
50+
help="The name of the vwan express route gateway.",
51+
required=True,
52+
id_part="name",
53+
fmt=AAZStrArgFormat(
54+
pattern="^[A-Za-z0-9_-]+",
55+
),
56+
)
57+
_args_schema.resource_group = AAZResourceGroupNameArg(
58+
required=True,
59+
)
60+
_args_schema.fetch_latest = AAZBoolArg(
61+
options=["--fetch-latest"],
62+
help="Fetch only the latest tests for each peering location",
63+
required=True,
64+
)
65+
_args_schema.type = AAZStrArg(
66+
options=["--type"],
67+
help="The type of failover test",
68+
required=True,
69+
enum={"All": "All", "LinkFailover": "LinkFailover", "MultiSiteFailover": "MultiSiteFailover", "SingleSiteFailover": "SingleSiteFailover"},
70+
)
71+
return cls._args_schema
72+
73+
def _execute_operations(self):
74+
self.pre_operations()
75+
yield self.ExpressRouteGatewaysGetFailoverAllTestsDetails(ctx=self.ctx)()
76+
self.post_operations()
77+
78+
@register_callback
79+
def pre_operations(self):
80+
pass
81+
82+
@register_callback
83+
def post_operations(self):
84+
pass
85+
86+
def _output(self, *args, **kwargs):
87+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
88+
return result
89+
90+
class ExpressRouteGatewaysGetFailoverAllTestsDetails(AAZHttpOperation):
91+
CLIENT_TYPE = "MgmtClient"
92+
93+
def __call__(self, *args, **kwargs):
94+
request = self.make_request()
95+
session = self.client.send_request(request=request, stream=False, **kwargs)
96+
if session.http_response.status_code in [202]:
97+
return self.client.build_lro_polling(
98+
self.ctx.args.no_wait,
99+
session,
100+
self.on_200,
101+
self.on_error,
102+
lro_options={"final-state-via": "location"},
103+
path_format_arguments=self.url_parameters,
104+
)
105+
if session.http_response.status_code in [200]:
106+
return self.client.build_lro_polling(
107+
self.ctx.args.no_wait,
108+
session,
109+
self.on_200,
110+
self.on_error,
111+
lro_options={"final-state-via": "location"},
112+
path_format_arguments=self.url_parameters,
113+
)
114+
115+
return self.on_error(session.http_response)
116+
117+
@property
118+
def url(self):
119+
return self.client.format_url(
120+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/getFailoverAllTestsDetails",
121+
**self.url_parameters
122+
)
123+
124+
@property
125+
def method(self):
126+
return "POST"
127+
128+
@property
129+
def error_format(self):
130+
return "ODataV4Format"
131+
132+
@property
133+
def url_parameters(self):
134+
parameters = {
135+
**self.serialize_url_param(
136+
"expressRouteGatewayName", self.ctx.args.name,
137+
required=True,
138+
),
139+
**self.serialize_url_param(
140+
"resourceGroupName", self.ctx.args.resource_group,
141+
required=True,
142+
),
143+
**self.serialize_url_param(
144+
"subscriptionId", self.ctx.subscription_id,
145+
required=True,
146+
),
147+
}
148+
return parameters
149+
150+
@property
151+
def query_parameters(self):
152+
parameters = {
153+
**self.serialize_query_param(
154+
"fetchLatest", self.ctx.args.fetch_latest,
155+
required=True,
156+
),
157+
**self.serialize_query_param(
158+
"type", self.ctx.args.type,
159+
required=True,
160+
),
161+
**self.serialize_query_param(
162+
"api-version", "2025-07-01",
163+
required=True,
164+
),
165+
}
166+
return parameters
167+
168+
@property
169+
def header_parameters(self):
170+
parameters = {
171+
**self.serialize_header_param(
172+
"Accept", "application/json",
173+
),
174+
}
175+
return parameters
176+
177+
def on_200(self, session):
178+
data = self.deserialize_http_content(session)
179+
self.ctx.set_var(
180+
"instance",
181+
data,
182+
schema_builder=self._build_schema_on_200
183+
)
184+
185+
_schema_on_200 = None
186+
187+
@classmethod
188+
def _build_schema_on_200(cls):
189+
if cls._schema_on_200 is not None:
190+
return cls._schema_on_200
191+
192+
cls._schema_on_200 = AAZObjectType()
193+
194+
_schema_on_200 = cls._schema_on_200
195+
_schema_on_200.value = AAZListType()
196+
197+
value = cls._schema_on_200.value
198+
value.Element = AAZObjectType()
199+
200+
_element = cls._schema_on_200.value.Element
201+
_element.circuits = AAZListType(
202+
flags={"read_only": True},
203+
)
204+
_element.connections = AAZListType(
205+
flags={"read_only": True},
206+
)
207+
_element.end_time = AAZStrType(
208+
serialized_name="endTime",
209+
flags={"read_only": True},
210+
)
211+
_element.issues = AAZListType(
212+
flags={"read_only": True},
213+
)
214+
_element.peering_location = AAZStrType(
215+
serialized_name="peeringLocation",
216+
flags={"read_only": True},
217+
)
218+
_element.start_time = AAZStrType(
219+
serialized_name="startTime",
220+
flags={"read_only": True},
221+
)
222+
_element.status = AAZStrType(
223+
flags={"read_only": True},
224+
)
225+
_element.test_guid = AAZStrType(
226+
serialized_name="testGuid",
227+
flags={"read_only": True},
228+
)
229+
_element.test_type = AAZStrType(
230+
serialized_name="testType",
231+
flags={"read_only": True},
232+
)
233+
234+
circuits = cls._schema_on_200.value.Element.circuits
235+
circuits.Element = AAZObjectType()
236+
237+
_element = cls._schema_on_200.value.Element.circuits.Element
238+
_element.connection_name = AAZStrType(
239+
serialized_name="connectionName",
240+
)
241+
_element.name = AAZStrType()
242+
_element.nrp_resource_uri = AAZStrType(
243+
serialized_name="nrpResourceUri",
244+
)
245+
246+
connections = cls._schema_on_200.value.Element.connections
247+
connections.Element = AAZObjectType()
248+
249+
_element = cls._schema_on_200.value.Element.connections.Element
250+
_element.last_updated_time = AAZStrType(
251+
serialized_name="lastUpdatedTime",
252+
flags={"read_only": True},
253+
)
254+
_element.name = AAZStrType()
255+
_element.nrp_resource_uri = AAZStrType(
256+
serialized_name="nrpResourceUri",
257+
)
258+
_element.status = AAZStrType()
259+
260+
issues = cls._schema_on_200.value.Element.issues
261+
issues.Element = AAZStrType()
262+
263+
return cls._schema_on_200
264+
265+
266+
class _GetFailoverAllTestsDetailHelper:
267+
"""Helper class for GetFailoverAllTestsDetail"""
268+
269+
270+
__all__ = ["GetFailoverAllTestsDetail"]

0 commit comments

Comments
 (0)