Skip to content

Commit 5555e58

Browse files
authored
[Storage] az storage account network-security-perimeter-configuration list/show/reconcile: Add support for network-security-perimeter (#32294)
1 parent ecf19d1 commit 5555e58

File tree

7 files changed

+1326
-0
lines changed

7 files changed

+1326
-0
lines changed
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+
"storage account network-security-perimeter-configuration",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Network Security Perimeter Configuration
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 ._list import *
13+
from ._reconcile import *
14+
from ._show import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
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+
"storage account network-security-perimeter-configuration list",
16+
)
17+
class List(AAZCommand):
18+
"""List list of effective NetworkSecurityPerimeterConfiguration for storage account
19+
20+
:example: List NetworkSecurityPerimeterConfiguration
21+
az storage account network-security-perimeter-configuration list --resource-group res4410 --account-name sto8607
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2025-01-01",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/networksecurityperimeterconfigurations", "2025-01-01"],
28+
]
29+
}
30+
31+
def _handler(self, command_args):
32+
super()._handler(command_args)
33+
self._execute_operations()
34+
return self._output()
35+
36+
_args_schema = None
37+
38+
@classmethod
39+
def _build_arguments_schema(cls, *args, **kwargs):
40+
if cls._args_schema is not None:
41+
return cls._args_schema
42+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
43+
44+
# define Arg Group ""
45+
46+
_args_schema = cls._args_schema
47+
_args_schema.account_name = AAZStrArg(
48+
options=["--account-name"],
49+
help="The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.",
50+
required=True,
51+
fmt=AAZStrArgFormat(
52+
pattern="^[a-z0-9]+$",
53+
max_length=24,
54+
min_length=3,
55+
),
56+
)
57+
_args_schema.resource_group = AAZResourceGroupNameArg(
58+
required=True,
59+
)
60+
return cls._args_schema
61+
62+
def _execute_operations(self):
63+
self.pre_operations()
64+
self.NetworkSecurityPerimeterConfigurationsList(ctx=self.ctx)()
65+
self.post_operations()
66+
67+
@register_callback
68+
def pre_operations(self):
69+
pass
70+
71+
@register_callback
72+
def post_operations(self):
73+
pass
74+
75+
def _output(self, *args, **kwargs):
76+
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
77+
return result
78+
79+
class NetworkSecurityPerimeterConfigurationsList(AAZHttpOperation):
80+
CLIENT_TYPE = "MgmtClient"
81+
82+
def __call__(self, *args, **kwargs):
83+
request = self.make_request()
84+
session = self.client.send_request(request=request, stream=False, **kwargs)
85+
if session.http_response.status_code in [200]:
86+
return self.on_200(session)
87+
88+
return self.on_error(session.http_response)
89+
90+
@property
91+
def url(self):
92+
return self.client.format_url(
93+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/networkSecurityPerimeterConfigurations",
94+
**self.url_parameters
95+
)
96+
97+
@property
98+
def method(self):
99+
return "GET"
100+
101+
@property
102+
def error_format(self):
103+
return "MgmtErrorFormat"
104+
105+
@property
106+
def url_parameters(self):
107+
parameters = {
108+
**self.serialize_url_param(
109+
"accountName", self.ctx.args.account_name,
110+
required=True,
111+
),
112+
**self.serialize_url_param(
113+
"resourceGroupName", self.ctx.args.resource_group,
114+
required=True,
115+
),
116+
**self.serialize_url_param(
117+
"subscriptionId", self.ctx.subscription_id,
118+
required=True,
119+
),
120+
}
121+
return parameters
122+
123+
@property
124+
def query_parameters(self):
125+
parameters = {
126+
**self.serialize_query_param(
127+
"api-version", "2025-01-01",
128+
required=True,
129+
),
130+
}
131+
return parameters
132+
133+
@property
134+
def header_parameters(self):
135+
parameters = {
136+
**self.serialize_header_param(
137+
"Accept", "application/json",
138+
),
139+
}
140+
return parameters
141+
142+
def on_200(self, session):
143+
data = self.deserialize_http_content(session)
144+
self.ctx.set_var(
145+
"instance",
146+
data,
147+
schema_builder=self._build_schema_on_200
148+
)
149+
150+
_schema_on_200 = None
151+
152+
@classmethod
153+
def _build_schema_on_200(cls):
154+
if cls._schema_on_200 is not None:
155+
return cls._schema_on_200
156+
157+
cls._schema_on_200 = AAZObjectType()
158+
159+
_schema_on_200 = cls._schema_on_200
160+
_schema_on_200.next_link = AAZStrType(
161+
serialized_name="nextLink",
162+
)
163+
_schema_on_200.value = AAZListType(
164+
flags={"read_only": True},
165+
)
166+
167+
value = cls._schema_on_200.value
168+
value.Element = AAZObjectType(
169+
flags={"read_only": True},
170+
)
171+
172+
_element = cls._schema_on_200.value.Element
173+
_element.id = AAZStrType(
174+
flags={"read_only": True},
175+
)
176+
_element.name = AAZStrType(
177+
flags={"read_only": True},
178+
)
179+
_element.properties = AAZObjectType(
180+
flags={"client_flatten": True, "read_only": True},
181+
)
182+
_element.system_data = AAZObjectType(
183+
serialized_name="systemData",
184+
flags={"read_only": True},
185+
)
186+
_element.type = AAZStrType(
187+
flags={"read_only": True},
188+
)
189+
190+
properties = cls._schema_on_200.value.Element.properties
191+
properties.network_security_perimeter = AAZObjectType(
192+
serialized_name="networkSecurityPerimeter",
193+
flags={"read_only": True},
194+
)
195+
_ListHelper._build_schema_network_security_perimeter_read(properties.network_security_perimeter)
196+
properties.profile = AAZObjectType(
197+
flags={"read_only": True},
198+
)
199+
properties.provisioning_issues = AAZListType(
200+
serialized_name="provisioningIssues",
201+
flags={"read_only": True},
202+
)
203+
properties.provisioning_state = AAZStrType(
204+
serialized_name="provisioningState",
205+
flags={"read_only": True},
206+
)
207+
properties.resource_association = AAZObjectType(
208+
serialized_name="resourceAssociation",
209+
flags={"read_only": True},
210+
)
211+
212+
profile = cls._schema_on_200.value.Element.properties.profile
213+
profile.access_rules = AAZListType(
214+
serialized_name="accessRules",
215+
)
216+
profile.access_rules_version = AAZFloatType(
217+
serialized_name="accessRulesVersion",
218+
)
219+
profile.diagnostic_settings_version = AAZFloatType(
220+
serialized_name="diagnosticSettingsVersion",
221+
)
222+
profile.enabled_log_categories = AAZListType(
223+
serialized_name="enabledLogCategories",
224+
)
225+
profile.name = AAZStrType()
226+
227+
access_rules = cls._schema_on_200.value.Element.properties.profile.access_rules
228+
access_rules.Element = AAZObjectType(
229+
flags={"read_only": True},
230+
)
231+
232+
_element = cls._schema_on_200.value.Element.properties.profile.access_rules.Element
233+
_element.name = AAZStrType()
234+
_element.properties = AAZObjectType(
235+
flags={"read_only": True},
236+
)
237+
238+
properties = cls._schema_on_200.value.Element.properties.profile.access_rules.Element.properties
239+
properties.address_prefixes = AAZListType(
240+
serialized_name="addressPrefixes",
241+
)
242+
properties.direction = AAZStrType()
243+
properties.fully_qualified_domain_names = AAZListType(
244+
serialized_name="fullyQualifiedDomainNames",
245+
flags={"read_only": True},
246+
)
247+
properties.network_security_perimeters = AAZListType(
248+
serialized_name="networkSecurityPerimeters",
249+
flags={"read_only": True},
250+
)
251+
properties.subscriptions = AAZListType()
252+
253+
address_prefixes = cls._schema_on_200.value.Element.properties.profile.access_rules.Element.properties.address_prefixes
254+
address_prefixes.Element = AAZStrType()
255+
256+
fully_qualified_domain_names = cls._schema_on_200.value.Element.properties.profile.access_rules.Element.properties.fully_qualified_domain_names
257+
fully_qualified_domain_names.Element = AAZStrType()
258+
259+
network_security_perimeters = cls._schema_on_200.value.Element.properties.profile.access_rules.Element.properties.network_security_perimeters
260+
network_security_perimeters.Element = AAZObjectType(
261+
flags={"read_only": True},
262+
)
263+
_ListHelper._build_schema_network_security_perimeter_read(network_security_perimeters.Element)
264+
265+
subscriptions = cls._schema_on_200.value.Element.properties.profile.access_rules.Element.properties.subscriptions
266+
subscriptions.Element = AAZObjectType(
267+
flags={"read_only": True},
268+
)
269+
270+
_element = cls._schema_on_200.value.Element.properties.profile.access_rules.Element.properties.subscriptions.Element
271+
_element.id = AAZStrType()
272+
273+
enabled_log_categories = cls._schema_on_200.value.Element.properties.profile.enabled_log_categories
274+
enabled_log_categories.Element = AAZStrType()
275+
276+
provisioning_issues = cls._schema_on_200.value.Element.properties.provisioning_issues
277+
provisioning_issues.Element = AAZObjectType(
278+
flags={"read_only": True},
279+
)
280+
281+
_element = cls._schema_on_200.value.Element.properties.provisioning_issues.Element
282+
_element.name = AAZStrType()
283+
_element.properties = AAZObjectType(
284+
flags={"read_only": True},
285+
)
286+
287+
properties = cls._schema_on_200.value.Element.properties.provisioning_issues.Element.properties
288+
properties.description = AAZStrType()
289+
properties.issue_type = AAZStrType(
290+
serialized_name="issueType",
291+
)
292+
properties.severity = AAZStrType()
293+
294+
resource_association = cls._schema_on_200.value.Element.properties.resource_association
295+
resource_association.access_mode = AAZStrType(
296+
serialized_name="accessMode",
297+
)
298+
resource_association.name = AAZStrType()
299+
300+
system_data = cls._schema_on_200.value.Element.system_data
301+
system_data.created_at = AAZStrType(
302+
serialized_name="createdAt",
303+
)
304+
system_data.created_by = AAZStrType(
305+
serialized_name="createdBy",
306+
)
307+
system_data.created_by_type = AAZStrType(
308+
serialized_name="createdByType",
309+
)
310+
system_data.last_modified_at = AAZStrType(
311+
serialized_name="lastModifiedAt",
312+
)
313+
system_data.last_modified_by = AAZStrType(
314+
serialized_name="lastModifiedBy",
315+
)
316+
system_data.last_modified_by_type = AAZStrType(
317+
serialized_name="lastModifiedByType",
318+
)
319+
320+
return cls._schema_on_200
321+
322+
323+
class _ListHelper:
324+
"""Helper class for List"""
325+
326+
_schema_network_security_perimeter_read = None
327+
328+
@classmethod
329+
def _build_schema_network_security_perimeter_read(cls, _schema):
330+
if cls._schema_network_security_perimeter_read is not None:
331+
_schema.id = cls._schema_network_security_perimeter_read.id
332+
_schema.location = cls._schema_network_security_perimeter_read.location
333+
_schema.perimeter_guid = cls._schema_network_security_perimeter_read.perimeter_guid
334+
return
335+
336+
cls._schema_network_security_perimeter_read = _schema_network_security_perimeter_read = AAZObjectType(
337+
flags={"read_only": True}
338+
)
339+
340+
network_security_perimeter_read = _schema_network_security_perimeter_read
341+
network_security_perimeter_read.id = AAZStrType()
342+
network_security_perimeter_read.location = AAZStrType()
343+
network_security_perimeter_read.perimeter_guid = AAZStrType(
344+
serialized_name="perimeterGuid",
345+
)
346+
347+
_schema.id = cls._schema_network_security_perimeter_read.id
348+
_schema.location = cls._schema_network_security_perimeter_read.location
349+
_schema.perimeter_guid = cls._schema_network_security_perimeter_read.perimeter_guid
350+
351+
352+
__all__ = ["List"]

0 commit comments

Comments
 (0)