[HORIZONDB] az horizondb firewall-rule create/update/delete/show/list: Introduced firewall-rule commands for HorizonDB#9866
Conversation
…t`: Introduced firewall-rule commands for HorizonDB
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Hi @mattboentoro, |
|
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). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
Release SuggestionsModule: horizondb
Notes
|
There was a problem hiding this comment.
Pull request overview
Adds a new az horizondb firewall-rule command group (create/update/delete/show/list) to the HorizonDB CLI extension, wiring a new SDK client factory for firewall rules and registering the corresponding command handlers, parameters, and help entries.
Changes:
- New
commands/firewall_commands.pyimplementing create/update (read-modify-write via GET +begin_create_or_update), delete (with confirmation), and list handlers. - New client factory
cf_horizondb_firewall_rulesand command-table registration underhorizondb firewall-rule. - Argument definitions and help text for the new command group.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/horizondb/azext_horizondb/commands/firewall_commands.py | New custom command handlers for firewall rule CRUD operations. |
| src/horizondb/azext_horizondb/cluster_commands.py | Registers the new horizondb firewall-rule command group with SDK and custom command types. |
| src/horizondb/azext_horizondb/_params.py | Adds CLI argument types and contexts for firewall-rule commands. |
| src/horizondb/azext_horizondb/_help.py | Adds help/examples for the new firewall-rule commands. |
| src/horizondb/azext_horizondb/_client_factory.py | Adds cf_horizondb_firewall_rules factory returning the firewall rules operations group. |
Note: setup.py (VERSION) and HISTORY.rst were not updated in this PR even though the extension is gaining new public commands; please bump the version and add a changelog entry per the PR template.
| resource=resource) | ||
|
|
||
|
|
||
| def horizondb_firewall_rule_delete(cmd, client, resource_group_name, cluster_name, |
| def horizondb_firewall_rule_create(client, resource_group_name, cluster_name, | ||
| firewall_rule_name, start_ip_address, end_ip_address, | ||
| pool_name='default', | ||
| rule_description=None, no_wait=False): | ||
| from azext_horizondb.vendored_sdks.models import HorizonDbFirewallRule, HorizonDbFirewallRuleProperties | ||
|
|
||
| properties = HorizonDbFirewallRuleProperties( | ||
| start_ip_address=start_ip_address, | ||
| end_ip_address=end_ip_address, | ||
| description=rule_description, | ||
| ) | ||
|
|
||
| resource = HorizonDbFirewallRule( | ||
| properties=properties, | ||
| ) | ||
|
|
||
| return sdk_no_wait(no_wait, client.begin_create_or_update, | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| pool_name=pool_name, | ||
| firewall_rule_name=firewall_rule_name, | ||
| resource=resource) | ||
|
|
||
|
|
||
| def horizondb_firewall_rule_update(client, resource_group_name, cluster_name, | ||
| firewall_rule_name, pool_name='default', | ||
| start_ip_address=None, end_ip_address=None, | ||
| rule_description=None, no_wait=False): | ||
| from azext_horizondb.vendored_sdks.models import HorizonDbFirewallRule, HorizonDbFirewallRuleProperties | ||
|
|
||
| existing = client.get( | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| pool_name=pool_name, | ||
| firewall_rule_name=firewall_rule_name) | ||
|
|
||
| props = existing.properties | ||
| properties = HorizonDbFirewallRuleProperties( | ||
| start_ip_address=start_ip_address if start_ip_address is not None else props.start_ip_address, | ||
| end_ip_address=end_ip_address if end_ip_address is not None else props.end_ip_address, | ||
| description=rule_description if rule_description is not None else props.description, | ||
| ) | ||
|
|
||
| resource = HorizonDbFirewallRule( | ||
| properties=properties, | ||
| ) | ||
|
|
||
| return sdk_no_wait(no_wait, client.begin_create_or_update, | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| pool_name=pool_name, | ||
| firewall_rule_name=firewall_rule_name, | ||
| resource=resource) | ||
|
|
||
|
|
||
| def horizondb_firewall_rule_delete(cmd, client, resource_group_name, cluster_name, | ||
| firewall_rule_name, pool_name='default', | ||
| no_wait=False, yes=False): | ||
| if not yes: | ||
| user_confirmation( | ||
| "Are you sure you want to delete the firewall rule '{0}' for cluster '{1}' in resource group '{2}'".format( | ||
| firewall_rule_name, cluster_name, resource_group_name), yes=yes) | ||
| return sdk_no_wait(no_wait, client.begin_delete, | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| pool_name=pool_name, | ||
| firewall_rule_name=firewall_rule_name) | ||
|
|
||
|
|
||
| def horizondb_firewall_rule_list(client, resource_group_name, cluster_name, pool_name='default'): | ||
| return client.list( | ||
| resource_group_name=resource_group_name, | ||
| cluster_name=cluster_name, | ||
| pool_name=pool_name) |
| c.argument('start_ip_address', arg_type=start_ip_address_arg_type) | ||
| c.argument('end_ip_address', arg_type=end_ip_address_arg_type) |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)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.jsonautomatically.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.