recursive-payload-flattening: true

This commit is contained in:
qiaozha 2020-02-21 18:07:54 +08:00
Родитель 3b673ab843
Коммит 7691b90c41
10 изменённых файлов: 187 добавлений и 41 удалений

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

@ -18,7 +18,7 @@ modelerfour:
#payload-flattening-threshold: 4
#recursive-payload-flattening: true
recursive-payload-flattening: true
pipeline:
az/clicommon:

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

@ -8,16 +8,17 @@
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 (
AddScope,
AddManagementGroups,
AddSubscriptions,
AddVirtualNetworks,
AddSubnets,
AddProperties
AddSpokes,
AddMesh
)
@ -37,7 +38,10 @@ def load_arguments(self, _):
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', id_part=None, help='Scope of a Managed Network', action=AddScope, 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)
@ -123,14 +127,20 @@ def load_arguments(self, _):
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', id_part=None, help='Properties of a Managed Network Peering Policy', action=AddProperties, nargs='+')
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', id_part=None, help='Properties of a Managed Network Peering Policy', action=AddProperties, nargs='+')
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)

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

@ -22,7 +22,58 @@ class AddManagedNetwork(argparse._AppendAction):
return d
class AddScope(argparse._AppendAction):
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)
@ -175,7 +226,24 @@ class AddManagedNetworkPolicy(argparse._AppendAction):
return d
class AddProperties(argparse._AppendAction):
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)

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

@ -29,8 +29,11 @@ def managed_network_managed_networks_create(cmd, client,
managed_network_name,
location=None,
tags=None,
scope=None):
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, location=location, tags=tags, scope=scope)
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,
@ -144,18 +147,24 @@ 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,
properties=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, properties=properties)
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,
properties=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, properties=properties)
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,

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

@ -39,6 +39,8 @@ class ManagedNetworkManagementClientScenarioTest(ScenarioTest):
self.cmd('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/Microsoft.Network/virtualNetworks/myHubVnet" '
'--resource-group-name {rg}',
checks=[])

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

@ -3,7 +3,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6198, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -103,14 +103,17 @@ class ManagedNetworkPeeringPoliciesOperations:
resource_group_name: str,
managed_network_name: str,
managed_network_peering_policy_name: str,
type: Union[str, "models.Type"],
location: Optional[str] = None,
properties: Optional["models.ManagedNetworkPeeringPolicyProperties"] = None,
id: Optional[str] = None,
spokes: Optional[List["ResourceId"]] = None,
mesh: Optional[List["ResourceId"]] = None,
**kwargs
) -> "models.ManagedNetworkPeeringPolicy":
cls: ClsType["models.ManagedNetworkPeeringPolicy"] = kwargs.pop('cls', None )
error_map = kwargs.pop('error_map', {})
managed_network_policy = models.ManagedNetworkPeeringPolicy(location=location, properties=properties)
managed_network_policy = models.ManagedNetworkPeeringPolicy(location=location, type=type, id=id, spokes=spokes, mesh=mesh)
api_version = "2019-06-01-preview"
# Construct URL
@ -162,8 +165,11 @@ class ManagedNetworkPeeringPoliciesOperations:
resource_group_name: str,
managed_network_name: str,
managed_network_peering_policy_name: str,
type: Union[str, "models.Type"],
location: Optional[str] = None,
properties: Optional["models.ManagedNetworkPeeringPolicyProperties"] = None,
id: Optional[str] = None,
spokes: Optional[List["ResourceId"]] = None,
mesh: Optional[List["ResourceId"]] = None,
**kwargs
) -> "models.ManagedNetworkPeeringPolicy":
"""The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy.
@ -174,10 +180,16 @@ class ManagedNetworkPeeringPoliciesOperations:
:type managed_network_name: str
:param managed_network_peering_policy_name: The name of the Managed Network Peering Policy.
:type managed_network_peering_policy_name: str
:param type: Gets or sets the connectivity type of a network structure policy.
:type type: str or ~managed_network_management_client.models.Type
:param location: The geo-location where the resource lives.
:type location: str
:param properties: Properties of a Managed Network Peering Policy.
:type properties: ~managed_network_management_client.models.ManagedNetworkPeeringPolicyProperties
:param id: Resource Id.
:type id: str
:param spokes: Gets or sets the spokes group IDs.
:type spokes: list[~managed_network_management_client.models.ResourceId]
:param mesh: Gets or sets the mesh group IDs.
:type mesh: list[~managed_network_management_client.models.ResourceId]
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
@ -193,8 +205,11 @@ class ManagedNetworkPeeringPoliciesOperations:
resource_group_name=resource_group_name,
managed_network_name=managed_network_name,
managed_network_peering_policy_name=managed_network_peering_policy_name,
type=type,
location=location,
properties=properties,
id=id,
spokes=spokes,
mesh=mesh,
cls=lambda x,y,z: x,
**kwargs
)

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

@ -3,7 +3,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6198, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
@ -100,7 +100,10 @@ class ManagedNetworksOperations:
managed_network_name: str,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
scope: Optional["models.Scope"] = None,
management_groups: Optional[List["ResourceId"]] = None,
subscriptions: Optional[List["ResourceId"]] = None,
virtual_networks: Optional[List["ResourceId"]] = None,
subnets: Optional[List["ResourceId"]] = None,
**kwargs
) -> "models.ManagedNetwork":
"""The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and Managed Network name.
@ -113,8 +116,14 @@ class ManagedNetworksOperations:
:type location: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param scope: Scope of a Managed Network.
:type scope: ~managed_network_management_client.models.Scope
:param management_groups: The collection of management groups covered by the Managed Network.
:type management_groups: list[~managed_network_management_client.models.ResourceId]
:param subscriptions: The collection of subscriptions covered by the Managed Network.
:type subscriptions: list[~managed_network_management_client.models.ResourceId]
:param virtual_networks: The collection of virtual nets covered by the Managed Network.
:type virtual_networks: list[~managed_network_management_client.models.ResourceId]
:param subnets: The collection of subnets covered by the Managed Network.
:type subnets: list[~managed_network_management_client.models.ResourceId]
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ManagedNetwork or ManagedNetwork or the result of cls(response)
:rtype: ~managed_network_management_client.models.ManagedNetwork or ~managed_network_management_client.models.ManagedNetwork
@ -123,7 +132,7 @@ class ManagedNetworksOperations:
cls: ClsType["models.ManagedNetwork"] = kwargs.pop('cls', None )
error_map = kwargs.pop('error_map', {})
managed_network = models.ManagedNetwork(location=location, tags=tags, scope=scope)
managed_network = models.ManagedNetwork(location=location, tags=tags, management_groups=management_groups, subscriptions=subscriptions, virtual_networks=virtual_networks, subnets=subnets)
api_version = "2019-06-01-preview"
# Construct URL

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

