[HORIZONDB] Add private endpoint CLI commands#10043
Conversation
Add HorizonDB-specific private link resource and private endpoint connection commands to the preview extension. Update the vendored SDK PEC update/delete route shape to match the cluster-scoped backend contract and add targeted coverage for route generation and ID validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
❌Azure CLI Extensions Breaking Change Test
|
There was a problem hiding this comment.
Pull request overview
This PR adds Azure HorizonDB CLI support for managing private endpoint connections and private link resources, including wiring new command groups into the extension, updating the vendored SDK request shapes to the cluster-scoped backend contract, and adding targeted validation/tests.
Changes:
- Add
az horizondb private-endpoint-connectioncommands (list/show/approve/reject/delete) andaz horizondb private-link-resourcecommands (list/show). - Update vendored SDK private endpoint connection update/delete to use cluster-scoped routes (and update = PUT).
- Add
--idparsing/validation for private endpoint connection resource IDs plus targeted unit tests; bump extension version and update docs/help/history.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/horizondb/setup.py | Bump extension version to 1.0.0b4. |
| src/horizondb/README.md | Document new private endpoint/private link command groups. |
| src/horizondb/HISTORY.rst | Add 1.0.0b4 release notes for the new commands. |
| src/horizondb/azext_horizondb/vendored_sdks/operations/_operations.py | Update private endpoint connection update/delete request builders + operation signatures to include cluster_name and use cluster-scoped routes (PUT for update). |
| src/horizondb/azext_horizondb/vendored_sdks/aio/operations/_operations.py | Propagate cluster_name into async private endpoint connection update/delete operation flows. |
| src/horizondb/azext_horizondb/utils/validators.py | Add validator to parse/validate --id for cluster-scoped private endpoint connection IDs and populate RG/cluster/connection name. |
| src/horizondb/azext_horizondb/tests/latest/test_horizondb_private_endpoint_commands.py | Add unit tests for ID parsing, request shape changes, and CLI argument required-ness. |
| src/horizondb/azext_horizondb/commands/private_endpoint_commands.py | Add approve/reject helpers and a private link resource get wrapper. |
| src/horizondb/azext_horizondb/cluster_commands.py | Register new command groups and bind SDK/custom handlers + validators. |
| src/horizondb/azext_horizondb/_params.py | Add parameters for private endpoint connection (--connection-name, --id, --description) and private link resource (--group-name). |
| src/horizondb/azext_horizondb/_help.py | Add help entries and examples for the new command groups/commands. |
| src/horizondb/azext_horizondb/_client_factory.py | Add client factories for private endpoint connections and private link resources operation groups. |
| from azext_horizondb._client_factory import cf_horizondb_private_endpoint_connections | ||
| from azext_horizondb.vendored_sdks.models import ( | ||
| OptionalPropertiesUpdateableProperties, | ||
| PrivateEndpointConnectionUpdate, | ||
| PrivateLinkServiceConnectionState, | ||
| ) | ||
|
|
||
| private_endpoint_connections_client = cf_horizondb_private_endpoint_connections(cmd.cli_ctx, None) | ||
| private_endpoint_connections_client.get( | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| private_endpoint_connection_name=private_endpoint_connection_name) | ||
|
|
||
| new_status = 'Approved' if is_approved else 'Rejected' | ||
| state = PrivateLinkServiceConnectionState( | ||
| status=new_status, | ||
| description=description) | ||
| update = PrivateEndpointConnectionUpdate( | ||
| properties=OptionalPropertiesUpdateableProperties( | ||
| private_link_service_connection_state=state)) | ||
|
|
||
| return client.begin_update( | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| private_endpoint_connection_name=private_endpoint_connection_name, | ||
| properties=update) |
There was a problem hiding this comment.
Addressed in 7dc0907 by removing the extra GET before approve/reject; the command now relies on begin_update to surface service validation/errors.
|
HORIZONDB |
Remove the redundant private endpoint connection GET before approve/reject and add HorizonDB wait/list-command linter fixes. Extend targeted tests for command metadata. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| 'Required if --id is not specified.') | ||
| private_endpoint_connection_id_arg_type = CLIArgumentType( | ||
| options_list=['--id'], | ||
| help='The resource ID of the private endpoint connection associated with the HorizonDB cluster.') |
There was a problem hiding this comment.
'If specified --cluster-name/-c and --name/-n, this should be omitted.'
There was a problem hiding this comment.
Addressed in 7071881 by updating the --id help to reference --cluster-name/-c and --name/-n.
| scopes=['horizondb'])) | ||
| cluster_name_no_id_arg_type = CLIArgumentType( | ||
| metavar='NAME', | ||
| options_list=['--name', '-n'], |
There was a problem hiding this comment.
Should be '--cluster-name'
cluster_name_resource_arg_type = CLIArgumentType(
metavar='NAME',
options_list=['--cluster-name', '-c'],
id_part='name',
help="Name of the cluster.",
local_context_attribute=LocalContextAttribute(
name='cluster_name',
actions=[LocalContextAction.SET, LocalContextAction.GET],
scopes=['horizondb']))
There was a problem hiding this comment.
Addressed in 7071881 by changing the child command cluster argument to --cluster-name/-c.
| """ | ||
|
|
||
|
|
||
| helps['horizondb wait'] = """ |
There was a problem hiding this comment.
unnecessary addition by AI, will remove
There was a problem hiding this comment.
Addressed in 7071881 by removing the added wait command. The pre-existing update --no-wait linter finding is now handled with a linter exclusion.
| short-summary: List private endpoint connections for a HorizonDB cluster. | ||
| examples: | ||
| - name: List private endpoint connections for a HorizonDB cluster. | ||
| text: az horizondb private-endpoint-connection list --resource-group exampleresourcegroup --name examplecluster |
There was a problem hiding this comment.
Addressed in 7071881 by updating the help example to use --cluster-name.
| short-summary: Show details of a HorizonDB private endpoint connection. | ||
| examples: | ||
| - name: Show a private endpoint connection by cluster and connection name. | ||
| text: az horizondb private-endpoint-connection show --resource-group exampleresourcegroup --name examplecluster --connection-name exampleconnection |
There was a problem hiding this comment.
--cluster-name examplecluster --name exampleconnection
There was a problem hiding this comment.
Addressed in 7071881 by updating examples to use --cluster-name for the cluster and --name for the private endpoint connection.
| options_list=['--parameter-group'], | ||
| help='The resource ID of the parameter group.') | ||
| private_endpoint_connection_name_arg_type = CLIArgumentType( | ||
| options_list=['--connection-name'], |
There was a problem hiding this comment.
Addressed in 7071881 by changing the private endpoint connection name argument to --name/-n.
|
|
||
| class HorizonDBPrivateEndpointCommandTests(unittest.TestCase): | ||
|
|
||
| def test_private_endpoint_connection_id_commands_do_not_require_resource_group_at_parse_time(self): |
There was a problem hiding this comment.
Integration test should follow similarly to how we have for Flexible Server. Please update and include recordings. For authoring support check: https://github.com/Azure/azure-cli/blob/dev/doc/authoring_tests.md
There was a problem hiding this comment.
Addressed in 7071881 by adding a replayable ScenarioTest and recording for private-link-resource list/show and private-endpoint-connection list/show/approve/reject/delete.
| async def _update_initial( | ||
| self, | ||
| resource_group_name: str, | ||
| cluster_name: str, |
There was a problem hiding this comment.
For awareness, bug has been reported to SDK team for this: Azure/azure-sdk-for-python#47688
There was a problem hiding this comment.
Thanks. Kept the vendored SDK route fix in this PR since it is required for these commands to call the cluster-scoped HorizonDB backend route.
Update child command arguments to use --cluster-name and --name, remove the added wait command, add a linter exclusion for the pre-existing update --no-wait behavior, and add a recorded scenario test for the HorizonDB private endpoint command surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@Pan-Qi Please review and merge this PR. Thank you |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Related command
az horizondb private-endpoint-connectionaz horizondb private-link-resourceSummary
list,show,approve,reject, anddelete.listandshow.Validation
python -m unittest discover -s src\horizondb\azext_horizondb\tests\latest -p test_horizondb_private_endpoint_commands.pyazdev test test_horizondb_private_endpoint_command_scenario --discoverpython -m compileall -q src\horizondb\azext_horizondbazdev style horizondbazdev linter horizondb --min-severity mediumgit diff --checkpython scripts\ci\test_index.py -qGeneral Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (azdevrequired; see.azure-pipelines/templates/azdev_setup.ymlfor the install command untilazdev==0.2.11b1is on PyPI)For new extensions: