Skip to content

Commit 2b0e094

Browse files
authored
[Storage] az storage account task-assignment create: Support MockRun as new triggerType (#9898)
* update to 2025-08-01, support mockrun as new triggertype * fix test, add back param * remove breaking change * style * style
1 parent 60dd665 commit 2b0e094

14 files changed

Lines changed: 864 additions & 413 deletions

File tree

src/storage-preview/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
Release History
44
===============
55

6+
1.0.0b8
7+
+++++++
8+
* `az storage account task-assignment`: Add `MockRun` as a triggerType
9+
610
1.0.0b7
7-
++++++
11+
+++++++
812
* Remove DATA_COSMOS_TABLE and DATA_STORAGE references
913
* `az storage account migration start/show`: Remove since it has been GA in main repo
1014

src/storage-preview/azext_storage_preview/aaz/latest/storage/account/task_assignment/_create.py

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Create(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-01-01",
25+
"version": "2025-08-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/storagetaskassignments/{}", "2024-01-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/storagetaskassignments/{}", "2025-08-01"],
2828
]
2929
}
3030

@@ -63,7 +63,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6363
help="The name of the storage task assignment within the specified resource group. Storage task assignment names must be between 3 and 24 characters in length and use numbers and lower-case letters only.",
6464
required=True,
6565
fmt=AAZStrArgFormat(
66-
pattern="^[a-z0-9]{3,24}$",
66+
pattern="^[a-z][a-z0-9]{2,23}$",
6767
max_length=24,
6868
min_length=3,
6969
),
@@ -76,31 +76,26 @@ def _build_arguments_schema(cls, *args, **kwargs):
7676
options=["--description"],
7777
arg_group="Properties",
7878
help="Text that describes the purpose of the storage task assignment",
79-
required=True,
8079
)
8180
_args_schema.enabled = AAZBoolArg(
8281
options=["--enabled"],
8382
arg_group="Properties",
8483
help="Whether the storage task assignment is enabled or not",
85-
required=True,
8684
)
8785
_args_schema.execution_context = AAZObjectArg(
8886
options=["--execution-context"],
8987
arg_group="Properties",
9088
help="The storage task assignment execution context",
91-
required=True,
9289
)
9390
_args_schema.report = AAZObjectArg(
9491
options=["--report"],
9592
arg_group="Properties",
9693
help="The storage task assignment report",
97-
required=True,
9894
)
9995
_args_schema.task_id = AAZResourceIdArg(
10096
options=["--task-id"],
10197
arg_group="Properties",
10298
help="Id of the corresponding storage task",
103-
required=True,
10499
)
105100

106101
execution_context = cls._args_schema.execution_context
@@ -140,13 +135,16 @@ def _build_arguments_schema(cls, *args, **kwargs):
140135
options=["type"],
141136
help="The trigger type of the storage task assignment execution",
142137
required=True,
143-
enum={"OnSchedule": "OnSchedule", "RunOnce": "RunOnce"},
138+
enum={"MockRun": "MockRun", "OnSchedule": "OnSchedule", "RunOnce": "RunOnce"},
144139
)
145140