@ -3,7 +3,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6198, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings
from azure.core.exceptions import map_error
@ -104,15 +104,18 @@ class ManagedNetworkPeeringPoliciesOperations(object):
resource_group_name, # type: str
managed_network_name, # type: str
managed_network_peering_policy_name, # type: str
type, # type: Union[str, "models.Type"]
location=None, # type: Optional[str]
properties=None, # type: Optional["models.ManagedNetworkPeeringPolicyProperties"]
id=None, # type: Optional[str]
spokes=None, # type: Optional[List["ResourceId"]]
mesh=None, # type: Optional[List["ResourceId"]]
**kwargs # type: Any
):
# type: (...) -> "models.ManagedNetworkPeeringPolicy"
cls = kwargs.pop('cls', None ) # type: ClsType["models.ManagedNetworkPeeringPolicy"]
error_map = kwargs.pop('error_map', {})
managed_network_policy = models.ManagedNetworkPeeringPolicy(location=location, properties=properties)
managed_network_policy = models.ManagedNetworkPeeringPolicy(location=location, type=type, id=id, spokes=spokes, mesh=mesh)
api_version = "2019-06-01-preview"
# Construct URL
@ -164,8 +167,11 @@ class ManagedNetworkPeeringPoliciesOperations(object):
resource_group_name, # type: str
managed_network_name, # type: str
managed_network_peering_policy_name, # type: str
type, # type: Union[str, "models.Type"]
location=None, # type: Optional[str]
properties=None, # type: Optional["models.ManagedNetworkPeeringPolicyProperties"]
id=None, # type: Optional[str]
spokes=None, # type: Optional[List["ResourceId"]]
mesh=None, # type: Optional[List["ResourceId"]]
**kwargs # type: Any
):
# type: (...) -> "models.ManagedNetworkPeeringPolicy"
@ -177,10 +183,16 @@ class ManagedNetworkPeeringPoliciesOperations(object):
:type managed_network_name: str
:param managed_network_peering_policy_name: The name of the Managed Network Peering Policy.
:type managed_network_peering_policy_name: str
:param type: Gets or sets the connectivity type of a network structure policy.
:type type: str or ~managed_network_management_client.models.Type
:param location: The geo-location where the resource lives.
:type location: str
:param properties: Properties of a Managed Network Peering Policy.
:type properties: ~managed_network_management_client.models.ManagedNetworkPeeringPolicyProperties
:param id: Resource Id.
:type id: str
:param spokes: Gets or sets the spokes group IDs.
:type spokes: list[~managed_network_management_client.models.ResourceId]
:param mesh: Gets or sets the mesh group IDs.
:type mesh: list[~managed_network_management_client.models.ResourceId]
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
@ -196,8 +208,11 @@ class ManagedNetworkPeeringPoliciesOperations(object):
resource_group_name=resource_group_name,
managed_network_name=managed_network_name,
managed_network_peering_policy_name=managed_network_peering_policy_name,
type=type,
location=location,
properties=properties,
id=id,
spokes=spokes,
mesh=mesh,
cls=lambda x,y,z: x,
**kwargs
)

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

