-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Breadth Coverage] Support StorageSync in Azure CLI cmdlets #1389
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
08a93e0
draft storage sync cli commands
jsntcy d02a444
upload for vm test
jsntcy c67cdef
save to remote temp
jsntcy a648fab
[Breadth Coverage] support storage sync in CLI extensions
jsntcy fed323d
add code owner and default tags
jsntcy 37416bd
update code based on review comments
jsntcy 31bf83b
add experimental tag
jsntcy b44d532
remove useless dependencies
jsntcy 7d0cd78
Merge branch 'master' into bc-storagesync-final
jsntcy 9bd57d1
Merge branch 'master' into bc-storagesync-final
jsntcy 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
| 0.1.0 | ||
| ++++++ | ||
| * Initial release. |
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,202 @@ | ||
| ========================================== | ||
| # Azure CLI Storage Sync Extension # | ||
| This is a extension for StorageSync features. | ||
|
|
||
| ### How to use ### | ||
| Install this extension using the below CLI command | ||
| ``` | ||
| az extension add --name storagesync | ||
| ``` | ||
|
|
||
| ### Included Features | ||
| #### Manage storage sync service: | ||
|
|
||
| ##### Create a new storage sync service. | ||
|
|
||
| ``` | ||
| az storagesync create \ | ||
| --resource-group rg \ | ||
| --name storage_sync_service_name \ | ||
| --location westus \ | ||
| --tags key1=value1 | ||
| ``` | ||
|
|
||
| ##### Delete a given storage sync service. | ||
| ``` | ||
| az storagesync delete \ | ||
| --resource-group rg \ | ||
| --name storage_sync_service_name | ||
| ``` | ||
|
|
||
| ##### Show the properties for a given storage sync service. | ||
| ``` | ||
| az storagesync show \ | ||
| --resource-group rg \ | ||
| --name storage_sync_service_name | ||
| ``` | ||
|
|
||
| ##### List all storage sync services in a resource group or a subscription. | ||
| ``` | ||
| az storagesync list | ||
| ``` | ||
| ``` | ||
| az storagesync list \ | ||
| --resource-group rg | ||
| ``` | ||
|
|
||
| #### Manage sync group: | ||
|
|
||
| ##### Create a new sync group. | ||
| ``` | ||
| az storagesync sync-group create \ | ||
|
Contributor
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.
Member
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. use az storagesync sync-group create after discussion In reply to: 392865940 [](ancestors = 392865940) |
||
| --resource-group rg \ | ||
| --name sync_group_name \ | ||
| --storage-sync-service storage-sync-service-name | ||
| ``` | ||
|
|
||
| ##### Delete a given sync group. | ||
| ``` | ||
| az storagesync sync-group delete \ | ||
| --resource-group rg \ | ||
| --name sync_group_name \ | ||
| --storage-sync-service storage-sync-service-name | ||
| ``` | ||
|
|
||
| ##### Show the properties for a given sync group. | ||
| ``` | ||
| az storagesync sync-group show \ | ||
| --resource-group rg \ | ||
| --name sync_group_name \ | ||
| --storage-sync-service storage-sync-service-name | ||
| ``` | ||
|
|
||
| ##### List all sync groups in a storage sync service. | ||
| ``` | ||
| az storagesync sync-group list \ | ||
| --resource-group rg \ | ||
| --storage-sync-service storage-sync-service-name | ||
| ``` | ||
|
|
||
| #### Manage cloud endpoint. | ||
|
|
||
| ##### Create a new cloud endpoint. | ||
| ``` | ||
| az storagesync sync-group cloud-endpoint create \ | ||
| --resource-group rg \ | ||
| --name cloud-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name \ | ||
| --storage-account storageaccountnameorid \ | ||
| --azure-file-share-name file-share-name | ||
| ``` | ||
|
|
||
| ##### Delete a given cloud endpoint. | ||
| ``` | ||
| az storagesync sync-group cloud-endpoint delete \ | ||
| --resource-group rg \ | ||
| --name cloud-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name | ||
| ``` | ||
|
|
||
| ##### Show the properties for a given cloud endpoint. | ||
| ``` | ||
| az storagesync sync-group cloud-endpoint show \ | ||
| --resource-group rg \ | ||
| --name cloud-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name | ||
| ``` | ||
|
|
||
| ##### List all cloud endpoints in a sync group. | ||
| ``` | ||
| az storagesync sync-group cloud-endpoint list \ | ||
| --resource-group rg \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name | ||
| ``` | ||
|
|
||
| #### Manage cloud endpoint. | ||
|
|
||
| ##### Create a new server endpoint. | ||
| ``` | ||
| az storagesync sync-group server-endpoint create \ | ||
| --resource-group rg \ | ||
| --name server-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name \ | ||
| --server-id server-id \ | ||
| --server-local-path "d:\\abc" | ||
| ``` | ||
|
|
||
| ##### Update the properties for a given server endpoint. | ||
| ``` | ||
| az storagesync sync-group server-endpoint create \ | ||
| --resource-group rg \ | ||
| --name server-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name \ | ||
| --server-id server-id \ | ||
| --server-local-path "d:\\abc" | ||
| ``` | ||
|
|
||
| ##### Delete a given server endpoint. | ||
| ``` | ||
| az storagesync sync-group server-endpoint delete \ | ||
| --resource-group rg \ | ||
| --name server-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name | ||
| ``` | ||
|
|
||
| ##### Show the properties for a given server endpoint. | ||
| ``` | ||
| az storagesync sync-group server-endpoint show \ | ||
| --resource-group rg \ | ||
| --name server-endpoint-name \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name | ||
| ``` | ||
|
|
||
| ##### List all server endpoints in a sync group. | ||
| ``` | ||
| az storagesync sync-group server-endpoint list \ | ||
| --resource-group rg \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --sync-group-name sync-group-name | ||
| ``` | ||
|
|
||
| #### Manage registered server. | ||
|
|
||
| ##### Register an on-premises server to a storage sync service. | ||
|
|
||
| *This command is not supported in CLI yet. You can use Azure PowerShell command [Register-AzStorageSyncServer](https://docs.microsoft.com/en-us/powershell/module/az.storagesync/register-azstoragesyncserver?view=azps-3.6.1) or [Azure File Sync Agent](https://docs.microsoft.com/en-us/azure/storage/files/storage-sync-files-deployment-guide?tabs=azure-portal#register-windows-server-with-storage-sync-service) instead.* | ||
|
|
||
| ##### Unregister an on-premises server from it's storage sync service. | ||
| ``` | ||
| az storagesync registered-server delete \ | ||
| --resource-group rg \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --server-id server-id | ||
| ``` | ||
|
|
||
| ##### Show the properties for a given registered server. | ||
| ``` | ||
| az storagesync registered-server show \ | ||
| --resource-group rg \ | ||
| --storage-sync-service storage-sync-service-name \ | ||
| --server-id server-id | ||
| ``` | ||
|
|
||
| ##### List all registered servers for a given storage sync service. | ||
| ``` | ||
| az storagesync registered-server list \ | ||
| --resource-group rg \ | ||
| --storage-sync-service storage-sync-service-name | ||
| ``` | ||
|
|
||
| ##### Roll the storage sync server certificate used to describe the server identity to the storage sync service. | ||
|
|
||
| *This command is not supported in CLI yet. You can use Azure PowerShell command [Reset-AzStorageSyncServerCertificate](https://docs.microsoft.com/en-us/powershell/module/az.storagesync/reset-azstoragesyncservercertificate?view=azps-3.6.1) instead.* | ||
|
|
||
| If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues. | ||
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,32 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 azext_storagesync._help import helps # pylint: disable=unused-import | ||
|
|
||
|
|
||
| class MicrosoftStorageSyncCommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| from azext_storagesync._client_factory import cf_storagesync | ||
| storagesync_custom = CliCommandType( | ||
| operations_tmpl='azext_storagesync.custom#{}', | ||
| client_factory=cf_storagesync) | ||
| super(MicrosoftStorageSyncCommandsLoader, self).__init__(cli_ctx=cli_ctx, | ||
| custom_command_type=storagesync_custom) | ||
|
|
||
| def load_command_table(self, args): | ||
| from azext_storagesync.commands import load_command_table | ||
| load_command_table(self, args) | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from azext_storagesync._params import load_arguments | ||
| load_arguments(self, command) | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = MicrosoftStorageSyncCommandsLoader |
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,38 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def cf_storagesync(cli_ctx, *_): | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from .vendored_sdks.storagesync import StorageSyncManagementClient | ||
| return get_mgmt_service_client(cli_ctx, StorageSyncManagementClient) | ||
|
|
||
|
|
||
| def cf_storage_sync_services(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).storage_sync_services | ||
|
|
||
|
|
||
| def cf_sync_groups(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).sync_groups | ||
|
|
||
|
|
||
| def cf_cloud_endpoints(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).cloud_endpoints | ||
|
|
||
|
|
||
| def cf_server_endpoints(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).server_endpoints | ||
|
|
||
|
|
||
| def cf_registered_servers(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).registered_servers | ||
|
|
||
|
|
||
| def cf_workflows(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).workflows | ||
|
|
||
|
|
||
| def cf_operation_status(cli_ctx, *_): | ||
| return cf_storagesync(cli_ctx).operation_status |
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.
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.
Shall we use storage-sync as the extension name?
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.
Not sure which one should be as both patterns exist in CLI, and we can have a discussion.
In reply to: 392828794 [](ancestors = 392828794)
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.
There is guideline on command naming. But we can discuss it for sure.
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.
az [ group ] [ subgroup ] [ command ] {parameters}
Multi-word subgroups should be hyphenated (e.g. foo-resource instead of fooresource)
So I'll keep it without hyphen.
In reply to: 392864381 [](ancestors = 392864381)