146141
parameters = cls._args_schema.execution_context.trigger.parameters
147142
parameters.end_by = AAZDateTimeArg(
148143
options=["end-by"],
149144
help="When to end task execution. This is a required field when ExecutionTrigger.properties.type is 'OnSchedule'; this property should not be present when ExecutionTrigger.properties.type is 'RunOnce'",
145+
fmt=AAZDateTimeFormat(
146+
protocol="iso",
147+
),
150148
)
151149
parameters.interval = AAZIntArg(
152150
options=["interval"],
@@ -163,10 +161,16 @@ def _build_arguments_schema(cls, *args, **kwargs):
163161
parameters.start_from = AAZDateTimeArg(
164162
options=["start-from"],
165163
help="When to start task execution. This is a required field when ExecutionTrigger.properties.type is 'OnSchedule'; this property should not be present when ExecutionTrigger.properties.type is 'RunOnce'",
164+
fmt=AAZDateTimeFormat(
165+
protocol="iso",
166+
),
166167
)
167168
parameters.start_on = AAZDateTimeArg(
168169
options=["start-on"],
169170
help="When to start task execution. This is an optional field when ExecutionTrigger.properties.type is 'RunOnce'; this property should not be present when ExecutionTrigger.properties.type is 'OnSchedule'",
171+
fmt=AAZDateTimeFormat(
172+
protocol="iso",
173+
),
170174
)
171175

172176
report = cls._args_schema.report
@@ -234,7 +238,7 @@ def method(self):
234238

235239
@property
236240
def error_format(self):
237-
return "MgmtErrorFormat"
241+
return "ODataV4Format"
238242

239243
@property
240244
def url_parameters(self):
@@ -262,7 +266,7 @@ def url_parameters(self):
262266
def query_parameters(self):
263267
parameters = {
264268
**self.serialize_query_param(
265-
"api-version", "2024-01-01",
269+
"api-version", "2025-08-01",
266270
required=True,
267271
),
268272
}
@@ -287,7 +291,7 @@ def content(self):
287291
typ=AAZObjectType,
288292
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
289293
)
290-
_builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}})
294+
_builder.set_prop("properties", AAZObjectType)
291295

