Skip to content

Commit b9aa965

Browse files
Improve pscloud pool CLI usability
- Rename -n and --name - Add --zone and -z - Flatten --vnet-injection. - Remove unsupported identity options (--system-assigned, --user-assigned) - Make required parameters mandatory with client-side validation - --zone, --provisioned-bandwidth, --reservation-id - --subnet-id, --vnet-id - Remove wait subcommand for consistency with other Azure CLIs - Update examples to show cleaner syntax with individual flags
1 parent 4f9675f commit b9aa965

6 files changed

Lines changed: 32 additions & 385 deletions

File tree

src/pscloud/azext_pscloud/aaz/latest/pscloud/pool/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
from ._list import *
1717
from ._show import *
1818
from ._update import *
19-
from ._wait import *

src/pscloud/azext_pscloud/aaz/latest/pscloud/pool/_create.py

Lines changed: 23 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Create(AAZCommand):
1919
"""Create a storage pool
2020
2121
:example: StoragePools_Create
22-
az pscloud pool create --resource-group rgpurestorage --storage-pool-name storagePoolname --availability-zone vknyl --vnet-injection "{subnet-id:tnlctolrxdvnkjiphlrdxq,vnet-id:zbumtytyqwewjcyckwqchiypshv}" --provisioned-bandwidth 17 --reservation-id xiowoxnbtcotutcmmrofvgdi --type None --user-assigned-identities "{key4211:{}}" --tags "{key7593:vsyiygyurvwlfaezpuqu}" --location lonlc
22+
az pscloud pool create --resource-group rgpurestorage --storage-pool-name storagePoolname --zone 1 --subnet-id /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName} --vnet-id /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName} --provisioned-bandwidth 100 --reservation-id /subscriptions/{subscriptionId}/providers/PureStorage.Block/reservations/{reservationName} --location eastus
2323
"""
2424

2525
_aaz_info = {
@@ -60,58 +60,25 @@ def _build_arguments_schema(cls, *args, **kwargs):
6060
),
6161
)
6262

63-
# define Arg Group "Identity"
64-
65-
_args_schema = cls._args_schema
66-
_args_schema.mi_system_assigned = AAZStrArg(
67-
options=["--system-assigned", "--mi-system-assigned"],
68-
arg_group="Identity",
69-
help="Set the system managed identity.",
70-
blank="True",
71-
)
72-
_args_schema.mi_user_assigned = AAZListArg(
73-
options=["--user-assigned", "--mi-user-assigned"],
74-
arg_group="Identity",
75-
help="Set the user managed identities.",
76-
blank=[],
77-
)
78-
79-
mi_user_assigned = cls._args_schema.mi_user_assigned
80-
mi_user_assigned.Element = AAZStrArg()
81-
8263
# define Arg Group "Properties"
8364

8465
_args_schema = cls._args_schema
85-
_args_schema.availability_zone = AAZStrArg(
86-
options=["--availability-zone"],
66+
_args_schema.zone = AAZStrArg(
67+
options=["-z", "--zone"],
8768
arg_group="Properties",
8869
help="Azure Availability Zone the Pool is located in",
70+
required=True,
8971
)
9072
_args_schema.provisioned_bandwidth = AAZIntArg(
9173
options=["--provisioned-bandwidth"],
9274
arg_group="Properties",
9375
help="Total bandwidth provisioned for the pool, in MB/s",
76+
required=True,
9477
)
9578
_args_schema.reservation_id = AAZStrArg(
9679
options=["--reservation-id"],
9780
arg_group="Properties",
9881
help="Azure resource ID of the Pure Storage Cloud service (reservation resource) this storage pool belongs to",
99-
)
100-
_args_schema.vnet_injection = AAZObjectArg(
101-
options=["--vnet-injection"],
102-
arg_group="Properties",
103-
help="Network properties of the storage pool",
104-
)
105-
106-
vnet_injection = cls._args_schema.vnet_injection
107-
vnet_injection.subnet_id = AAZStrArg(
108-
options=["subnet-id"],
109-
help="Azure resource ID of the Virtual Network subnet where the storage pool will be connected",
110-
required=True,
111-
)
112-
vnet_injection.vnet_id = AAZStrArg(
113-
options=["vnet-id"],
114-
help="Azure resource ID of the Virtual Network in which the subnet is located",
11582
required=True,
11683
)
11784

@@ -134,6 +101,22 @@ def _build_arguments_schema(cls, *args, **kwargs):
134101

135102
tags = cls._args_schema.tags
136103
tags.Element = AAZStrArg()
104+
105+
# define Arg Group "VnetInjection"
106+
107+
_args_schema = cls._args_schema
108+
_args_schema.subnet_id = AAZStrArg(
109+
options=["--subnet-id"],
110+
arg_group="VnetInjection",
111+
help="Azure resource ID of the Virtual Network subnet where the storage pool will be connected",
112+
required=True,
113+
)
114+
_args_schema.vnet_id = AAZStrArg(
115+
options=["--vnet-id"],
116+
arg_group="VnetInjection",
117+
help="Azure resource ID of the Virtual Network in which the subnet is located",
118+
required=True,
119+
)
137120
return cls._args_schema
138121

139122
def _execute_operations(self):
@@ -242,26 +225,16 @@ def content(self):
242225
typ=AAZObjectType,
243226
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
244227
)
245-
_builder.set_prop("identity", AAZIdentityObjectType)
246228
_builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}})
247229
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
248230
_builder.set_prop("tags", AAZDictType, ".tags")
249231

