Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/storage-actions/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Release History
===============
1.0.0
++++++
* GA Storage Actions with api-version 2023-01-01

1.0.0b1
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command_group(
"storage-actions",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Manage StorageActions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command_group(
"storage-actions task",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Manage StorageTask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task create",
is_preview=True,
)
class Create(AAZCommand):
"""Create a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create request is issued with the exact same set of properties, the request will succeed.
Expand Down Expand Up @@ -84,17 +83,30 @@ def _build_arguments_schema(cls, *args, **kwargs):
)

identity = cls._args_schema.identity
identity.mi_system_assigned = AAZStrArg(
options=["system-assigned", "mi-system-assigned"],
help="Set the system managed identity.",
blank="True",
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank parameter is set to the string "True"; to correctly indicate a blank default, consider using the boolean True rather than a string.

Suggested change
blank="True",
blank=True,

Copilot uses AI. Check for mistakes.
)
identity.type = AAZStrArg(
options=["type"],
help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).",
required=True,
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"},
)
identity.mi_user_assigned = AAZListArg(
options=["user-assigned", "mi-user-assigned"],
help="Set the user managed identities.",
blank=[],
)
identity.user_assigned_identities = AAZDictArg(
options=["user-assigned-identities"],
help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.",
)

mi_user_assigned = cls._args_schema.identity.mi_user_assigned
mi_user_assigned.Element = AAZStrArg()

user_assigned_identities = cls._args_schema.identity.user_assigned_identities
user_assigned_identities.Element = AAZObjectArg(
nullable=True,
Expand Down Expand Up @@ -237,7 +249,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200, 201]:
Expand All @@ -246,7 +258,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)

Expand Down Expand Up @@ -314,7 +326,7 @@ def content(self):
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("identity", AAZObjectType, ".identity", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("identity", AAZIdentityObjectType, ".identity", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}})
_builder.set_prop("tags", AAZDictType, ".tags")
Expand All @@ -323,11 +335,17 @@ def content(self):
if identity is not None:
identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}})
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})

user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
if user_assigned_identities is not None:
user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True})

user_assigned = _builder.get(".identity.userAssigned")
if user_assigned is not None:
user_assigned.set_elements(AAZStrType, ".")

properties = _builder.get(".properties")
if properties is not None:
properties.set_prop("action", AAZObjectType, ".action", typ_kwargs={"flags": {"required": True}})
Expand Down Expand Up @@ -383,7 +401,7 @@ def _build_schema_on_200_201(cls):
_schema_on_200_201.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200_201.identity = AAZObjectType(
_schema_on_200_201.identity = AAZIdentityObjectType(
flags={"required": True},
)
_schema_on_200_201.location = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task delete",
is_preview=True,
confirmation="Are you sure you want to perform this operation?",
)
class Delete(AAZCommand):
Expand Down Expand Up @@ -88,7 +87,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [204]:
Expand All @@ -97,7 +96,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_204,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200, 201]:
Expand All @@ -106,7 +105,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task list",
is_preview=True,
)
class List(AAZCommand):
"""List all the storage tasks available under the subscription.
Expand Down Expand Up @@ -52,12 +51,12 @@ def _build_arguments_schema(cls, *args, **kwargs):

def _execute_operations(self):
self.pre_operations()
condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using has_value(...) is not True for boolean negation can be confusing; consider rewriting as not has_value(self.ctx.args.resource_group) for clarity.

Suggested change
condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
condition_0 = has_value(self.ctx.subscription_id) and not has_value(self.ctx.args.resource_group)

Copilot uses AI. Check for mistakes.
condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
if condition_0:
self.StorageTasksListByResourceGroup(ctx=self.ctx)()
if condition_1:
self.StorageTasksListBySubscription(ctx=self.ctx)()
if condition_1:
self.StorageTasksListByResourceGroup(ctx=self.ctx)()
self.post_operations()

@register_callback
Expand All @@ -73,7 +72,7 @@ def _output(self, *args, **kwargs):
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
return result, next_link

class StorageTasksListByResourceGroup(AAZHttpOperation):
class StorageTasksListBySubscription(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -87,7 +86,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks",
"/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks",
**self.url_parameters
)

Expand All @@ -102,10 +101,6 @@ def error_format(self):
@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
Expand Down Expand Up @@ -165,7 +160,7 @@ def _build_schema_on_200(cls):
_element.id = AAZStrType(
flags={"read_only": True},
)
_element.identity = AAZObjectType(
_element.identity = AAZIdentityObjectType(
flags={"required": True},
)
_element.location = AAZStrType(
Expand Down Expand Up @@ -292,7 +287,7 @@ def _build_schema_on_200(cls):

return cls._schema_on_200

class StorageTasksListBySubscription(AAZHttpOperation):
class StorageTasksListByResourceGroup(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -306,7 +301,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks",
**self.url_parameters
)

Expand All @@ -321,6 +316,10 @@ def error_format(self):
@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
Expand Down Expand Up @@ -380,7 +379,7 @@ def _build_schema_on_200(cls):
_element.id = AAZStrType(
flags={"read_only": True},
)
_element.identity = AAZObjectType(
_element.identity = AAZIdentityObjectType(
flags={"required": True},
)
_element.location = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task list-assignment",
is_preview=True,
)
class ListAssignment(AAZCommand):
"""List all the storage task assignments available under the given resource group.
Expand Down Expand Up @@ -59,7 +58,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
min_length=3,
),
)
_args_schema.maxpagesize = AAZStrArg(
_args_schema.maxpagesize = AAZIntArg(
options=["--maxpagesize"],
help="Optional, specifies the maximum number of storage task assignment Ids to be included in the list response.",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task list-report",
is_preview=True,
)
class ListReport(AAZCommand):
"""List the storage tasks run report summary for each assignment.
Expand Down Expand Up @@ -63,7 +62,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--filter"],
help="Optional. When specified, it can be used to query using reporting properties.",
)
_args_schema.maxpagesize = AAZStrArg(
_args_schema.maxpagesize = AAZIntArg(
options=["--maxpagesize"],
help="Optional, specifies the maximum number of storage task assignment Ids to be included in the list response.",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task preview-action",
is_preview=True,
)
class PreviewAction(AAZCommand):
"""Runs the input conditions against input object metadata properties and designates matched objects in response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task show",
is_preview=True,
)
class Show(AAZCommand):
"""Get the storage task properties
Expand Down Expand Up @@ -162,7 +161,7 @@ def _build_schema_on_200(cls):
_schema_on_200.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.identity = AAZObjectType(
_schema_on_200.identity = AAZIdentityObjectType(
flags={"required": True},
)
_schema_on_200.location = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@register_command(
"storage-actions task update",
is_preview=True,
)
class Update(AAZCommand):
"""Update a storage task resource with the specified parameters. If a storage task is already created and a subsequent update request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent update request is issued with the exact same set of properties, the request will succeed.
Expand Down Expand Up @@ -334,7 +333,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200, 201]:
Expand All @@ -343,7 +342,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)

Expand Down Expand Up @@ -444,7 +443,7 @@ def _update_instance(self, instance):
value=instance,
typ=AAZObjectType
)
_builder.set_prop("identity", AAZObjectType, ".identity", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("identity", AAZIdentityObjectType, ".identity", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}})
_builder.set_prop("tags", AAZDictType, ".tags")

Expand Down Expand Up @@ -570,7 +569,7 @@ def _build_schema_storage_task_read(cls, _schema):
storage_task_read.id = AAZStrType(
flags={"read_only": True},
)
storage_task_read.identity = AAZObjectType(
storage_task_read.identity = AAZIdentityObjectType(
flags={"required": True},
)
storage_task_read.location = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _build_schema_on_200(cls):
_schema_on_200.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.identity = AAZObjectType(
_schema_on_200.identity = AAZIdentityObjectType(
flags={"required": True},
)
_schema_on_200.location = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.57.0"
"azext.minCliCoreVersion": "2.70.0"
}
Loading
Loading