292296
properties = _builder.get(".properties")
293297
if properties is not None:
@@ -358,8 +362,10 @@ def _build_schema_on_200_201(cls):
358362
_schema_on_200_201.name = AAZStrType(
359363
flags={"read_only": True},
360364
)
361-
_schema_on_200_201.properties = AAZObjectType(
362-
flags={"required": True},
365+
_schema_on_200_201.properties = AAZObjectType()
366+
_schema_on_200_201.system_data = AAZObjectType(
367+
serialized_name="systemData",
368+
flags={"read_only": True},
363369
)
364370
_schema_on_200_201.type = AAZStrType(
365371
flags={"read_only": True},
@@ -495,6 +501,26 @@ def _build_schema_on_200_201(cls):
495501
flags={"read_only": True},
496502
)
497503

504+
system_data = cls._schema_on_200_201.system_data
505+
system_data.created_at = AAZStrType(
506+
serialized_name="createdAt",
507+
)
508+
system_data.created_by = AAZStrType(
509+
serialized_name="createdBy",
510+
)
511+
system_data.created_by_type = AAZStrType(
512+
serialized_name="createdByType",
513+
)
514+
system_data.last_modified_at = AAZStrType(
515+
serialized_name="lastModifiedAt",
516+
)
517+
system_data.last_modified_by = AAZStrType(
518+
serialized_name="lastModifiedBy",
519+
)
520+
system_data.last_modified_by_type = AAZStrType(
521+
serialized_name="lastModifiedByType",
522+
)
523+
498524
return cls._schema_on_200_201
499525

500526

src/storage-preview/azext_storage_preview/aaz/latest/storage/account/task_assignment/_delete.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class Delete(AAZCommand):
2323
"""
2424

2525
_aaz_info = {
26-
"version": "2024-01-01",
26+
"version": "2025-08-01",
2727
"resources": [
28-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/storagetaskassignments/{}", "2024-01-01"],
28+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/storagetaskassignments/{}", "2025-08-01"],
2929
]
3030
}
3131

@@ -66,7 +66,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6666
required=True,
6767
id_part="child_name_1",
6868
fmt=AAZStrArgFormat(
69-
pattern="^[a-z0-9]{3,24}$",
69+
pattern="^[a-z][a-z0-9]{2,23}$",
7070
max_length=24,
7171
min_length=3,
7272
),
@@ -98,7 +98,7 @@ def __call__(self, *args, **kwargs):
9898
session,
9999
self.on_200_201,
100100
self.on_error,
101-
lro_options={"final-state-via": "azure-async-operation"},
101+
lro_options={"final-state-via": "location"},
102102
path_format_arguments=self.url_parameters,
103103
)
104104
if session.http_response.status_code in [204]:
@@ -107,7 +107,7 @@ def __call__(self, *args, **kwargs):
107107
session,
108108
self.on_204,
109109
self.on_error,
110-
lro_options={"final-state-via": "azure-async-operation"},
110+
lro_options={"final-state-via": "location"},
111111
path_format_arguments=self.url_parameters,
112112
)
113113
if session.http_response.status_code in [200, 201]:
@@ -116,7 +116,7 @@ def __call__(self, *args, **kwargs):
116116
session,
117117
self.on_200_201,
118118
self.on_error,
119-
lro_options={"final-state-via": "azure-async-operation"},
119+
lro_options={"final-state-via": "location"},
120120
path_format_arguments=self.url_parameters,
121121
)
122122

@@ -135,7 +135,7 @@ def method(self):
135135

136136
@property
137137
def error_format(self):
138-
return "MgmtErrorFormat"
138+
return "ODataV4Format"
139139

140140
@property
141141
def url_parameters(self):
@@ -163,7 +163,7 @@ def url_parameters(self):
163163
def query_parameters(self):
164164
parameters = {
165165
**self.serialize_query_param(
166-
"api-version", "2024-01-01",
166+
"api-version", "2025-08-01",
167167
required=True,
168168
),
169169
}

src/storage-preview/azext_storage_preview/aaz/latest/storage/account/task_assignment/_list.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class List(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-01-01",
25+
"version": "2025-08-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/storagetaskassignments", "2024-01-01"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/storagetaskassignments", "2025-08-01"],
2828
]
2929
}
3030

@@ -106,7 +106,7 @@ def method(self):
106106

107107
@property
108108
def error_format(self):
109-
return "MgmtErrorFormat"
109+
return "ODataV4Format"
110110

111111
@property
112112
def url_parameters(self):
@@ -130,10 +130,10 @@ def url_parameters(self):
130130
def query_parameters(self):
131131
parameters = {
132132
**self.serialize_query_param(
133-
"$maxpagesize", self.ctx.args.maxpagesize,
133+
"$top", self.ctx.args.maxpagesize,
134134
),
135135
**self.serialize_query_param(
136-
"api-version", "2024-01-01",
136+
"api-version", "2025-08-01",
137137
required=True,
138138
),
139139
}
@@ -168,7 +168,6 @@ def _build_schema_on_200(cls):
168168
_schema_on_200 = cls._schema_on_200
169169
_schema_on_200.next_link = AAZStrType(
170170
serialized_name="nextLink",
171-
flags={"read_only": True},
172171
)
173172
_schema_on_200.value = AAZListType(
174173
flags={"read_only": True},
@@ -184,8 +183,10 @@ def _build_schema_on_200(cls):
184183
_element.name = AAZStrType(
185184
flags={"read_only": True},
186185
)
187-
_element.properties = AAZObjectType(
188-
flags={"required": True},
186+
_element.properties = AAZObjectType()
187+
_element.system_data = AAZObjectType(
188+
serialized_name="systemData",
189+
flags={"read_only": True},
189190
)
190191
_element.type = AAZStrType(
191192
flags={"read_only": True},
@@ -321,6 +322,26 @@ def _build_schema_on_200(cls):
321322
flags={"read_only": True},
322323
)
323324

325+
system_data = cls._schema_on_200.value.Element.system_data
326+
system_data.created_at = AAZStrType(
327+
serialized_name="createdAt",
328+
)
329+
system_data.created_by = AAZStrType(
330+
serialized_name="createdBy",
331+
)
332+
system_data.created_by_type = AAZStrType(
333+
serialized_name="createdByType",
334+
)
335+
system_data.last_modified_at = AAZStrType(
336+
serialized_name="lastModifiedAt",
337+
)
338+
system_data.last_modified_by = AAZStrType(
339+
serialized_name="lastModifiedBy",
340+
)
341+
system_data.last_modified_by_type = AAZStrType(
342+
serialized_name="lastModifiedByType",
343+
)
344+
324345
return cls._schema_on_200
325346

326347

0 commit comments

Comments
 (0)