-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[HorizonDB] Add parameter-group commands #10046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alxhghs
wants to merge
4
commits into
Azure:main
Choose a base branch
from
alxhghs:alexfen-horizondb-parameter-group-commands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a86d6de
horizondb: add parameter-group create/delete/list/show commands
bfac589
horizondb: address PR review feedback
f7151a3
horizondb: reuse generic version arg for parameter-group create
7c34c0a
Merge remote-tracking branch 'upstream/main' into alexfen-horizondb-p…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azure.cli.core.azclierror import ArgumentUsageError | ||
|
|
||
|
|
||
| def validate_parameters(cmd, namespace): # pylint: disable=unused-argument | ||
| if not namespace.parameters: | ||
| return | ||
|
|
||
| from azext_horizondb.vendored_sdks.models import ParameterProperties | ||
|
|
||
| parameter_list = [] | ||
| for item in namespace.parameters: | ||
| if '=' not in item: | ||
| raise ArgumentUsageError("Parameter '{}' must be in the format name=value.".format(item)) | ||
| name, value = item.split('=', 1) | ||
| parameter_list.append(ParameterProperties(name=name, value=value)) | ||
|
|
||
| namespace.parameters = parameter_list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/horizondb/azext_horizondb/commands/parameter_group_commands.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: disable=line-too-long, too-many-locals | ||
|
|
||
| from azure.cli.core.util import sdk_no_wait, user_confirmation | ||
|
|
||
|
|
||
| def horizondb_parameter_group_create(client, resource_group_name, parameter_group_name, location, | ||
| parameters=None, description=None, pg_version=None, | ||
| apply_immediately=None, tags=None, no_wait=False): | ||
| from azext_horizondb.vendored_sdks.models import ( | ||
| HorizonDbParameterGroup, | ||
| HorizonDbParameterGroupProperties, | ||
| ) | ||
|
|
||
| properties = HorizonDbParameterGroupProperties( | ||
| parameters=parameters, | ||
| description=description, | ||
| pg_version=pg_version, | ||
| apply_immediately=apply_immediately, | ||
| ) | ||
|
|
||
| resource = HorizonDbParameterGroup( | ||
| location=location, | ||
| tags=tags, | ||
| properties=properties, | ||
| ) | ||
|
|
||
| return sdk_no_wait(no_wait, client.begin_create_or_update, | ||
| resource_group_name=resource_group_name, | ||
| parameter_group_name=parameter_group_name, | ||
| resource=resource) | ||
|
|
||
|
|
||
| def horizondb_parameter_group_delete(client, resource_group_name, parameter_group_name, no_wait=False, yes=False): | ||
| if not yes: | ||
| user_confirmation( | ||
| "Are you sure you want to delete the parameter group '{0}' in resource group '{1}'".format( | ||
| parameter_group_name, resource_group_name), yes=yes) | ||
| return sdk_no_wait(no_wait, client.begin_delete, | ||
| resource_group_name=resource_group_name, | ||
| parameter_group_name=parameter_group_name) | ||
|
|
||
|
|
||
| def horizondb_parameter_group_list(client, resource_group_name=None): | ||
| if resource_group_name: | ||
| return client.list_by_resource_group(resource_group_name=resource_group_name) | ||
| return client.list_by_subscription() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.