250-
identity = _builder.get(".identity")
251-
if identity is not None:
252-
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
253-
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})
254-
255-
user_assigned = _builder.get(".identity.userAssigned")
256-
if user_assigned is not None:
257-
user_assigned.set_elements(AAZStrType, ".")
258-
259232
properties = _builder.get(".properties")
260233
if properties is not None:
261-
properties.set_prop("availabilityZone", AAZStrType, ".availability_zone", typ_kwargs={"flags": {"required": True}})
234+
properties.set_prop("availabilityZone", AAZStrType, ".zone", typ_kwargs={"flags": {"required": True}})
262235
properties.set_prop("provisionedBandwidthMbPerSec", AAZIntType, ".provisioned_bandwidth", typ_kwargs={"flags": {"required": True}})
263236
properties.set_prop("reservationResourceId", AAZStrType, ".reservation_id", typ_kwargs={"flags": {"required": True}})
264-
properties.set_prop("vnetInjection", AAZObjectType, ".vnet_injection", typ_kwargs={"flags": {"required": True}})
237+
properties.set_prop("vnetInjection", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}})
265238

266239
vnet_injection = _builder.get(".properties.vnetInjection")
267240
if vnet_injection is not None:

src/pscloud/azext_pscloud/aaz/latest/pscloud/pool/_get_avs_status.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def _build_arguments_schema(cls, *args, **kwargs):
4848
_args_schema.resource_group = AAZResourceGroupNameArg(
4949
required=True,
5050
)
51-
_args_schema.storage_pool_name = AAZStrArg(
52-
options=["--storage-pool-name"],
51+
_args_schema.name = AAZStrArg(
52+
options=["-n", "--name"],
5353
help="Name of the storage pool",
5454
required=True,
5555
id_part="name",
@@ -112,7 +112,7 @@ def url_parameters(self):
112112
required=True,
113113
),
114114
**self.serialize_url_param(
115-
"storagePoolName", self.ctx.args.storage_pool_name,
115+
"storagePoolName", self.ctx.args.name,
116116
required=True,
117117
),
118118
**self.serialize_url_param(

src/pscloud/azext_pscloud/aaz/latest/pscloud/pool/_get_health_status.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,24 +203,24 @@ def _build_schema_on_200(cls):
203203
)
204204

205205
bandwidth_usage = cls._schema_on_200.health.bandwidth_usage
206-
bandwidth_usage.current = AAZFloatType(
206+
bandwidth_usage.current = AAZIntType(
207207
flags={"required": True},
208208
)
209-
bandwidth_usage.max = AAZFloatType(
209+
bandwidth_usage.max = AAZIntType(
210210
flags={"required": True},
211211
)
212-
bandwidth_usage.provisioned = AAZFloatType(
212+
bandwidth_usage.provisioned = AAZIntType(
213213
flags={"required": True},
214214
)
215215

216216
iops_usage = cls._schema_on_200.health.iops_usage
217-
iops_usage.current = AAZFloatType(
217+
iops_usage.current = AAZIntType(
218218
flags={"required": True},
219219
)
220-
iops_usage.max = AAZFloatType(
220+
iops_usage.max = AAZIntType(
221221
flags={"required": True},
222222
)
223-
iops_usage.provisioned = AAZFloatType(
223+
iops_usage.provisioned = AAZIntType(
224224
flags={"required": True},
225225
)
226226

src/pscloud/azext_pscloud/aaz/latest/pscloud/pool/_update.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
6161
),
6262
)
6363

64-
# define Arg Group "Identity"
65-
66-
_args_schema = cls._args_schema
67-
_args_schema.mi_system_assigned = AAZStrArg(
68-
options=["--system-assigned", "--mi-system-assigned"],
69-
arg_group="Identity",
70-
help="Set the system managed identity.",
71-
blank="True",
72-
)
73-
_args_schema.mi_user_assigned = AAZListArg(
74-
options=["--user-assigned", "--mi-user-assigned"],
75-
arg_group="Identity",
76-
help="Set the user managed identities.",
77-
blank=[],
78-
)
79-
80-
mi_user_assigned = cls._args_schema.mi_user_assigned
81-
mi_user_assigned.Element = AAZStrArg()
82-
8364
# define Arg Group "Properties"
8465

8566
_args_schema = cls._args_schema
@@ -204,19 +185,9 @@ def content(self):
204185
typ=AAZObjectType,
205186
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
206187
)
207-
_builder.set_prop("identity", AAZIdentityObjectType)
208188
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
209189
_builder.set_prop("tags", AAZDictType, ".tags")
210190

211-
identity = _builder.get(".identity")
212-
if identity is not None:
213-
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
214-
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})
215-
216-
user_assigned = _builder.get(".identity.userAssigned")
217-
if user_assigned is not None:
218-
user_assigned.set_elements(AAZStrType, ".")
219-
220191
properties = _builder.get(".properties")
221192
if properties is not None:
222193
properties.set_prop("provisionedBandwidthMbPerSec", AAZIntType, ".provisioned_bandwidth")

0 commit comments

Comments
 (0)