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 customproviders] Swagger changes for a new feature for generating LOA for expressRoutePorts resource #42

Open
wants to merge 1 commit into
base: sdkAutomation/customproviders
Choose a base branch
from
Open
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/customproviders/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/customproviders/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'customproviders' Extension
==========================================

This package is for the 'customproviders' extension.
i.e. 'az customproviders'
46 changes: 46 additions & 0 deletions src/customproviders/azext_customproviders/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# --------------------------------------------------------------------------
# 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_customproviders.generated._help import helps # pylint: disable=unused-import


class CustomprovidersCommandsLoader(AzCommandsLoader):

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

def load_command_table(self, args):
from azext_customproviders.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_customproviders.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_customproviders.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_customproviders.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = CustomprovidersCommandsLoader
17 changes: 17 additions & 0 deletions src/customproviders/azext_customproviders/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/customproviders/azext_customproviders/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
17 changes: 17 additions & 0 deletions src/customproviders/azext_customproviders/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/customproviders/azext_customproviders/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__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------
# 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_customproviders(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.customproviders import Customproviders
return get_mgmt_service_client(cli_ctx, Customproviders)


def cf_custom_resource_provider(cli_ctx, *_):
return cf_customproviders(cli_ctx).custom_resource_provider


def cf_association(cli_ctx, *_):
return cf_customproviders(cli_ctx).association
123 changes: 123 additions & 0 deletions src/customproviders/azext_customproviders/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# --------------------------------------------------------------------------
# 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['customproviders custom-resource-provider'] = """
type: group
short-summary: customproviders custom-resource-provider
"""

helps['customproviders custom-resource-provider list'] = """
type: command
short-summary: Gets all the custom resource providers within a subscription.
examples:
- name: List all custom resource providers on the resourceGroup
text: |-
az customproviders custom-resource-provider list --resource-group "testRG"
"""

helps['customproviders custom-resource-provider show'] = """
type: command
short-summary: Gets the custom resource provider manifest.
examples:
- name: Get a custom resource provider
text: |-
az customproviders custom-resource-provider show --resource-group "testRG" --resource-provider-name "new\
rp"
"""

helps['customproviders custom-resource-provider create'] = """
type: command
short-summary: Creates or updates the custom resource provider.
examples:
- name: Create or update the custom resource provider
text: |-
az customproviders custom-resource-provider create --resource-group "testRG" --location "eastus" --actio\
ns name="TestAction" endpoint="https://mytestendpoint/" routing-type="Proxy" --resource-types name="TestResource" endpo\
int="https://mytestendpoint2/" routing-type="Proxy,Cache" --resource-provider-name "newrp"
"""

helps['customproviders custom-resource-provider update'] = """
type: command
short-summary: Updates an existing custom resource provider. The only value that can be updated via PATCH currently\
is the tags.
examples:
- name: Update a custom resource provider
text: |-
az customproviders custom-resource-provider update --resource-group "testRG" --resource-provider-name "n\
ewrp"
"""

helps['customproviders custom-resource-provider delete'] = """
type: command
short-summary: Deletes the custom resource provider.
examples:
- name: Delete a custom resource provider
text: |-
az customproviders custom-resource-provider delete --resource-group "testRG" --resource-provider-name "n\
ewrp"
"""

helps['customproviders association'] = """
type: group
short-summary: customproviders association
"""

helps['customproviders association show'] = """
type: command
short-summary: Get an association.
examples:
- name: Get an association
text: |-
az customproviders association show --association-name "associationName" --scope "scope"
"""

helps['customproviders association create'] = """
type: command
short-summary: Create or update an association.
examples:
- name: Create or update an association
text: |-
az customproviders association create --target-resource-id "/subscriptions/00000000-0000-0000-0000-00000\
0000000/resourceGroups/appRG/providers/Microsoft.Solutions/applications/applicationName" --association-name "associatio\
nName" --scope "scope"
"""

helps['customproviders association update'] = """
type: command
short-summary: Create or update an association.
examples:
- name: Create or update an association
text: |-
az customproviders association update --target-resource-id "/subscriptions/00000000-0000-0000-0000-00000\
0000000/resourceGroups/appRG/providers/Microsoft.Solutions/applications/applicationName" --association-name "associatio\
nName" --scope "scope"
"""

helps['customproviders association delete'] = """
type: command
short-summary: Delete an association.
examples:
- name: Delete an association
text: |-
az customproviders association delete --association-name "associationName" --scope "scope"
"""

helps['customproviders association list-all'] = """
type: command
short-summary: Gets all association for the given scope.
examples:
- name: Get all associations
text: |-
az customproviders association list-all --scope "scope"
"""
84 changes: 84 additions & 0 deletions src/customproviders/azext_customproviders/generated/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# --------------------------------------------------------------------------
# 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
# pylint: disable=too-many-statements

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import (
tags_type,
resource_group_name_type,
get_location_type
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azext_customproviders.action import (
AddActions,
AddResourceTypes,
AddValidations
)


def load_arguments(self, _):

with self.argument_context('customproviders custom-resource-provider list') as c:
c.argument('resource_group_name', resource_group_name_type)

with self.argument_context('customproviders custom-resource-provider show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_provider_name', help='The name of the resource provider.')

with self.argument_context('customproviders custom-resource-provider create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_provider_name', help='The name of the resource provider.')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('tags', tags_type)
c.argument('actions', action=AddActions, nargs='+', help='A list of actions that the custom resource provider i'
'mplements. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: name, endpoint.')
c.argument('resource_types', action=AddResourceTypes, nargs='+', help='A list of resource types that the custom'
' resource provider implements. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: rout'
'ing-type, name, endpoint.')
c.argument('validations', action=AddValidations, nargs='+', help='A list of validations to run on the custom re'
'source provider\'s requests. Expect value: specification=xx.')

with self.argument_context('customproviders custom-resource-provider update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_provider_name', help='The name of the resource provider.')
c.argument('tags', tags_type)

with self.argument_context('customproviders custom-resource-provider delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_provider_name', help='The name of the resource provider.')

with self.argument_context('customproviders association show') as c:
c.argument('scope', help='The scope of the association.')
c.argument('association_name', help='The name of the association.')

with self.argument_context('customproviders association create') as c:
c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For '
'example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Micr'
'osoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.')
c.argument('association_name', help='The name of the association.')
c.argument('target_resource_id',
help='The REST resource instance of the target resource for this association.')

with self.argument_context('customproviders association update') as c:
c.argument('scope', help='The scope of the association. The scope can be any valid REST resource instance. For '
'example, use \'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Micr'
'osoft.Compute/virtualMachines/{vm-name}\' for a virtual machine resource.')
c.argument('association_name', help='The name of the association.')
c.argument('target_resource_id',
help='The REST resource instance of the target resource for this association.')

with self.argument_context('customproviders association delete') as c:
c.argument('scope', help='The scope of the association.')
c.argument('association_name', help='The name of the association.')

with self.argument_context('customproviders association list-all') as c:
c.argument('scope', help='The scope of the association.')
23 changes: 23 additions & 0 deletions src/customproviders/azext_customproviders/generated/_validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------
# 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 example_name_or_id_validator(cmd, namespace):
from azure.cli.core.commands.client_factory import get_subscription_id
from msrestazure.tools import is_valid_resource_id, resource_id
if namespace.storage_account:
if not is_valid_resource_id(namespace.RESOURCE):
namespace.storage_account = resource_id(
subscription=get_subscription_id(cmd.cli_ctx),
resource_group=namespace.resource_group_name,
namespace='Microsoft.Storage',
type='storageAccounts',
name=namespace.storage_account
)
Loading