-
Notifications
You must be signed in to change notification settings - Fork 3.3k
First version of Azure NetApp Files CLI for GA #9365
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
Changes from all commits
70e9562
c0bd3e8
c5d190d
da1784a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
|
|
||
| 1.0.0 (2019-05-01) | ||
| ++++++++++++++++++ | ||
|
|
||
| * GA release. | ||
| * Previously existed as cli-extension. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| include *.rst |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| Microsoft Azure CLI 'Azure NetApp Files (ANF)' Command Module | ||
| ============================================================= | ||
|
|
||
| This package is for the Azure NetApp Files (ANF) module. | ||
| i.e. 'az netappfiles' | ||
|
|
||
|
|
||
| It contains commands that can be used to create and manage volumes. The typical sequence would be to first create an account | ||
|
|
||
| az netappfiles account create --resource-group rg -n account_name | ||
|
|
||
|
|
||
| Then allocate a storage pool in which volumes can be created | ||
|
|
||
| az netappfiles pool create --resource-group rg -a account_name -n pool_name -l location --size 4398046511104 --service-level "Premium" | ||
|
|
||
|
|
||
| Volumes are created within the pool resource | ||
|
|
||
| az netappfiles volume create --resource-group rg -a account_name -p pool_name -n volume_name -l location --service-level "Premium" --usage-threshold 107374182400 --creation-token "unique-token" --subnet-id "/subscriptions/mysubsid/resourceGroups/myrg/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/default" | ||
|
|
||
|
|
||
| Snapshots of volumes can also be created | ||
|
|
||
| az netappfiles snapshot create --resource-group rg -a account_name --p pool_name -v vname -n snapshot_name -l location --file-system-id volume-uuid | ||
|
|
||
|
|
||
| These resources can be updated, deleted and listed. See the help to find out more | ||
|
|
||
| az netappfiles --help |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| import pkg_resources | ||
| pkg_resources.declare_namespace(__name__) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| import pkg_resources | ||
| pkg_resources.declare_namespace(__name__) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| import pkg_resources | ||
| pkg_resources.declare_namespace(__name__) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 import AzCommandsLoader | ||
| from azure.cli.command_modules.netappfiles._help import helps # pylint: disable=unused-import | ||
|
|
||
|
|
||
| class NetAppFilesCommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| netappfiles_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.netappfiles.custom#{}') | ||
| super(NetAppFilesCommandsLoader, self).__init__(cli_ctx=cli_ctx, | ||
| min_profile='2017-03-10-profile', | ||
| custom_command_type=netappfiles_custom) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to add logic to suppress the extension here or the older extension will override your newer module.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok that makes good sense. What needs added to perform this? |
||
|
|
||
| def load_command_table(self, args): | ||
| super(NetAppFilesCommandsLoader, self).load_command_table(args) | ||
| from azure.cli.command_modules.netappfiles.commands import load_command_table | ||
| load_command_table(self, args) | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| super(NetAppFilesCommandsLoader, self).load_arguments(command) | ||
| from azure.cli.command_modules.netappfiles._params import load_arguments | ||
| load_arguments(self, command) | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = NetAppFilesCommandsLoader | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: disable=unused-argument | ||
|
|
||
|
|
||
| def cf_netappfiles(cli_ctx, *kwargs): | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from azure.mgmt.netapp import AzureNetAppFilesManagementClient | ||
| return get_mgmt_service_client(cli_ctx, AzureNetAppFilesManagementClient) | ||
|
|
||
|
|
||
| def accounts_mgmt_client_factory(cli_ctx, _): | ||
| return cf_netappfiles(cli_ctx).accounts | ||
|
|
||
|
|
||
| def pools_mgmt_client_factory(cli_ctx, _): | ||
| return cf_netappfiles(cli_ctx).pools | ||
|
|
||
|
|
||
| def volumes_mgmt_client_factory(cli_ctx, _): | ||
| return cf_netappfiles(cli_ctx).volumes | ||
|
|
||
|
|
||
| def mount_targets_mgmt_client_factory(cli_ctx, _): | ||
| return cf_netappfiles(cli_ctx).mount_targets | ||
|
|
||
|
|
||
| def snapshots_mgmt_client_factory(cli_ctx, _): | ||
| return cf_netappfiles(cli_ctx).snapshots |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from knack.util import CLIError | ||
| from msrest.exceptions import ValidationError # pylint: disable=import-error | ||
| from msrestazure.azure_exceptions import CloudError | ||
|
|
||
|
|
||
| def netappfiles_exception_handler(ex): | ||
| if isinstance(ex, CloudError) or isinstance(ex, ValidationError) or isinstance(ex, ValueError): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems very generic. The default CLI exception handler should be sufficient.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok. What is the default CLI exception? Should I not capture the CloudError? The ValidationError and ValueError were added deliberately because otherwise certain invalid commands would result in a trace log which didn't seem to be what a CLI user would want to see. Please advise further. |
||
| message = ex | ||
| raise CLIError(message) | ||
| else: | ||
| import sys | ||
|
|
||
| from six import reraise | ||
| reraise(*sys.exc_info()) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to schedule a full command review to move this from an extension to a module. Do not put the date in the version. "Previously existed as cli-extension" is not a customer-facing thing.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I will remove the date and the cli-extension text. Can you tell me the process for the command review? I know one of these was already performed, initiated through email with Shane Mainali among others, and the commands agreed in a meeting. It was then decided that because the swagger was in preview that the service should be an extension. I did not expect another review was needed. Actually I also used the information here https://github.com/Azure/azure-cli/blob/dev/doc/extensions/faq.md#how-do-i-move-from-an-extension-to-a-command-module as a guide which doesn't mention the need for a further review either.