Skip to content

Commit

Permalink
[Purview] Purview GA Azure CLI request (#3814)
Browse files Browse the repository at this point in the history
* purview
  • Loading branch information
Jing-song authored Sep 9, 2021
1 parent a93a14f commit c711aab
Show file tree
Hide file tree
Showing 55 changed files with 10,326 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,5 @@
/src/dataprotection/ @sambitratha

/src/authV2/ @mkarmark

/src/purview/ @kairu-ms @jsntcy
8 changes: 8 additions & 0 deletions src/purview/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
58 changes: 58 additions & 0 deletions src/purview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Azure CLI purview Extension #
This is the extension for purview

### How to use ###
Install this extension using the below CLI command
```
az extension add --name purview
```

### Included Features ###
#### purview account ####
##### Create #####
```
az purview account create --location "WestUS2" --managed-group-name "custom-rgname" \
--name "account1" --resource-group "SampleResourceGroup"
az purview account wait --created --name "{myAccount}" --resource-group "{rg}"
```
##### Show #####
```
az purview account show --name "account1" --resource-group "SampleResourceGroup"
```
##### List #####
```
az purview account list --resource-group "SampleResourceGroup"
```
##### Update #####
```
az purview account update --name "account1" --tags newTag="New tag value." --resource-group "SampleResourceGroup"
```
##### Add-root-collection-admin #####
```
az purview account add-root-collection-admin --name "account1" --object-id "7e8de0e7-2bfc-4e1f-9659-2a5785e4356f" \
--resource-group "SampleResourceGroup"
```
##### List-key #####
```
az purview account list-key --name "account1" --resource-group "SampleResourceGroup"
```
##### Delete #####
```
az purview account delete --name "account1" --resource-group "SampleResourceGroup"
```
#### purview default-account ####
##### Show #####
```
az purview default-account show --subscription-id "12345678-1234-1234-12345678abc" \
--scope-tenant-id "12345678-1234-1234-12345678abc"
```
##### Remove #####
```
az purview default-account remove --scope-tenant-id "12345678-1234-1234-12345678abc" --scope-type "Tenant"
```
##### Set #####
```
az purview default-account set --account-name "myDefaultAccount" --resource-group "rg-1" \
--scope-tenant-id "12345678-1234-1234-12345678abc" --scope-type "Tenant"
```
52 changes: 52 additions & 0 deletions src/purview/azext_purview/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# --------------------------------------------------------------------------
# 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=unused-import

import azext_purview._help
from azure.cli.core import AzCommandsLoader


class PurviewManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_purview.generated._client_factory import cf_purview_cl
purview_custom = CliCommandType(
operations_tmpl='azext_purview.custom#{}',
client_factory=cf_purview_cl)
super().__init__(cli_ctx=cli_ctx, custom_command_type=purview_custom)

def load_command_table(self, args):
from azext_purview.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_purview.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
from azext_purview.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_purview.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = PurviewManagementClientCommandsLoader
20 changes: 20 additions & 0 deletions src/purview/azext_purview/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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
# pylint: disable=unused-import
from .generated._help import helps # pylint: disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
20 changes: 20 additions & 0 deletions src/purview/azext_purview/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
4 changes: 4 additions & 0 deletions src/purview/azext_purview/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.15.0"
}
20 changes: 20 additions & 0 deletions src/purview/azext_purview/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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 as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
12 changes: 12 additions & 0 deletions src/purview/azext_purview/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +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__)
24 changes: 24 additions & 0 deletions src/purview/azext_purview/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


def cf_purview_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_purview.vendored_sdks.purview import PurviewManagementClient
return get_mgmt_service_client(cli_ctx,
PurviewManagementClient)


def cf_account(cli_ctx, *_):
return cf_purview_cl(cli_ctx).accounts


def cf_default_account(cli_ctx, *_):
return cf_purview_cl(cli_ctx).default_accounts
151 changes: 151 additions & 0 deletions src/purview/azext_purview/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# --------------------------------------------------------------------------
# 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=too-many-lines

from knack.help_files import helps


helps['purview'] = '''
type: group
short-summary: Manage Purview
'''

