Skip to content

Conversation

@emmeliaAra
Copy link
Member


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI review requested due to automatic review settings June 13, 2025 21:16
@azure-client-tools-bot-prd
Copy link

Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link

Hi @emmeliaAra,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 13, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@emmeliaAra emmeliaAra requested review from D-Alegria and jkapil June 13, 2025 21:17
@github-actions
Copy link

CodeGen Tools Feedback Collection

Thank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds the CloudHSM extension for Azure CLI (API version 2025-03-31), including new commands for cluster management, backup/restore operations, and wait/show/delete actions.

  • Introduces backup start/show and restore start/show commands with LRO support.
  • Defines main cloudhsm command group and subgroups for backup, restore, and wait.
  • Adds basic README and HISTORY entries for the new extension.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
azext_cloudhsm/aaz/latest/cloudhsm/backup/_start.py Defines az cloudhsm backup start command
azext_cloudhsm/aaz/latest/cloudhsm/backup/_show.py Implements az cloudhsm backup show command
azext_cloudhsm/aaz/latest/cloudhsm/restore/_start.py Defines az cloudhsm restore start command
azext_cloudhsm/aaz/latest/cloudhsm/restore/_show.py Implements az cloudhsm restore show command
azext_cloudhsm/aaz/latest/cloudhsm/_wait.py Implements az cloudhsm wait command
azext_cloudhsm/aaz/latest/cloudhsm/_show.py Implements az cloudhsm show command
azext_cloudhsm/aaz/latest/cloudhsm/_delete.py Implements az cloudhsm delete command
src/cloudhsm/README.md Adds placeholder usage instructions
src/cloudhsm/HISTORY.rst Adds initial release history
Comments suppressed due to low confidence (1)

src/cloudhsm/azext_cloudhsm/aaz/latest/cloudhsm/backup/_start.py:14

  • There are no existing CLI tests for az cloudhsm backup start. Consider adding functional tests to validate LRO polling behavior and output deserialization.
@register_command(

# define Arg Group "BackupRequestProperties"

_args_schema = cls._args_schema
_args_schema.blob_container_uri = AAZStrArg(
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

The --blob-container-uri argument is required for the backup command but required=True is missing. Please add required=True to ensure the CLI enforces this input.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

From the Swagger this property is required. however during flattening this property became optional. To enforce this property in the custom.py file I set args_schema_backup.blob_container_uri._required = True.

I did not modify the files generated automatically as per the guidelines. Do I update the start.py file or can we ignore this message ?

https://github.com/Azure/azure-rest-api-specs/blob/292e6eee612b2a1b0bc558fec33bcbca9acb590e/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2025-03-31/cloudhsm.json#L1404

image

Comment on lines +200 to +202
pass


Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

The on_202 callback is empty, so HTTP 202 responses will not populate or return any output. Consider handling in-progress status similar to on_200 or returning a meaningful placeholder.

Suggested change
pass
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_202
)
_schema_on_202 = None
@classmethod
def _build_schema_on_202(cls):
if cls._schema_on_202 is not None:
return cls._schema_on_202
cls._schema_on_202 = AAZObjectType()
_schema_on_202 = cls._schema_on_202
_schema_on_202.properties = AAZObjectType()
properties = cls._schema_on_202.properties
properties.status = AAZStrType(
serialized_name="status",
nullable=True,
flags={"read_only": True},
)
properties.message = AAZStrType(
serialized_name="message",
nullable=True,
flags={"read_only": True},
)
return cls._schema_on_202

Copilot uses AI. Check for mistakes.
return cls._schema_on_200

def on_202(self, session):
pass
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

The on_202 callback is a no-op, so intermediate HTTP 202 statuses in the backup show command aren’t surfaced. You may want to mirror on_200 behavior or explicitly indicate a pending state.

Suggested change
pass
data = self.deserialize_http_content(session)
self.ctx.set_var(
"pending_status",
{
"message": "The backup operation is still in progress.",
"details": data
}
)

Copilot uses AI. Check for mistakes.
@github-actions
Copy link


from knack.log import get_logger
from .aaz.latest.cloudhsm._create import Create as _CloudHsmCreate
from .aaz.latest.cloudhsm.backup._start import Start as _CloudHsmBackupStart
Copy link

Choose a reason for hiding this comment

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

does this also need to contain _CloudHsmRestoreStart

@jsntcy jsntcy requested a review from necusjz June 16, 2025 23:22
@jsntcy
Copy link
Member

jsntcy commented Jun 16, 2025

@necusjz, could you please help review this PR?

@necusjz
Copy link
Member

necusjz commented Jun 17, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@necusjz
Copy link
Member

necusjz commented Jun 17, 2025

plz provide the link of your pull request in Azure/aaz.

@emmeliaAra
Copy link
Member Author

plz provide the link of your pull request in Azure/aaz.

@necusjz PR in AAZ repo: https://github.com/Azure/aaz/pull/790

@necusjz necusjz closed this Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants