This commit is contained in:
Zim Kalinowski 2020-02-25 09:33:26 +01:00
Родитель d9a759afdb
Коммит 46f99e9d5e
8 изменённых файлов: 4 добавлений и 957 удалений

Просмотреть файл

@ -5,14 +5,14 @@
from azure.cli.core import AzCommandsLoader
from azext_managed_network._help import helps # pylint: disable=unused-import
from azext_managed_network.generated._help import helps # pylint: disable=unused-import
class ManagedNetworkManagementClientCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_managed_network._client_factory import cf_managed_network
from azext_managed_network.generated._client_factory import cf_managed_network
managed_network_custom = CliCommandType(
operations_tmpl='azext_managed_network.custom#{}',
client_factory=cf_managed_network)
@ -20,12 +20,12 @@ class ManagedNetworkManagementClientCommandsLoader(AzCommandsLoader):
custom_command_type=managed_network_custom)
def load_command_table(self, args):
from azext_managed_network.commands import load_command_table
from azext_managed_network.generated.commands import load_command_table
load_command_table(self, args)
return self.command_table
def load_arguments(self, command):
from azext_managed_network._params import load_arguments
from azext_managed_network.generated._params import load_arguments
load_arguments(self, command)

Просмотреть файл

@ -1,30 +0,0 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
def cf_managed_network(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .vendored_sdks.managednetwork import ManagedNetworkManagementClient
return get_mgmt_service_client(cli_ctx, ManagedNetworkManagementClient)
def cf_managed_networks(cli_ctx, *_):
return cf_managed_network(cli_ctx).managed_networks
def cf_scope_assignments(cli_ctx, *_):
return cf_managed_network(cli_ctx).scope_assignments
def cf_managed_network_groups(cli_ctx, *_):
return cf_managed_network(cli_ctx).managed_network_groups
def cf_managed_network_peering_policies(cli_ctx, *_):
return cf_managed_network(cli_ctx).managed_network_peering_policies
def cf_operations(cli_ctx, *_):
return cf_managed_network(cli_ctx).operations

Просмотреть файл

@ -1,252 +0,0 @@
# 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.
# --------------------------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=line-too-long
from knack.help_files import helps # pylint: disable=unused-import
helps['managed-network managed-networks'] = """
type: group
short-summary: managed-network managed-networks
"""
helps['managed-network managed-networks list'] = """
type: command
short-summary: The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current subscription in a paginated format.
examples:
- name: Get Managed Network
text: |-
az managed-network managed-networks list --resource-group "myResourceGroup"
"""
helps['managed-network managed-networks show'] = """
type: command
short-summary: The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed Network name
examples:
- name: Get Managed Network
text: |-
az managed-network managed-networks show --managed-network-name "myManagedNetwork" \\
--resource-group "myResourceGroup"
"""
helps['managed-network managed-networks create'] = """
type: command
short-summary: The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and Managed Network name
examples:
- name: Create/Update Managed Network
text: |-
az managed-network managed-networks create --location "eastus" --managed-network-name \\
"myManagedNetwork" --resource-group "myResourceGroup"
"""
helps['managed-network managed-networks update'] = """
type: command
short-summary: Updates the specified Managed Network resource tags.
examples:
- name: Create/Update Managed Network
text: |-
az managed-network managed-networks update --managed-network-name "myManagedNetwork" \\
--resource-group "myResourceGroup"
"""
helps['managed-network managed-networks delete'] = """
type: command
short-summary: The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and Managed Network name
examples:
- name: Delete Managed Network
text: |-
az managed-network managed-networks delete --managed-network-name "myManagedNetwork" \\
--resource-group "myResourceGroup"
"""
helps['managed-network scope-assignments'] = """
type: group
short-summary: managed-network scope-assignments
"""
helps['managed-network scope-assignments list'] = """
type: command
short-summary: Get the specified scope assignment.
examples:
- name: Create/Update Managed Network
text: |-
az managed-network scope-assignments list --scope "subscriptions/subscriptionC"
"""
helps['managed-network scope-assignments show'] = """
type: command
short-summary: Get the specified scope assignment.
examples:
- name: Create/Update Managed Network
text: |-
az managed-network scope-assignments show --scope "subscriptions/subscriptionC" \\
--scope-assignment-name "subscriptionCAssignment"
"""
helps['managed-network scope-assignments create'] = """
type: command
short-summary: Creates a scope assignment.
examples:
- name: Create/Update Managed Network
text: |-
az managed-network scope-assignments create --assigned-managed-network "/subscriptions/sub
scriptionA/resourceGroups/myResourceGroup/providers/Microsoft.ManagedNetwork/managedNetwor
ks/myManagedNetwork" --scope "subscriptions/subscriptionC" --scope-assignment-name \\
"subscriptionCAssignment"
"""
helps['managed-network scope-assignments update'] = """
type: command
short-summary: Creates a scope assignment.
examples:
- name: Create/Update Managed Network
text: |-
az managed-network scope-assignments create --assigned-managed-network "/subscriptions/sub
scriptionA/resourceGroups/myResourceGroup/providers/Microsoft.ManagedNetwork/managedNetwor
ks/myManagedNetwork" --scope "subscriptions/subscriptionC" --scope-assignment-name \\
"subscriptionCAssignment"
"""
helps['managed-network scope-assignments delete'] = """
type: command
short-summary: Deletes a scope assignment.
examples:
- name: Create/Update Managed Network
text: |-
az managed-network scope-assignments delete --scope "subscriptions/subscriptionC" \\
--scope-assignment-name "subscriptionCAssignment"
"""
helps['managed-network managed-network-groups'] = """
type: group
short-summary: managed-network managed-network-groups
"""
helps['managed-network managed-network-groups list'] = """
type: command
short-summary: The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified Managed Networks in a paginated format.
examples:
- name: Get Managed Network Group
text: |-
az managed-network managed-network-groups list --managed-network-name "myManagedNetwork" \\
--resource-group "myResourceGroup"
"""
helps['managed-network managed-network-groups show'] = """
type: command
short-summary: The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed Network name, and group name
examples:
- name: Get Managed Network Group
text: |-
az managed-network managed-network-groups show --managed-network-group-name \\
"myManagedNetworkGroup1" --managed-network-name "myManagedNetwork" --resource-group \\
"myResourceGroup"
"""
helps['managed-network managed-network-groups create'] = """
type: command
short-summary: The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource
examples:
- name: Create/Update Managed Network Group
text: |-
az managed-network managed-network-groups create --managed-network-group-name \\
"myManagedNetworkGroup1" --managed-network-name "myManagedNetwork" --resource-group \\
"myResourceGroup"
"""
helps['managed-network managed-network-groups update'] = """
type: command
short-summary: The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource
examples:
- name: Create/Update Managed Network Group
text: |-
az managed-network managed-network-groups create --managed-network-group-name \\
"myManagedNetworkGroup1" --managed-network-name "myManagedNetwork" --resource-group \\
"myResourceGroup"
"""
helps['managed-network managed-network-groups delete'] = """
type: command
short-summary: The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, Managed Network name, and group name
examples:
- name: Delete Managed Network Group
text: |-
az managed-network managed-network-groups delete --managed-network-group-name \\
"myManagedNetworkGroup1" --managed-network-name "myManagedNetwork" --resource-group \\
"myResourceGroup"
"""
helps['managed-network managed-network-peering-policies'] = """
type: group
short-summary: managed-network managed-network-peering-policies
"""
helps['managed-network managed-network-peering-policies list'] = """
type: command
short-summary: The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a specified Managed Network, in a paginated format.
examples:
- name: Get Managed Network Group
text: |-
az managed-network managed-network-peering-policies list --managed-network-name \\
"myManagedNetwork" --resource-group "myResourceGroup"
"""
helps['managed-network managed-network-peering-policies show'] = """
type: command
short-summary: The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the resource group, Managed Network name, and peering policy name
examples:
- name: Get Managed Network Peering Policy
text: |-
az managed-network managed-network-peering-policies show --managed-network-name \\
"myManagedNetwork" --managed-network-peering-policy-name "myHubAndSpoke" --resource-group \\
"myResourceGroup"
"""
helps['managed-network managed-network-peering-policies create'] = """
type: command
short-summary: The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy
examples:
- name: Create/Update Managed Network Peering Policy
text: |-
az managed-network managed-network-peering-policies create --managed-network-name \\
"myManagedNetwork" --managed-network-peering-policy-name "myHubAndSpoke" --type \\
"HubAndSpokeTopology" --id "/subscriptionB/resourceGroups/myResourceGroup/providers/Micros
oft.Network/virtualNetworks/myHubVnet" --resource-group "myResourceGroup"
"""
helps['managed-network managed-network-peering-policies update'] = """
type: command
short-summary: The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy
examples:
- name: Create/Update Managed Network Peering Policy
text: |-
az managed-network managed-network-peering-policies create --managed-network-name \\
"myManagedNetwork" --managed-network-peering-policy-name "myHubAndSpoke" --type \\
"HubAndSpokeTopology" --id "/subscriptionB/resourceGroups/myResourceGroup/providers/Micros
oft.Network/virtualNetworks/myHubVnet" --resource-group "myResourceGroup"
"""
helps['managed-network managed-network-peering-policies delete'] = """
type: command
short-summary: The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the resource group, Managed Network name, and peering policy name
examples:
- name: Get Managed Network Peering Policy
text: |-
az managed-network managed-network-peering-policies delete --managed-network-name \\
"myManagedNetwork" --managed-network-peering-policy-name "myHubAndSpoke" --resource-group \\
"myResourceGroup"
"""
helps['managed-network operations'] = """
type: group
short-summary: managed-network operations
"""
helps['managed-network operations list'] = """
type: command
short-summary: Lists all of the available MNC operations.
"""

Просмотреть файл

@ -1,151 +0,0 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements
from azure.cli.core.commands.parameters import (
tags_type,
get_enum_type,
resource_group_name_type,
get_location_type
)
from azext_managed_network.actions import (
AddManagementGroups,
AddSubscriptions,
AddVirtualNetworks,
AddSubnets,
AddSpokes,
AddMesh
)
def load_arguments(self, _):
with self.argument_context('managed-network managed-networks list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('top', id_part=None, help='May be used to limit the number of results in a page for list queries.')
c.argument('skiptoken', id_part=None, help='Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.')
with self.argument_context('managed-network managed-networks show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
with self.argument_context('managed-network managed-networks create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('tags', tags_type, nargs='+')
c.argument('scope_management_groups', id_part=None, help='The collection of management groups covered by the Managed Network', action=AddManagementGroups, nargs='+')
c.argument('scope_subscriptions', id_part=None, help='The collection of subscriptions covered by the Managed Network', action=AddSubscriptions, nargs='+')
c.argument('scope_virtual_networks', id_part=None, help='The collection of virtual nets covered by the Managed Network', action=AddVirtualNetworks, nargs='+')
c.argument('scope_subnets', id_part=None, help='The collection of subnets covered by the Managed Network', action=AddSubnets, nargs='+')
with self.argument_context('managed-network managed-networks update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('tags', tags_type, nargs='+')
with self.argument_context('managed-network managed-networks delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
with self.argument_context('managed-network scope-assignments list') as c:
c.argument('scope', id_part=None, help='The base resource of the scope assignment.')
with self.argument_context('managed-network scope-assignments show') as c:
c.argument('scope', id_part=None, help='The base resource of the scope assignment.')
c.argument('scope_assignment_name', id_part=None, help='The name of the scope assignment to get.')
with self.argument_context('managed-network scope-assignments create') as c:
c.argument('scope', id_part=None, help='The base resource of the scope assignment.')
c.argument('scope_assignment_name', id_part=None, help='The name of the scope assignment to get.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('assigned_managed_network', id_part=None, help='The managed network ID with scope will be assigned to.')
with self.argument_context('managed-network scope-assignments update') as c:
c.argument('scope', id_part=None, help='The base resource of the scope assignment.')
c.argument('scope_assignment_name', id_part=None, help='The name of the scope assignment to get.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('assigned_managed_network', id_part=None, help='The managed network ID with scope will be assigned to.')
with self.argument_context('managed-network scope-assignments delete') as c:
c.argument('scope', id_part=None, help='The base resource of the scope assignment.')
c.argument('scope_assignment_name', id_part=None, help='The name of the scope assignment to get.')
with self.argument_context('managed-network managed-network-groups list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('top', id_part=None, help='May be used to limit the number of results in a page for list queries.')
c.argument('skiptoken', id_part=None, help='Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.')
with self.argument_context('managed-network managed-network-groups show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_group_name', id_part=None, help='The name of the Managed Network Group.')
with self.argument_context('managed-network managed-network-groups create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_group_name', id_part=None, help='The name of the Managed Network Group.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('management_groups', id_part=None, help='The collection of management groups covered by the Managed Network', action=AddManagementGroups, nargs='+')
c.argument('subscriptions', id_part=None, help='The collection of subscriptions covered by the Managed Network', action=AddSubscriptions, nargs='+')
c.argument('virtual_networks', id_part=None, help='The collection of virtual nets covered by the Managed Network', action=AddVirtualNetworks, nargs='+')
c.argument('subnets', id_part=None, help='The collection of subnets covered by the Managed Network', action=AddSubnets, nargs='+')
with self.argument_context('managed-network managed-network-groups update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_group_name', id_part=None, help='The name of the Managed Network Group.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('management_groups', id_part=None, help='The collection of management groups covered by the Managed Network', action=AddManagementGroups, nargs='+')
c.argument('subscriptions', id_part=None, help='The collection of subscriptions covered by the Managed Network', action=AddSubscriptions, nargs='+')
c.argument('virtual_networks', id_part=None, help='The collection of virtual nets covered by the Managed Network', action=AddVirtualNetworks, nargs='+')
c.argument('subnets', id_part=None, help='The collection of subnets covered by the Managed Network', action=AddSubnets, nargs='+')
with self.argument_context('managed-network managed-network-groups delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_group_name', id_part=None, help='The name of the Managed Network Group.')
with self.argument_context('managed-network managed-network-peering-policies list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('top', id_part=None, help='May be used to limit the number of results in a page for list queries.')
c.argument('skiptoken', id_part=None, help='Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.')
with self.argument_context('managed-network managed-network-peering-policies show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_peering_policy_name', id_part=None, help='The name of the Managed Network Peering Policy.')
with self.argument_context('managed-network managed-network-peering-policies create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_peering_policy_name', id_part=None, help='The name of the Managed Network Peering Policy.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('properties_type', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']), id_part=None, help='Gets or sets the connectivity type of a network structure policy')
c.argument('id', id_part=None, help='Resource Id')
c.argument('properties_spokes', id_part=None, help='Gets or sets the spokes group IDs', action=AddSpokes, nargs='+')
c.argument('properties_mesh', id_part=None, help='Gets or sets the mesh group IDs', action=AddMesh, nargs='+')
with self.argument_context('managed-network managed-network-peering-policies update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_peering_policy_name', id_part=None, help='The name of the Managed Network Peering Policy.')
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('properties_type', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']), id_part=None, help='Gets or sets the connectivity type of a network structure policy')
c.argument('id', id_part=None, help='Resource Id')
c.argument('properties_spokes', id_part=None, help='Gets or sets the spokes group IDs', action=AddSpokes, nargs='+')
c.argument('properties_mesh', id_part=None, help='Gets or sets the mesh group IDs', action=AddMesh, nargs='+')
with self.argument_context('managed-network managed-network-peering-policies delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('managed_network_name', id_part=None, help='The name of the Managed Network.')
c.argument('managed_network_peering_policy_name', id_part=None, help='The name of the Managed Network Peering Policy.')
with self.argument_context('managed-network operations list') as c:
pass

Просмотреть файл

@ -1,18 +0,0 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
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
)

Просмотреть файл

@ -1,260 +0,0 @@
import argparse
from knack.util import CLIError
# pylint: disable=protected-access
class AddManagedNetwork(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddManagementGroups(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddSubscriptions(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddVirtualNetworks(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddSubnets(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddParameters(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddParameters(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddManagedNetworkGroup(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddManagementGroups(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddSubscriptions(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddVirtualNetworks(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddSubnets(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddManagedNetworkPolicy(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddSpokes(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d
class AddMesh(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(ImageBuilderAddCustomize, self).__call__(parser, namespace, action, option_string)
def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = dict(x.split('=', 1) for x in values)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
return d

Просмотреть файл

@ -1,64 +0,0 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
from azure.cli.core.commands import CliCommandType
def load_command_table(self, _):
from ._client_factory import cf_managed_networks
managed_network_managed_networks = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._managed_networks_operations#ManagedNetworksOperations.{}',
client_factory=cf_managed_networks)
with self.command_group('managed-network managed-networks', managed_network_managed_networks, client_factory=cf_managed_networks) as g:
g.custom_command('list', 'managed_network_managed_networks_list')
g.custom_show_command('show', 'managed_network_managed_networks_show')
g.custom_command('create', 'managed_network_managed_networks_create')
g.custom_command('update', 'managed_network_managed_networks_update')
g.custom_command('delete', 'managed_network_managed_networks_delete')
from ._client_factory import cf_scope_assignments
managed_network_scope_assignments = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._scope_assignments_operations#ScopeAssignmentsOperations.{}',
client_factory=cf_scope_assignments)
with self.command_group('managed-network scope-assignments', managed_network_scope_assignments, client_factory=cf_scope_assignments) as g:
g.custom_command('list', 'managed_network_scope_assignments_list')
g.custom_show_command('show', 'managed_network_scope_assignments_show')
g.custom_command('create', 'managed_network_scope_assignments_create')
g.custom_command('update', 'managed_network_scope_assignments_update')
g.custom_command('delete', 'managed_network_scope_assignments_delete')
from ._client_factory import cf_managed_network_groups
managed_network_managed_network_groups = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._managed_network_groups_operations#ManagedNetworkGroupsOperations.{}',
client_factory=cf_managed_network_groups)
with self.command_group('managed-network managed-network-groups', managed_network_managed_network_groups, client_factory=cf_managed_network_groups) as g:
g.custom_command('list', 'managed_network_managed_network_groups_list')
g.custom_show_command('show', 'managed_network_managed_network_groups_show')
g.custom_command('create', 'managed_network_managed_network_groups_create')
g.custom_command('update', 'managed_network_managed_network_groups_update')
g.custom_command('delete', 'managed_network_managed_network_groups_delete')
from ._client_factory import cf_managed_network_peering_policies
managed_network_managed_network_peering_policies = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._managed_network_peering_policies_operations#ManagedNetworkPeeringPoliciesOperations.{}',
client_factory=cf_managed_network_peering_policies)
with self.command_group('managed-network managed-network-peering-policies', managed_network_managed_network_peering_policies, client_factory=cf_managed_network_peering_policies) as g:
g.custom_command('list', 'managed_network_managed_network_peering_policies_list')
g.custom_show_command('show', 'managed_network_managed_network_peering_policies_show')
g.custom_command('create', 'managed_network_managed_network_peering_policies_create')
g.custom_command('update', 'managed_network_managed_network_peering_policies_update')
g.custom_command('delete', 'managed_network_managed_network_peering_policies_delete')
from ._client_factory import cf_operations
managed_network_operations = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._operations_operations#OperationsOperations.{}',
client_factory=cf_operations)
with self.command_group('managed-network operations', managed_network_operations, client_factory=cf_operations) as g:
g.custom_command('list', 'managed_network_operations_list')

Просмотреть файл

@ -1,178 +0,0 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-statements
# pylint: disable=too-many-lines
# pylint: disable=too-many-locals
# pylint: disable=unused-argument
def managed_network_managed_networks_list(cmd, client,
resource_group_name=None,
top=None,
skiptoken=None):
if resource_group_name is not None:
return client.list_by_resource_group(resource_group_name=resource_group_name, top=top, skiptoken=skiptoken)
return client.list_by_subscription(top=top, skiptoken=skiptoken)
def managed_network_managed_networks_show(cmd, client,
resource_group_name,
managed_network_name):
return client.get(resource_group_name=resource_group_name, managed_network_name=managed_network_name)
def managed_network_managed_networks_create(cmd, client,
resource_group_name,
managed_network_name,
location=None,
tags=None,
scope_management_groups=None,
scope_subscriptions=None,
scope_virtual_networks=None,
scope_subnets=None):
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, location=location, tags=tags, management_groups=scope_management_groups, subscriptions=scope_subscriptions, virtual_networks=scope_virtual_networks, subnets=scope_subnets)
def managed_network_managed_networks_update(cmd, client,
resource_group_name,
managed_network_name,
tags=None):
return client.update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, tags=tags)
def managed_network_managed_networks_delete(cmd, client,
resource_group_name,
managed_network_name):
return client.delete(resource_group_name=resource_group_name, managed_network_name=managed_network_name)
def managed_network_scope_assignments_list(cmd, client,
scope):
return client.list(scope=scope)
def managed_network_scope_assignments_show(cmd, client,
scope,
scope_assignment_name):
return client.get(scope=scope, scope_assignment_name=scope_assignment_name)
def managed_network_scope_assignments_create(cmd, client,
scope,
scope_assignment_name,
location=None,
assigned_managed_network=None):
return client.create_or_update(scope=scope, scope_assignment_name=scope_assignment_name, location=location, assigned_managed_network=assigned_managed_network)
def managed_network_scope_assignments_update(cmd, client,
scope,
scope_assignment_name,
location=None,
assigned_managed_network=None):
return client.create_or_update(scope=scope, scope_assignment_name=scope_assignment_name, location=location, assigned_managed_network=assigned_managed_network)
def managed_network_scope_assignments_delete(cmd, client,
scope,
scope_assignment_name):
return client.delete(scope=scope, scope_assignment_name=scope_assignment_name)
def managed_network_managed_network_groups_list(cmd, client,
resource_group_name,
managed_network_name,
top=None,
skiptoken=None):
return client.list_by_managed_network(resource_group_name=resource_group_name, managed_network_name=managed_network_name, top=top, skiptoken=skiptoken)
def managed_network_managed_network_groups_show(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name):
return client.get(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name)
def managed_network_managed_network_groups_create(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name,
location=None,
management_groups=None,
subscriptions=None,
virtual_networks=None,
subnets=None):
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name, location=location, management_groups=management_groups, subscriptions=subscriptions, virtual_networks=virtual_networks, subnets=subnets)
def managed_network_managed_network_groups_update(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name,
location=None,
management_groups=None,
subscriptions=None,
virtual_networks=None,
subnets=None):
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name, location=location, management_groups=management_groups, subscriptions=subscriptions, virtual_networks=virtual_networks, subnets=subnets)
def managed_network_managed_network_groups_delete(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name):
return client.delete(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name)
def managed_network_managed_network_peering_policies_list(cmd, client,
resource_group_name,
managed_network_name,
top=None,
skiptoken=None):
return client.list_by_managed_network(resource_group_name=resource_group_name, managed_network_name=managed_network_name, top=top, skiptoken=skiptoken)
def managed_network_managed_network_peering_policies_show(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name):
return client.get(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name)
def managed_network_managed_network_peering_policies_create(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name,
properties_type,
location=None,
id=None,
properties_spokes=None,
properties_mesh=None):
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name, location=location, type=properties_type, id=id, spokes=properties_spokes, mesh=properties_mesh)
def managed_network_managed_network_peering_policies_update(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name,
properties_type,
location=None,
id=None,
properties_spokes=None,
properties_mesh=None):
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name, location=location, type=properties_type, id=id, spokes=properties_spokes, mesh=properties_mesh)
def managed_network_managed_network_peering_policies_delete(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name):
return client.delete(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name)
def managed_network_operations_list(cmd, client):
return client.list()