helps['purview account'] = """
type: group
short-summary: Manage account with purview
"""

helps['purview account list'] = """
type: command
short-summary: "List accounts in ResourceGroup And List accounts in Subscription."
examples:
- name: Accounts_ListByResourceGroup
text: |-
az purview account list --resource-group "SampleResourceGroup"
- name: Accounts_ListBySubscription
text: |-
az purview account list
"""

helps['purview account show'] = """
type: command
short-summary: "Get an account."
examples:
- name: Accounts_Get
text: |-
az purview account show --name "account1" --resource-group "SampleResourceGroup"
"""

helps['purview account create'] = """
type: command
short-summary: "Create an account."
parameters:
- name: --sku
short-summary: "Gets or sets the Sku."
long-summary: |
Usage: --sku capacity=XX name=XX
capacity: Gets or sets the sku capacity. Possible values include: 4, 16
name: Gets or sets the sku name.
examples:
- name: Accounts_CreateOrUpdate
text: |-
az purview account create --location "West US 2" --managed-resource-group-name "custom-rgname" --sku \
name="Standard" capacity=4 --name "account1" --resource-group "SampleResourceGroup"
"""

helps['purview account update'] = """
type: command
short-summary: "Updates an account."
examples:
- name: Accounts_Update
text: |-
az purview account update --name "account1" --tags newTag="New tag value." --resource-group \
"SampleResourceGroup"
"""

helps['purview account delete'] = """
type: command
short-summary: "Deletes an account resource."
examples:
- name: Accounts_Delete
text: |-
az purview account delete --name "account1" --resource-group "SampleResourceGroup"
"""

helps['purview account add-root-collection-admin'] = """
type: command
short-summary: "Add the administrator for root collection associated with this account."
examples:
- name: Accounts_AddRootCollectionAdmin
text: |-
az purview account add-root-collection-admin --name "account1" --object-id \
"7e8de0e7-2bfc-4e1f-9659-2a5785e4356f" --resource-group "SampleResourceGroup"
"""

helps['purview account list-key'] = """
type: command
short-summary: "List the authorization keys associated with this account."
examples:
- name: Accounts_ListKeys
text: |-
az purview account list-key --name "account1" --resource-group "SampleResourceGroup"
"""

helps['purview account wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the purview account is met.
examples:
- name: Pause executing next line of CLI script until the purview account is successfully created.
text: |-
az purview account wait --name "account1" --resource-group "SampleResourceGroup" --created
- name: Pause executing next line of CLI script until the purview account is successfully updated.
text: |-
az purview account wait --name "account1" --resource-group "SampleResourceGroup" --updated
- name: Pause executing next line of CLI script until the purview account is successfully deleted.
text: |-
az purview account wait --name "account1" --resource-group "SampleResourceGroup" --deleted
"""

helps['purview default-account'] = """
type: group
short-summary: Manage default account with purview
"""

helps['purview default-account show'] = """
type: command
short-summary: "Get the default account for the scope."
examples:
- name: DefaultAccounts_Get
text: |-
az purview default-account show --scope "12345678-1234-1234-12345678abc" --scope-tenant-id \
"12345678-1234-1234-12345678abc" --scope-type "Tenant"
"""

helps['purview default-account remove'] = """
type: command
short-summary: "Removes the default account from the scope."
examples:
- name: DefaultAccounts_Remove
text: |-
az purview default-account remove --scope "12345678-1234-1234-12345678abc" --scope-tenant-id \
"12345678-1234-1234-12345678abc" --scope-type "Tenant"
"""

helps['purview default-account set'] = """
type: command
short-summary: "Sets the default account for the scope."
examples:
- name: DefaultAccounts_Set
text: |-
az purview default-account set --account-name "myDefaultAccount" --resource-group "rg-1" --scope \
"12345678-1234-1234-12345678abc" --scope-tenant-id "12345678-1234-1234-12345678abc" --scope-type "Tenant" \
--subscription-id "12345678-1234-1234-12345678aaa"
"""
Loading

0 comments on commit c711aab

Please sign in to comment.