-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Breadth Coverage] Support StorageSync in Azure CLI cmdlets #1389
Changes from 5 commits
08a93e0
d02a444
c67cdef
a648fab
fed323d
37416bd
31bf83b
b44d532
7d0cd78
9bd57d1
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 |
---|---|---|
|
@@ -73,3 +73,5 @@ | |
/src/connectedmachine/ @farehar | ||
|
||
/src/ip-group/ @haroldrandom | ||
|
||
/src/storagesync/ @jsntcy | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. :changelog: | ||
|
||
Release History | ||
=============== | ||
|
||
0.1.0 | ||
++++++ | ||
* Initial release. |
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 storage-sync-service create \ | ||
--resource-group rg \ | ||
--name storage_sync_service_name \ | ||
--location westus \ | ||
--tags key1=value1 | ||
``` | ||
|
||
##### Delete a given storage sync service. | ||
``` | ||
az storagesync storage-sync-service delete \ | ||
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. should it be 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. will be az storagesync delete after internal discussion In reply to: 392865778 [](ancestors = 392865778) |
||
--resource-group rg \ | ||
--name storage_sync_service_name | ||
``` | ||
|
||
##### Show the properties for a given storage sync service. | ||
``` | ||
az storagesync storage-sync-service show \ | ||
--resource-group rg \ | ||
--name storage_sync_service_name | ||
``` | ||
|
||
##### List all storage sync services in a resource group or a subscription. | ||
``` | ||
az storagesync storage-sync-service list | ||
``` | ||
``` | ||
az storagesync storage-sync-service list \ | ||
--resource-group rg | ||
``` | ||
|
||
#### Manage sync group: | ||
|
||
##### Create a new sync group. | ||
``` | ||
az storagesync sync-group create \ | ||
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.
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-name storage-sync-service-name | ||
``` | ||
|
||
##### Delete a given sync group. | ||
``` | ||
az storagesync sync-group delete \ | ||
--resource-group rg \ | ||
--name sync_group_name \ | ||
--storage-sync-service-name 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-name storage-sync-service-name | ||
``` | ||
|
||
##### List all sync groups in a storage sync service. | ||
``` | ||
az storagesync sync-group list \ | ||
--resource-group rg \ | ||
--storage-sync-service-name storage-sync-service-name | ||
``` | ||
|
||
#### Manage cloud endpoint. | ||
|
||
##### Create a new cloud endpoint. | ||
``` | ||
az storagesync cloud-endpoint create \ | ||
--resource-group rg \ | ||
--name cloud-endpoint-name \ | ||
--storage-sync-service-name storage-sync-service-name \ | ||
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.
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. 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. it should support both of them. #Resolved 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. |
||
--sync-group-name sync-group-name \ | ||
--storage-account storageaccountnameorid \ | ||
--azure-file-share-name file-share-name | ||
``` | ||
|
||
##### Delete a given cloud endpoint. | ||
``` | ||
az storagesync cloud-endpoint delete \ | ||
--resource-group rg \ | ||
--name cloud-endpoint-name \ | ||
--storage-sync-service-name storage-sync-service-name \ | ||
--sync-group-name sync-group-name | ||
``` | ||
|
||
##### Show the properties for a given cloud endpoint. | ||
``` | ||
az storagesync cloud-endpoint show \ | ||
--resource-group rg \ | ||
--name cloud-endpoint-name \ | ||
--storage-sync-service-name storage-sync-service-name \ | ||
--sync-group-name sync-group-name | ||
``` | ||
|
||
##### List all cloud endpoints in a sync group. | ||
``` | ||
az storagesync cloud-endpoint list \ | ||
--resource-group rg \ | ||
--storage-sync-service-name storage-sync-service-name \ | ||
--sync-group-name sync-group-name | ||
``` | ||
|
||
#### Manage cloud endpoint. | ||
|
||
##### Create a new server endpoint. | ||
``` | ||
az storagesync server-endpoint create \ | ||
--resource-group rg \ | ||
--name server-endpoint-name \ | ||
--storage-sync-service-name 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 server-endpoint create \ | ||
--resource-group rg \ | ||
--name server-endpoint-name \ | ||
--storage-sync-service-name 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 server-endpoint delete \ | ||
--resource-group rg \ | ||
--name server-endpoint-name \ | ||
--storage-sync-service-name storage-sync-service-name \ | ||
--sync-group-name sync-group-name | ||
``` | ||
|
||
##### Show the properties for a given server endpoint. | ||
``` | ||
az storagesync server-endpoint show \ | ||
--resource-group rg \ | ||
--name server-endpoint-name \ | ||
--storage-sync-service-name storage-sync-service-name \ | ||
--sync-group-name sync-group-name | ||
``` | ||
|
||
##### List all server endpoints in a sync group. | ||
``` | ||
az storagesync server-endpoint list \ | ||
--resource-group rg \ | ||
--storage-sync-service-name 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-name 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-name 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-name 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. |
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 |
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 |
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)