Skip to content

Commit 103ff5e

Browse files
authored
{Storage Actions} Migrate to TypeSpec based module (#9579)
* chore: add tsp generation * test: rerun test cases * docs: update changelog
1 parent 6372fe6 commit 103ff5e

File tree

12 files changed

+1288
-462
lines changed

12 files changed

+1288
-462
lines changed

src/storage-actions/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
33
Release History
44
===============
5+
1.1.0
6+
++++++
7+
* Migrated to TypeSpec based module.
8+
59
1.0.0
610
++++++
711
* GA Storage Actions with api-version 2023-01-01

src/storage-actions/azext_storage_actions/aaz/latest/storage_actions/task/_create.py

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
158158

159159
operations = cls._args_schema.action.else_.operations
160160
operations.Element = AAZObjectArg()
161-
cls._build_args_storage_task_operation_create(operations.Element)
161+
cls._build_args_storagetaskoperation_create_or_update_create(operations.Element)
162162

163163
if_ = cls._args_schema.action.if_
164164
if_.condition = AAZStrArg(
@@ -174,51 +174,51 @@ def _build_arguments_schema(cls, *args, **kwargs):
174174

175175
operations = cls._args_schema.action.if_.operations
176176
operations.Element = AAZObjectArg()
177-
cls._build_args_storage_task_operation_create(operations.Element)
177+
cls._build_args_storagetaskoperation_create_or_update_create(operations.Element)
178178
return cls._args_schema
179179

180-
_args_storage_task_operation_create = None
180+
_args_storagetaskoperation_create_or_update_create = None
181181

182182
@classmethod
183-
def _build_args_storage_task_operation_create(cls, _schema):
184-
if cls._args_storage_task_operation_create is not None:
185-
_schema.name = cls._args_storage_task_operation_create.name
186-
_schema.on_failure = cls._args_storage_task_operation_create.on_failure
187-
_schema.on_success = cls._args_storage_task_operation_create.on_success
188-
_schema.parameters = cls._args_storage_task_operation_create.parameters
183+
def _build_args_storagetaskoperation_create_or_update_create(cls, _schema):
184+
if cls._args_storagetaskoperation_create_or_update_create is not None:
185+
_schema.name = cls._args_storagetaskoperation_create_or_update_create.name
186+
_schema.on_failure = cls._args_storagetaskoperation_create_or_update_create.on_failure
187+
_schema.on_success = cls._args_storagetaskoperation_create_or_update_create.on_success
188+
_schema.parameters = cls._args_storagetaskoperation_create_or_update_create.parameters
189189
return
190190

191-
cls._args_storage_task_operation_create = AAZObjectArg()
191+
cls._args_storagetaskoperation_create_or_update_create = AAZObjectArg()
192192

193-
storage_task_operation_create = cls._args_storage_task_operation_create
194-
storage_task_operation_create.name = AAZStrArg(
193+
storagetaskoperation_create_or_update_create = cls._args_storagetaskoperation_create_or_update_create
194+
storagetaskoperation_create_or_update_create.name = AAZStrArg(
195195
options=["name"],
196196
help="The operation to be performed on the object.",
197197
required=True,
198198
enum={"DeleteBlob": "DeleteBlob", "SetBlobExpiry": "SetBlobExpiry", "SetBlobImmutabilityPolicy": "SetBlobImmutabilityPolicy", "SetBlobLegalHold": "SetBlobLegalHold", "SetBlobTags": "SetBlobTags", "SetBlobTier": "SetBlobTier", "UndeleteBlob": "UndeleteBlob"},
199199
)
200-
storage_task_operation_create.on_failure = AAZStrArg(
200+
storagetaskoperation_create_or_update_create.on_failure = AAZStrArg(
201201
options=["on-failure"],
202202
help="Action to be taken when the operation fails for a object.",
203203
enum={"break": "break"},
204204
)
205-
storage_task_operation_create.on_success = AAZStrArg(
205+
storagetaskoperation_create_or_update_create.on_success = AAZStrArg(
206206
options=["on-success"],
207207
help="Action to be taken when the operation is successful for a object.",
208208
enum={"continue": "continue"},
209209
)
210-
storage_task_operation_create.parameters = AAZDictArg(
210+
storagetaskoperation_create_or_update_create.parameters = AAZDictArg(
211211
options=["parameters"],
212212
help="Key-value parameters for the operation.",
213213
)
214214

215-
parameters = cls._args_storage_task_operation_create.parameters
215+
parameters = cls._args_storagetaskoperation_create_or_update_create.parameters
216216
parameters.Element = AAZStrArg()
217217

218-
_schema.name = cls._args_storage_task_operation_create.name
219-
_schema.on_failure = cls._args_storage_task_operation_create.on_failure
220-
_schema.on_success = cls._args_storage_task_operation_create.on_success
221-
_schema.parameters = cls._args_storage_task_operation_create.parameters
218+
_schema.name = cls._args_storagetaskoperation_create_or_update_create.name
219+
_schema.on_failure = cls._args_storagetaskoperation_create_or_update_create.on_failure
220+
_schema.on_success = cls._args_storagetaskoperation_create_or_update_create.on_success
221+
_schema.parameters = cls._args_storagetaskoperation_create_or_update_create.parameters
222222

223223
def _execute_operations(self):
224224
self.pre_operations()
@@ -363,7 +363,7 @@ def content(self):
363363

364364
operations = _builder.get(".properties.action.else.operations")
365365
if operations is not None:
366-
_CreateHelper._build_schema_storage_task_operation_create(operations.set_elements(AAZObjectType, "."))
366+
_CreateHelper._build_schema_storagetaskoperation_create_or_update_create(operations.set_elements(AAZObjectType, "."))
367367

368368
if_ = _builder.get(".properties.action.if")
369369
if if_ is not None:
@@ -372,7 +372,7 @@ def content(self):
372372

373373
operations = _builder.get(".properties.action.if.operations")
374374
if operations is not None:
375-
_CreateHelper._build_schema_storage_task_operation_create(operations.set_elements(AAZObjectType, "."))
375+
_CreateHelper._build_schema_storagetaskoperation_create_or_update_create(operations.set_elements(AAZObjectType, "."))
376376

377377
tags = _builder.get(".tags")
378378
if tags is not None:
@@ -489,7 +489,7 @@ def _build_schema_on_200_201(cls):
489489

490490
operations = cls._schema_on_200_201.properties.action["else"].operations
491491
operations.Element = AAZObjectType()
492-
_CreateHelper._build_schema_storage_task_operation_read(operations.Element)
492+
_CreateHelper._build_schema_storagetaskoperation_read(operations.Element)
493493

494494
if_ = cls._schema_on_200_201.properties.action["if"]
495495
if_.condition = AAZStrType(
@@ -501,7 +501,7 @@ def _build_schema_on_200_201(cls):
501501

502502
operations = cls._schema_on_200_201.properties.action["if"].operations
503503
operations.Element = AAZObjectType()
504-
_CreateHelper._build_schema_storage_task_operation_read(operations.Element)
504+
_CreateHelper._build_schema_storagetaskoperation_read(operations.Element)
505505

506506
system_data = cls._schema_on_200_201.system_data
507507
system_data.created_at = AAZStrType(
@@ -533,7 +533,7 @@ class _CreateHelper:
533533
"""Helper class for Create"""
534534

535535
@classmethod
536-
def _build_schema_storage_task_operation_create(cls, _builder):
536+
def _build_schema_storagetaskoperation_create_or_update_create(cls, _builder):
537537
if _builder is None:
538538
return
539539
_builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}})
@@ -545,38 +545,38 @@ def _build_schema_storage_task_operation_create(cls, _builder):
545545
if parameters is not None:
546546
parameters.set_elements(AAZStrType, ".")
547547

548-
_schema_storage_task_operation_read = None
548+
_schema_storagetaskoperation_read = None
549549

550550
@classmethod
551-
def _build_schema_storage_task_operation_read(cls, _schema):
552-
if cls._schema_storage_task_operation_read is not None:
553-
_schema.name = cls._schema_storage_task_operation_read.name
554-
_schema.on_failure = cls._schema_storage_task_operation_read.on_failure
555-
_schema.on_success = cls._schema_storage_task_operation_read.on_success
556-
_schema.parameters = cls._schema_storage_task_operation_read.parameters
551+
def _build_schema_storagetaskoperation_read(cls, _schema):
552+
if cls._schema_storagetaskoperation_read is not None:
553+
_schema.name = cls._schema_storagetaskoperation_read.name
554+
_schema.on_failure = cls._schema_storagetaskoperation_read.on_failure
555+
_schema.on_success = cls._schema_storagetaskoperation_read.on_success
556+
_schema.parameters = cls._schema_storagetaskoperation_read.parameters
557557
return
558558

559-
cls._schema_storage_task_operation_read = _schema_storage_task_operation_read = AAZObjectType()
559+
cls._schema_storagetaskoperation_read = _schema_storagetaskoperation_read = AAZObjectType()
560560

561-
storage_task_operation_read = _schema_storage_task_operation_read
562-
storage_task_operation_read.name = AAZStrType(
561+
storagetaskoperation_read = _schema_storagetaskoperation_read
562+
storagetaskoperation_read.name = AAZStrType(
563563
flags={"required": True},
564564
)
565-
storage_task_operation_read.on_failure = AAZStrType(
565+
storagetaskoperation_read.on_failure = AAZStrType(
566566
serialized_name="onFailure",
567567
)
568-
storage_task_operation_read.on_success = AAZStrType(
568+
storagetaskoperation_read.on_success = AAZStrType(
569569
serialized_name="onSuccess",
570570
)
571-
storage_task_operation_read.parameters = AAZDictType()
571+
storagetaskoperation_read.parameters = AAZDictType()
572572

573-
parameters = _schema_storage_task_operation_read.parameters
573+
parameters = _schema_storagetaskoperation_read.parameters
574574
parameters.Element = AAZStrType()
575575

576-
_schema.name = cls._schema_storage_task_operation_read.name
577-
_schema.on_failure = cls._schema_storage_task_operation_read.on_failure
578-
_schema.on_success = cls._schema_storage_task_operation_read.on_success
579-
_schema.parameters = cls._schema_storage_task_operation_read.parameters
576+
_schema.name = cls._schema_storagetaskoperation_read.name
577+
_schema.on_failure = cls._schema_storagetaskoperation_read.on_failure
578+
_schema.on_success = cls._schema_storagetaskoperation_read.on_success
579+
_schema.parameters = cls._schema_storagetaskoperation_read.parameters
580580

581581

582582
__all__ = ["Create"]

src/storage-actions/azext_storage_actions/aaz/latest/storage_actions/task/_list.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _build_schema_on_200(cls):
248248

249249
operations = cls._schema_on_200.value.Element.properties.action["else"].operations
250250
operations.Element = AAZObjectType()
251-
_ListHelper._build_schema_storage_task_operation_read(operations.Element)
251+
_ListHelper._build_schema_storagetaskoperation_read(operations.Element)
252252

253253
if_ = cls._schema_on_200.value.Element.properties.action["if"]
254254
if_.condition = AAZStrType(
@@ -260,7 +260,7 @@ def _build_schema_on_200(cls):
260260

261261
operations = cls._schema_on_200.value.Element.properties.action["if"].operations
262262
operations.Element = AAZObjectType()
263-
_ListHelper._build_schema_storage_task_operation_read(operations.Element)
263+
_ListHelper._build_schema_storagetaskoperation_read(operations.Element)
264264

265265
system_data = cls._schema_on_200.value.Element.system_data
266266
system_data.created_at = AAZStrType(
@@ -467,7 +467,7 @@ def _build_schema_on_200(cls):
467467

468468
operations = cls._schema_on_200.value.Element.properties.action["else"].operations
469469
operations.Element = AAZObjectType()
470-
_ListHelper._build_schema_storage_task_operation_read(operations.Element)
470+
_ListHelper._build_schema_storagetaskoperation_read(operations.Element)
471471

472472
if_ = cls._schema_on_200.value.Element.properties.action["if"]
473473
if_.condition = AAZStrType(
@@ -479,7 +479,7 @@ def _build_schema_on_200(cls):
479479

480480
operations = cls._schema_on_200.value.Element.properties.action["if"].operations
481481
operations.Element = AAZObjectType()
482-
_ListHelper._build_schema_storage_task_operation_read(operations.Element)
482+
_ListHelper._build_schema_storagetaskoperation_read(operations.Element)
483483

484484
system_data = cls._schema_on_200.value.Element.system_data
485485
system_data.created_at = AAZStrType(
@@ -510,38 +510,38 @@ def _build_schema_on_200(cls):
510510
class _ListHelper:
511511
"""Helper class for List"""
512512

513-
_schema_storage_task_operation_read = None
513+
_schema_storagetaskoperation_read = None
514514

515515
@classmethod
516-
def _build_schema_storage_task_operation_read(cls, _schema):
517-
if cls._schema_storage_task_operation_read is not None:
518-
_schema.name = cls._schema_storage_task_operation_read.name
519-
_schema.on_failure = cls._schema_storage_task_operation_read.on_failure
520-
_schema.on_success = cls._schema_storage_task_operation_read.on_success
521-
_schema.parameters = cls._schema_storage_task_operation_read.parameters
516+
def _build_schema_storagetaskoperation_read(cls, _schema):
517+
if cls._schema_storagetaskoperation_read is not None:
518+
_schema.name = cls._schema_storagetaskoperation_read.name
519+
_schema.on_failure = cls._schema_storagetaskoperation_read.on_failure
520+
_schema.on_success = cls._schema_storagetaskoperation_read.on_success
521+
_schema.parameters = cls._schema_storagetaskoperation_read.parameters
522522
return
523523

524-
cls._schema_storage_task_operation_read = _schema_storage_task_operation_read = AAZObjectType()
524+
cls._schema_storagetaskoperation_read = _schema_storagetaskoperation_read = AAZObjectType()
525525

526-
storage_task_operation_read = _schema_storage_task_operation_read
527-
storage_task_operation_read.name = AAZStrType(
526+
storagetaskoperation_read = _schema_storagetaskoperation_read
527+
storagetaskoperation_read.name = AAZStrType(
528528
flags={"required": True},
529529
)
530-
storage_task_operation_read.on_failure = AAZStrType(
530+
storagetaskoperation_read.on_failure = AAZStrType(
531531
serialized_name="onFailure",
532532
)
533-
storage_task_operation_read.on_success = AAZStrType(
533+
storagetaskoperation_read.on_success = AAZStrType(
534534
serialized_name="onSuccess",
535535
)
536-
storage_task_operation_read.parameters = AAZDictType()
536+
storagetaskoperation_read.parameters = AAZDictType()
537537

538-
parameters = _schema_storage_task_operation_read.parameters
538+
parameters = _schema_storagetaskoperation_read.parameters
539539
parameters.Element = AAZStrType()
540540

541-
_schema.name = cls._schema_storage_task_operation_read.name
542-
_schema.on_failure = cls._schema_storage_task_operation_read.on_failure
543-
_schema.on_success = cls._schema_storage_task_operation_read.on_success
544-
_schema.parameters = cls._schema_storage_task_operation_read.parameters
541+
_schema.name = cls._schema_storagetaskoperation_read.name
542+
_schema.on_failure = cls._schema_storagetaskoperation_read.on_failure
543+
_schema.on_success = cls._schema_storagetaskoperation_read.on_success
544+
_schema.parameters = cls._schema_storagetaskoperation_read.parameters
545545

546546

547547
__all__ = ["List"]

src/storage-actions/azext_storage_actions/aaz/latest/storage_actions/task/_list_assignment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6666

6767
def _execute_operations(self):
6868
self.pre_operations()
69-
self.StorageTaskAssignmentList(ctx=self.ctx)()
69+
self.StorageTasksList(ctx=self.ctx)()
7070
self.post_operations()
7171

7272
@register_callback
@@ -82,7 +82,7 @@ def _output(self, *args, **kwargs):
8282
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
8383
return result, next_link
8484

85-
class StorageTaskAssignmentList(AAZHttpOperation):
85+
class StorageTasksList(AAZHttpOperation):
8686
CLIENT_TYPE = "MgmtClient"
8787

8888
def __call__(self, *args, **kwargs):

src/storage-actions/azext_storage_actions/aaz/latest/storage_actions/task/_list_report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
7070

7171
def _execute_operations(self):
7272
self.pre_operations()
73-
self.StorageTasksReportList(ctx=self.ctx)()
73+
self.StorageTasksList(ctx=self.ctx)()
7474
self.post_operations()
7575

7676
@register_callback
@@ -86,7 +86,7 @@ def _output(self, *args, **kwargs):
8686
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
8787
return result, next_link
8888

89-
class StorageTasksReportList(AAZHttpOperation):
89+
class StorageTasksList(AAZHttpOperation):
9090
CLIENT_TYPE = "MgmtClient"
9191

9292
def __call__(self, *args, **kwargs):

0 commit comments

Comments
 (0)