Skip to content

Commit 7e6a12c

Browse files
karthik-gumpuKarthik Gumpu (from Dev Box)
authored andcommitted
{Network} NSP stable release on 2024-07-01 GA version (Azure#8588)
* Add NSP GA changes * Updated tests * Updated version history * Updated version * Remove preview label * Update param name * Add changes as per latest swagger changes * Update history --------- Co-authored-by: Karthik Gumpu (from Dev Box) <karthikgumpu@microsoft.com>
1 parent 633cbf7 commit 7e6a12c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3014
-1352
lines changed

src/nsp/HISTORY.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ Release History
44
===============
55
===============
66

7+
##### 1.0.0
8+
++++++
9+
New commands added:
10+
* perimeter associable-resource-type: list
11+
* perimeter logging-configuration: list
12+
13+
Existing commands updated:
14+
* perimeter delete: added --force-deletion parameter.
15+
* Flattened output reponse for all commands.
16+
17+
Removed commands:
18+
* perimeter onboarded-resources: list
19+
720
##### 1.0.0b3
821
++++++
922
New commands added:

src/nsp/azext_nsp/aaz/latest/network/perimeter/__cmd_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"network perimeter",
1616
)
1717
class __CMDGroup(AAZCommandGroup):
18-
"""Manage Network Security Perimeters
18+
"""Manage Network Security Perimeters.
1919
"""
2020
pass
2121

src/nsp/azext_nsp/aaz/latest/network/perimeter/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
from ._delete import *
1414
from ._list import *
1515
from ._show import *
16+
from ._wait import *

src/nsp/azext_nsp/aaz/latest/network/perimeter/_create.py

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
"network perimeter create",
1616
)
1717
class Create(AAZCommand):
18-
"""Creates a Network Security Perimeter.
18+
"""Create a network security perimeter.
1919
20-
:example: Create a Network Security Perimeter
20+
:example: Create a network security perimeter
2121
az network perimeter create -n MyPerimeter -g MyResourceGroup -l northcentralus
2222
"""
2323

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

@@ -48,6 +48,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
4848
options=["-n", "--name", "--perimeter-name"],
4949
help="The name of the network security perimeter.",
5050
required=True,
51+
fmt=AAZStrArgFormat(
52+
pattern="(^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*[a-zA-Z0-9_]+$)|(^[a-zA-Z0-9]$)",
53+
max_length=80,
54+
),
5155
)
5256
_args_schema.resource_group = AAZResourceGroupNameArg(
5357
required=True,
@@ -59,6 +63,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5963
_args_schema.location = AAZResourceLocationArg(
6064
arg_group="Parameters",
6165
help="The location in which NSP is created.",
66+
required=True,
6267
fmt=AAZResourceLocationArgFormat(
6368
resource_group_arg="resource_group",
6469
),
@@ -87,7 +92,7 @@ def post_operations(self):
8792
pass
8893

8994
def _output(self, *args, **kwargs):
90-
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False)
95+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
9196
return result
9297

9398
class NetworkSecurityPerimetersCreateOrUpdate(AAZHttpOperation):
@@ -138,7 +143,7 @@ def url_parameters(self):
138143
def query_parameters(self):
139144
parameters = {
140145
**self.serialize_query_param(
141-
"api-version", "2023-08-01-preview",
146+
"api-version", "2024-07-01",
142147
required=True,
143148
),
144149
}
@@ -163,8 +168,7 @@ def content(self):
163168
typ=AAZObjectType,
164169
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
165170
)
166-
_builder.set_prop("location", AAZStrType, ".location")
167-
_builder.set_prop("name", AAZStrType, ".perimeter_name")
171+
_builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}})
168172
_builder.set_prop("tags", AAZDictType, ".tags")
169173

170174
tags = _builder.get(".tags")
@@ -194,9 +198,19 @@ def _build_schema_on_200_201(cls):
194198
_schema_on_200_201.id = AAZStrType(
195199
flags={"read_only": True},
196200
)
197-
_schema_on_200_201.location = AAZStrType()
198-
_schema_on_200_201.name = AAZStrType()
199-
_schema_on_200_201.properties = AAZObjectType()
201+
_schema_on_200_201.location = AAZStrType(
202+
flags={"required": True},
203+
)
204+
_schema_on_200_201.name = AAZStrType(
205+
flags={"read_only": True},
206+
)
207+
_schema_on_200_201.properties = AAZObjectType(
208+
flags={"client_flatten": True},
209+
)
210+
_schema_on_200_201.system_data = AAZObjectType(
211+
serialized_name="systemData",
212+
flags={"read_only": True},
213+
)
200214
_schema_on_200_201.tags = AAZDictType()
201215
_schema_on_200_201.type = AAZStrType(
202216
flags={"read_only": True},
@@ -212,6 +226,26 @@ def _build_schema_on_200_201(cls):
212226
flags={"read_only": True},
213227
)
214228

