Skip to content
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

[AutoPR adp] ADP: fix cli codegen #694

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/adp/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

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

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

### Included Features ###
#### adp account ####
##### Create #####
```
az adp account create --name "sampleacct" --location "Global" --resource-group "adpClient"

az adp account wait --created --name "{myAccount}" --resource-group "{rg}"
```
##### Show #####
```
az adp account show --name "sampleacct" --resource-group "adpClient"
```
##### List #####
```
az adp account list --resource-group "adpClient"
```
##### Update #####
```
az adp account update --name "sampleacct" --resource-group "adpClient"
```
##### Delete #####
```
az adp account delete --name "sampleacct" --resource-group "adpClient"
```
#### adp data-pool ####
##### Create #####
```
az adp data-pool create --account-name "sampleacct" --name "sampledp" \
--locations name="westus" key-vault-uri="https://vaulturi" key-name="key1" key-version="123" user-assigned-identity="/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1" \
--resource-group "adpClient"

az adp data-pool wait --created --name "{myDataPool}" --resource-group "{rg}"
```
##### Show #####
```
az adp data-pool show --account-name "sampleacct" --name "sampledp" --resource-group "adpClient"
```
##### List #####
```
az adp data-pool list --account-name "sampleacct" --resource-group "adpClient"
```
##### Update #####
```
az adp data-pool update --account-name "sampleacct" --name "sampledp" --locations name="westus" \
--resource-group "adpClient"
```
##### Delete #####
```
az adp data-pool delete --account-name "sampleacct" --name "sampledp" --resource-group "adpClient"
```
50 changes: 50 additions & 0 deletions src/adp/azext_adp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_adp.generated._help import helps # pylint: disable=unused-import
try:
from azext_adp.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class AdpManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_adp.generated._client_factory import cf_adp_cl
adp_custom = CliCommandType(
operations_tmpl='azext_adp.custom#{}',
client_factory=cf_adp_cl)
parent = super(AdpManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=adp_custom)

def load_command_table(self, args):
from azext_adp.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_adp.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_adp.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_adp.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = AdpManagementClientCommandsLoader
17 changes: 17 additions & 0 deletions src/adp/azext_adp/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# 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:
pass
4 changes: 4 additions & 0 deletions src/adp/azext_adp/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.15.0"
}
17 changes: 17 additions & 0 deletions src/adp/azext_adp/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# 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
12 changes: 12 additions & 0 deletions src/adp/azext_adp/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/adp/azext_adp/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_adp_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_adp.vendored_sdks.adp import AdpManagementClient
return get_mgmt_service_client(cli_ctx,
AdpManagementClient)


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


def cf_data_pool(cli_ctx, *_):
return cf_adp_cl(cli_ctx).data_pools
183 changes: 183 additions & 0 deletions src/adp/azext_adp/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# --------------------------------------------------------------------------
# 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['adp account'] = """
type: group
short-summary: Manage account with adp
"""

helps['adp account list'] = """
type: command
short-summary: "List all ADP accounts available under the resource group And List all ADP accounts available under \
the subscription."
examples:
- name: List accounts by resource group
text: |-
az adp account list --resource-group "adpClient"
- name: List accounts
text: |-
az adp account list
"""

helps['adp account show'] = """
type: command
short-summary: "Gets the properties of an ADP account."
examples:
- name: Get account
text: |-
az adp account show --name "sampleacct" --resource-group "adpClient"
"""

helps['adp account create'] = """
type: command
short-summary: "Create an ADP account."
examples:
- name: Put account
text: |-
az adp account create --name "sampleacct" --location "Global" --resource-group "adpClient"
"""

helps['adp account update'] = """
type: command
short-summary: "Updates the properties of an existing ADP account."
examples:
- name: Patch account
text: |-
az adp account update --name "sampleacct" --resource-group "adpClient"
"""

helps['adp account delete'] = """
type: command
short-summary: "Deletes an ADP account."
examples:
- name: Delete account
text: |-
az adp account delete --name "sampleacct" --resource-group "adpClient"
"""

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

helps['adp data-pool'] = """
type: group
short-summary: Manage data pool with adp
"""

helps['adp data-pool list'] = """
type: command
short-summary: "Lists the data pools under the ADP account."
examples:
- name: List Data Pools
text: |-
az adp data-pool list --account-name "sampleacct" --resource-group "adpClient"
"""

helps['adp data-pool show'] = """
type: command
short-summary: "Gets the properties of a Data Pool."
examples:
- name: Get Data Pool
text: |-
az adp data-pool show --account-name "sampleacct" --name "sampledp" --resource-group "adpClient"
"""

helps['adp data-pool create'] = """
type: command
short-summary: "Create a Data Pool."
parameters:
- name: --locations
short-summary: "Gets or sets the collection of locations where Data Pool resources should be created"
long-summary: |
Usage: --locations name=XX key-vault-uri=XX key-name=XX key-version=XX user-assigned-identity=XX

name: Required. The location name
key-vault-uri: The URI of a soft delete-enabled Key Vault that is in the same location as the Data Pool \
location
key-name: The name of Key Vault key
key-version: The version of Key Vault key
user-assigned-identity: The resource ID of a user-assigned Managed Identity used to access the encryption \
key in the Key Vault. Requires access to the key operations get, wrap, unwrap, and recover

Multiple actions can be specified by using more than one --locations argument.
examples:
- name: Put Data Pool
text: |-
az adp data-pool create --account-name "sampleacct" --name "sampledp" --locations name="westus" \
key-vault-uri="https://vaulturi" key-name="key1" key-version="123" user-assigned-identity="/subscriptions/subid/resourc\
eGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1" --resource-group "adpClient"
"""

helps['adp data-pool update'] = """
type: command
short-summary: "Updates the properties of an existing Data Pool."
parameters:
- name: --locations
short-summary: "Gets or sets the collection of locations where Data Pool resources should be created"
long-summary: |
Usage: --locations name=XX key-vault-uri=XX key-name=XX key-version=XX user-assigned-identity=XX

name: Required. The location name
key-vault-uri: The URI of a soft delete-enabled Key Vault that is in the same location as the Data Pool \
location
key-name: The name of Key Vault key
key-version: The version of Key Vault key
user-assigned-identity: The resource ID of a user-assigned Managed Identity used to access the encryption \
key in the Key Vault. Requires access to the key operations get, wrap, unwrap, and recover

Multiple actions can be specified by using more than one --locations argument.
examples:
- name: Patch Data Pool
text: |-
az adp data-pool update --account-name "sampleacct" --name "sampledp" --locations name="westus" \
--resource-group "adpClient"
"""

helps['adp data-pool delete'] = """
type: command
short-summary: "Deletes a Data Pool."
examples:
- name: Delete Data Pool
text: |-
az adp data-pool delete --account-name "sampleacct" --name "sampledp" --resource-group "adpClient"
"""

helps['adp data-pool wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the adp data-pool is met.
examples:
- name: Pause executing next line of CLI script until the adp data-pool is successfully created.
text: |-
az adp data-pool wait --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" \
--created
- name: Pause executing next line of CLI script until the adp data-pool is successfully updated.
text: |-
az adp data-pool wait --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" \
--updated
- name: Pause executing next line of CLI script until the adp data-pool is successfully deleted.
text: |-
az adp data-pool wait --account-name "sampleacct" --name "sampledp" --resource-group "adpClient" \
--deleted
"""
Loading