forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK Automation
committed
Jul 31, 2020
1 parent
697b90e
commit ecbed4d
Showing
55 changed files
with
7,731 additions
and
4,089 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,201 +1,5 @@ | ||
# Azure CLI datashare Extension # | ||
This package is for the 'datashare' extension, i.e. 'az datashare'. More info on what is [Data Share](https://docs.microsoft.com/azure/data-share/). | ||
|
||
### How to use ### | ||
Install this extension using the below CLI command | ||
``` | ||
az extension add --name datashare | ||
``` | ||
|
||
Register DataShare Resource Provider for your default susbcription. | ||
``` | ||
az provider register -n "Microsoft.DataShare" | ||
``` | ||
|
||
### Included Features | ||
#### Datashare Account Management | ||
*Examples:* | ||
|
||
##### Create a Datashare Account | ||
|
||
``` | ||
az datashare account create \ | ||
--location "West US 2" \ | ||
--tags tag1=Red tag2=White \ | ||
--name "cli_test_account" \ | ||
--resource-group "datashare_provider_rg" | ||
``` | ||
|
||
##### Wait for the Datashare Account to be provisioned | ||
``` | ||
az datashare account wait \ | ||
--name "cli_test_account" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--created | ||
``` | ||
|
||
#### Datashare Resource Management for a Provider | ||
*Examples:* | ||
|
||
##### Create a Datashare | ||
``` | ||
az datashare create \ | ||
--account-name "cli_test_account" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--description "share description" \ | ||
--share-kind "CopyBased" \ | ||
--terms "Confidential" \ | ||
--name "cli_test_share" | ||
``` | ||
|
||
##### Create a Data Set | ||
``` | ||
az datashare dataset create \ | ||
--account-name "cli_test_account" \ | ||
--name "cli_test_data_set" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--share-name "cli_test_share" \ | ||
--dataset "{\"container_name\":\"mycontainer\",\"storage_account_name\":\"mysa\",\"kind\":\"Container\"}" | ||
``` | ||
|
||
Please make sure the datashare account has the right permission of the data source when creating a data set upon it. | ||
For instance, you can use `az datashare account show` to get 'identity.principalId' of the account, then assign the right role to it. | ||
``` | ||
az role assignment create \ | ||
--role "Storage Blob Data Reader" \ | ||
--assignee-object-id {DatashareAccountPrincipalId} \ | ||
--assignee-principal-type ServicePrincipal \ | ||
--scope {StorageAccountId} | ||
``` | ||
|
||
##### Create a Synchronization Setting | ||
``` | ||
az datashare synchronization-setting create \ | ||
--account-name cli_test_account \ | ||
--resource-group datashare_provider_rg \ | ||
--share-name cli_test_share \ | ||
--name cli_test_synchronization_setting \ | ||
--recurrence-interval Day \ | ||
--synchronization-time "2020-04-05 10:50:00 +00:00" \ | ||
--kind ScheduleBased | ||
``` | ||
|
||
##### List Synchronization History | ||
``` | ||
az datashare synchronization list \ | ||
--account-name "cli_test_account" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--share-name "cli_test_share" | ||
``` | ||
|
||
##### Create a Datashare Invitation | ||
``` | ||
az datashare invitation create \ | ||
--account-name "cli_test_account" \ | ||
--target-email "myname@microsoft.com" \ | ||
--name "cli_test_invitation" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--share-name "cli_test_share" | ||
``` | ||
|
||
##### List Share Subscriptions | ||
``` | ||
az datashare provider-share-subscription list \ | ||
--account-name "cli_test_account" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--share-name "cli_test_share" | ||
``` | ||
Share subscriptions are created by Datashare consumers when they accept invitations. | ||
|
||
##### Revoke Datashare for a Share Subscription | ||
``` | ||
az datashare provider-share-subscription revoke \ | ||
--account-name "cli_test_account" \ | ||
--share-subscription "{ProviderShareSubscriptionObjectId}" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--share-name "cli_test_share" | ||
``` | ||
|
||
##### Reinstate Datashare for a Share Subscription | ||
``` | ||
az datashare provider-share-subscription reinstate \ | ||
--account-name "cli_test_account" \ | ||
--share-subscription "{ProviderShareSubscriptionObjectId}" \ | ||
--resource-group "datashare_provider_rg" \ | ||
--share-name "cli_test_share" | ||
``` | ||
|
||
#### Datashare Resource Management for a Consumer | ||
*Examples:* | ||
|
||
##### List received Invitations | ||
``` | ||
az datashare consumer invitation list | ||
``` | ||
|
||
##### Create a Share Subscription from an Invitation | ||
``` | ||
az datashare consumer share-subscription create \ | ||
--account-name "cli_test_consumer_account" \ | ||
--resource-group "datashare_consumer_rg" \ | ||
--invitation-id "{InvitationId1}" \ | ||
--source-share-location "sourceShareLocation" \ | ||
--name "cli_test_share_subscription" | ||
``` | ||
|
||
##### List Source Data Sets in the Share Subscription | ||
``` | ||
az datashare consumer share-subscription list-source-dataset \ | ||
--account-name "cli_test_consumer_account" \ | ||
--resource-group "datashare_consumer_rg" \ | ||
--share-subscription-name "cli_test_share_subscription" | ||
``` | ||
|
||
##### Create a Data Set Mapping of the Source Data Set | ||
``` | ||
az datashare consumer dataset-mapping create \ | ||
--account-name "cli_test_consumer_account" \ | ||
--name "cli_test_data_set_mapping" \ | ||
--resource-group "datashare_consumer_rg" \ | ||
--share-subscription-name "cli_test_share_subscription" \ | ||
--mapping "{\"data_set_id\":\"2036a39f-add6-4347-9c82-a424dfaf4e8d\", \ | ||
\"container_name\":\"newcontainer\", \"storage_account_name\":\"consumersa\", \ | ||
\"kind\":\"BlobFolder\",\"prefix\":\"myprefix\"}" | ||
``` | ||
Please make sure the datashare consumer account has the right permission of the data target when creating a data set mapping on it. For instance, you can use `az datashare account show` to get 'identity.principalId' of the account, then assign the right role to it. | ||
``` | ||
az role assignment create \ | ||
--role "Storage Blob Data Contributor" \ | ||
--assignee-object-id "{ConsumerDatashareAccountPrincipalId}" \ | ||
--assignee-principal-type ServicePrincipal \ | ||
--scope "{ConsumerStorageAccountId}" | ||
``` | ||
|
||
##### List the synchronization settings of the Source Datashare | ||
``` | ||
az datashare consumer share-subscription list-source-share-synchronization-setting \ | ||
--account-name "cli_test_consumer_account" \ | ||
--resource-group "datashare_consumer_rg" \ | ||
--share-subscription-name "cli_test_share_subscription" | ||
``` | ||
|
||
##### Create a trigger for the Share Subsciption | ||
``` | ||
az datashare consumer trigger create \ | ||
--account-name "cli_test_consumer_account" \ | ||
--resource-group "datashare_consumer_rg" \ | ||
--share-subscription-name "cli_test_share_subscription" \ | ||
--name "cli_test_trigger" \ | ||
--recurrence-interval Day \ | ||
--synchronization-time "2020-04-05 10:50:00 +00:00" \ | ||
--kind ScheduleBased | ||
``` | ||
|
||
##### Start a synchronization for the Share Subscription | ||
``` | ||
az datashare consumer share-subscription synchronization start \ | ||
--account-name "cli_test_consumer_account" \ | ||
--resource-group "datashare_consumer_rg" \ | ||
--share-subscription-name "cli_test_share_subscription" \ | ||
--synchronization-mode "Incremental" | ||
``` | ||
Microsoft Azure CLI 'datashare' Extension | ||
========================================== | ||
|
||
This package is for the 'datashare' extension. | ||
i.e. 'az datashare' |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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
33 changes: 17 additions & 16 deletions
33
src/datashare/azext_datashare/_help.py → src/datashare/azext_datashare/custom.py
This file contains 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 |
---|---|---|
@@ -1,16 +1,17 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
# pylint: disable=wildcard-import | ||
# pylint: disable=unused-wildcard-import | ||
|
||
# try: | ||
# from .generated._help import * # noqa: F403 | ||
# except ImportError: | ||
# pass | ||
|
||
try: | ||
from .manual._help import * # noqa: F403 | ||
except ImportError: | ||
pass | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
# pylint: disable=wildcard-import | ||
# pylint: disable=unused-wildcard-import | ||
|
||
from .generated.custom import * # noqa: F403 | ||
try: | ||
from .manual.custom import * # noqa: F403 | ||
except ImportError: | ||
pass |
This file contains 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) |
This file contains 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.