229+
system_data = cls._schema_on_200_201.system_data
230+
system_data.created_at = AAZStrType(
231+
serialized_name="createdAt",
232+
)
233+
system_data.created_by = AAZStrType(
234+
serialized_name="createdBy",
235+
)
236+
system_data.created_by_type = AAZStrType(
237+
serialized_name="createdByType",
238+
)
239+
system_data.last_modified_at = AAZStrType(
240+
serialized_name="lastModifiedAt",
241+
)
242+
system_data.last_modified_by = AAZStrType(
243+
serialized_name="lastModifiedBy",
244+
)
245+
system_data.last_modified_by_type = AAZStrType(
246+
serialized_name="lastModifiedByType",
247+
)
248+
215249
tags = cls._schema_on_200_201.tags
216250
tags.Element = AAZStrType()
217251

src/nsp/azext_nsp/aaz/latest/network/perimeter/_delete.py

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@
1616
confirmation="Are you sure you want to perform this operation?",
1717
)
1818
class Delete(AAZCommand):
19-
"""Deletes a network security perimeter.
19+
"""Delete a network security perimeter.
2020
21-
:example: Delete a Network Security Perimeter
21+
:example: Delete a network security perimeter
2222
az network perimeter delete -g MyResourceGroup -n MyPerimeter
2323
"""
2424

2525
_aaz_info = {
26-
"version": "2023-08-01-preview",
26+
"version": "2024-07-01",
2727
"resources": [
28-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2023-08-01-preview"],
28+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2024-07-01"],
2929
]
3030
}
3131

32+
AZ_SUPPORT_NO_WAIT = True
33+
3234
def _handler(self, command_args):
3335
super()._handler(command_args)
34-
self._execute_operations()
35-
return None
36+
return self.build_lro_poller(self._execute_operations, None)
3637

3738
_args_schema = None
3839

@@ -50,15 +51,23 @@ def _build_arguments_schema(cls, *args, **kwargs):
5051
help="The name of the network security perimeter.",
5152
required=True,
5253
id_part="name",
54+
fmt=AAZStrArgFormat(
55+
pattern="(^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*[a-zA-Z0-9_]+$)|(^[a-zA-Z0-9]$)",
56+
max_length=80,
57+
),
5358
)
5459
_args_schema.resource_group = AAZResourceGroupNameArg(
5560
required=True,
5661
)
62+
_args_schema.force_deletion = AAZBoolArg(
63+
options=["--force-deletion"],
64+
help="Deletes the resource even if it contains any child associations.",
65+
)
5766
return cls._args_schema
5867

5968
def _execute_operations(self):
6069
self.pre_operations()
61-
self.NetworkSecurityPerimetersDelete(ctx=self.ctx)()
70+
yield self.NetworkSecurityPerimetersDelete(ctx=self.ctx)()
6271
self.post_operations()
6372

6473
@register_callback
@@ -75,10 +84,33 @@ class NetworkSecurityPerimetersDelete(AAZHttpOperation):
7584
def __call__(self, *args, **kwargs):
7685
request = self.make_request()
7786
session = self.client.send_request(request=request, stream=False, **kwargs)
87+
if session.http_response.status_code in [202]:
88+
return self.client.build_lro_polling(
89+
self.ctx.args.no_wait,
90+
session,
91+
self.on_200,
92+
self.on_error,
93+
lro_options={"final-state-via": "azure-async-operation"},
94+
path_format_arguments=self.url_parameters,
95+
)
7896
if session.http_response.status_code in [200]:
79-
return self.on_200(session)
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": "azure-async-operation"},
103+
path_format_arguments=self.url_parameters,
104+
)
80105
if session.http_response.status_code in [204]:
81-
return self.on_204(session)
106+
return self.client.build_lro_polling(
107+
self.ctx.args.no_wait,
108+
session,
109+
self.on_204,
110+
self.on_error,
111+
lro_options={"final-state-via": "azure-async-operation"},
112+
path_format_arguments=self.url_parameters,
113+
)
82114

83115
return self.on_error(session.http_response)
84116

@@ -119,7 +151,10 @@ def url_parameters(self):
119151
def query_parameters(self):
120152
parameters = {
121153
**self.serialize_query_param(
122-
"api-version", "2023-08-01-preview",
154+
"forceDeletion", self.ctx.args.force_deletion,
155+
),
156+
**self.serialize_query_param(
157+
"api-version", "2024-07-01",
123158
required=True,
124159
),
125160
}

0 commit comments

Comments
 (0)