@ -3,7 +3,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6198, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings
from azure.core.exceptions import map_error
@ -101,7 +101,10 @@ class ManagedNetworksOperations(object):
managed_network_name, # type: str
location=None, # type: Optional[str]
tags=None, # type: Optional[Dict[str, str]]
scope=None, # type: Optional["models.Scope"]
management_groups=None, # type: Optional[List["ResourceId"]]
subscriptions=None, # type: Optional[List["ResourceId"]]
virtual_networks=None, # type: Optional[List["ResourceId"]]
subnets=None, # type: Optional[List["ResourceId"]]
**kwargs # type: Any
):
# type: (...) -> "models.ManagedNetwork"
@ -115,8 +118,14 @@ class ManagedNetworksOperations(object):
:type location: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param scope: Scope of a Managed Network.
:type scope: ~managed_network_management_client.models.Scope
:param management_groups: The collection of management groups covered by the Managed Network.
:type management_groups: list[~managed_network_management_client.models.ResourceId]
:param subscriptions: The collection of subscriptions covered by the Managed Network.
:type subscriptions: list[~managed_network_management_client.models.ResourceId]
:param virtual_networks: The collection of virtual nets covered by the Managed Network.
:type virtual_networks: list[~managed_network_management_client.models.ResourceId]
:param subnets: The collection of subnets covered by the Managed Network.
:type subnets: list[~managed_network_management_client.models.ResourceId]
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ManagedNetwork or ManagedNetwork or the result of cls(response)
:rtype: ~managed_network_management_client.models.ManagedNetwork or ~managed_network_management_client.models.ManagedNetwork
@ -125,7 +134,7 @@ class ManagedNetworksOperations(object):
cls = kwargs.pop('cls', None ) # type: ClsType["models.ManagedNetwork"]
error_map = kwargs.pop('error_map', {})
managed_network = models.ManagedNetwork(location=location, tags=tags, scope=scope)
managed_network = models.ManagedNetwork(location=location, tags=tags, management_groups=management_groups, subscriptions=subscriptions, virtual_networks=virtual_networks, subnets=subnets)
api_version = "2019-06-01-preview"
# Construct URL

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

@ -59,8 +59,11 @@ create a managed-network managed-network-peering-policies.
|------|----|-----------|----------|--------------|
|**--api-version**|constant|Api Version|/something/my_option|/something/myOption|
|**--managed-network-policy**|object|Parameters supplied to create/update a Managed Network Peering Policy|/something/my_option|/something/myOption|
|**--type**|choice|Gets or sets the connectivity type of a network structure policy|/something/my_option|/something/myOption|
|--location**|string|The geo-location where the resource lives|/something/my_option|/something/myOption|
|--properties**|object|Properties of a Managed Network Peering Policy|/something/my_option|/something/myOption|
|--id**|string|Resource Id|/something/my_option|/something/myOption|
|--spokes**|array|Gets or sets the spokes group IDs|/something/my_option|/something/myOption|
|--mesh**|array|Gets or sets the mesh group IDs|/something/my_option|/something/myOption|
### managed-network managed-network-peering-policies delete
delete a managed-network managed-network-peering-policies.
@ -92,8 +95,11 @@ create a managed-network managed-network-peering-policies.
|------|----|-----------|----------|--------------|
|**--api-version**|constant|Api Version|/something/my_option|/something/myOption|
|**--managed-network-policy**|object|Parameters supplied to create/update a Managed Network Peering Policy|/something/my_option|/something/myOption|
|**--type**|choice|Gets or sets the connectivity type of a network structure policy|/something/my_option|/something/myOption|
|--location**|string|The geo-location where the resource lives|/something/my_option|/something/myOption|
|--properties**|object|Properties of a Managed Network Peering Policy|/something/my_option|/something/myOption|
|--id**|string|Resource Id|/something/my_option|/something/myOption|
|--spokes**|array|Gets or sets the spokes group IDs|/something/my_option|/something/myOption|
|--mesh**|array|Gets or sets the mesh group IDs|/something/my_option|/something/myOption|
### managed-network managed-networks create
create a managed-network managed-networks.
@ -104,7 +110,10 @@ create a managed-network managed-networks.
|**--managed-network**|object|Parameters supplied to the create/update a Managed Network Resource|/something/my_option|/something/myOption|
|--location**|string|The geo-location where the resource lives|/something/my_option|/something/myOption|
|--tags**|dictionary|Resource tags|/something/my_option|/something/myOption|
|--scope**|object|Scope of a Managed Network|/something/my_option|/something/myOption|
|--management-groups**|array|The collection of management groups covered by the Managed Network|/something/my_option|/something/myOption|
|--subscriptions**|array|The collection of subscriptions covered by the Managed Network|/something/my_option|/something/myOption|
|--virtual-networks**|array|The collection of virtual nets covered by the Managed Network|/something/my_option|/something/myOption|
|--subnets**|array|The collection of subnets covered by the Managed Network|/something/my_option|/something/myOption|
### managed-network managed-networks delete
delete a managed-network managed-networks.