From da512671c8b7c5b2dabc0a0d3c0a87b564cac862 Mon Sep 17 00:00:00 2001 From: kai ru <69238381+kairu-ms@users.noreply.github.com> Date: Wed, 21 Jul 2021 11:37:49 +0800 Subject: [PATCH 01/28] start to add tests for network manager --- src/network-manager/HISTORY.rst | 8 + src/network-manager/README.md | 13 + .../azext_network_manager/__init__.py | 37 + .../azext_network_manager/_client_factory.py | 59 + .../azext_network_manager/_help.py | 559 +++++ .../azext_network_manager/_params.py | 419 ++++ .../azext_network_manager/_validators.py | 9 + .../azext_network_manager/action.py | 201 ++ .../azext_network_manager/azext_metadata.json | 4 + .../azext_network_manager/commands.py | 134 ++ .../azext_network_manager/custom.py | 582 ++++++ .../azext_network_manager/tests/__init__.py | 6 + .../tests/latest/__init__.py | 12 + .../tests/latest/example_steps.py | 432 ++++ .../tests/latest/preparers.py | 159 ++ .../tests/latest/test_network_scenario.py | 45 + .../vendored_sdks/__init__.py | 11 + .../vendored_sdks/_configuration.py | 70 + .../vendored_sdks/_metadata.json | 71 + .../_network_management_client.py | 118 ++ .../vendored_sdks/aio/__init__.py | 10 + .../vendored_sdks/aio/_configuration.py | 66 + .../aio/_network_management_client.py | 112 + .../vendored_sdks/aio/operations/__init__.py | 33 + .../_active_configurations_operations.py | 134 ++ .../aio/operations/_admin_rules_operations.py | 340 ++++ ..._connectivity_configurations_operations.py | 327 +++ .../_effective_configurations_operations.py | 129 ++ .../_effective_virtual_networks_operations.py | 237 +++ .../operations/_network_groups_operations.py | 334 +++ .../_network_manager_commits_operations.py | 104 + ...rk_manager_deployment_status_operations.py | 140 ++ .../_network_managers_operations.py | 453 +++++ .../_security_configurations_operations.py | 497 +++++ .../aio/operations/_user_rules_operations.py | 340 ++++ .../vendored_sdks/models/__init__.py | 200 ++ .../vendored_sdks/models/_models.py | 1612 +++++++++++++++ .../vendored_sdks/models/_models_py3.py | 1812 +++++++++++++++++ .../_network_management_client_enums.py | 209 ++ .../vendored_sdks/operations/__init__.py | 33 + .../_active_configurations_operations.py | 139 ++ .../operations/_admin_rules_operations.py | 348 ++++ ..._connectivity_configurations_operations.py | 335 +++ .../_effective_configurations_operations.py | 134 ++ .../_effective_virtual_networks_operations.py | 243 +++ .../operations/_network_groups_operations.py | 342 ++++ .../_network_manager_commits_operations.py | 109 + ...rk_manager_deployment_status_operations.py | 145 ++ .../_network_managers_operations.py | 463 +++++ .../_security_configurations_operations.py | 507 +++++ .../operations/_user_rules_operations.py | 348 ++++ .../vendored_sdks/py.typed | 1 + src/network-manager/setup.cfg | 1 + src/network-manager/setup.py | 49 + 54 files changed, 13235 insertions(+) create mode 100644 src/network-manager/HISTORY.rst create mode 100644 src/network-manager/README.md create mode 100644 src/network-manager/azext_network_manager/__init__.py create mode 100644 src/network-manager/azext_network_manager/_client_factory.py create mode 100644 src/network-manager/azext_network_manager/_help.py create mode 100644 src/network-manager/azext_network_manager/_params.py create mode 100644 src/network-manager/azext_network_manager/_validators.py create mode 100644 src/network-manager/azext_network_manager/action.py create mode 100644 src/network-manager/azext_network_manager/azext_metadata.json create mode 100644 src/network-manager/azext_network_manager/commands.py create mode 100644 src/network-manager/azext_network_manager/custom.py create mode 100644 src/network-manager/azext_network_manager/tests/__init__.py create mode 100644 src/network-manager/azext_network_manager/tests/latest/__init__.py create mode 100644 src/network-manager/azext_network_manager/tests/latest/example_steps.py create mode 100644 src/network-manager/azext_network_manager/tests/latest/preparers.py create mode 100644 src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/__init__.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/_configuration.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/_metadata.json create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/models/_models.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/py.typed create mode 100644 src/network-manager/setup.cfg create mode 100644 src/network-manager/setup.py diff --git a/src/network-manager/HISTORY.rst b/src/network-manager/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/network-manager/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/network-manager/README.md b/src/network-manager/README.md new file mode 100644 index 00000000000..5e9630b0680 --- /dev/null +++ b/src/network-manager/README.md @@ -0,0 +1,13 @@ +# Azure CLI network Extension # +This is the extension for network + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name network-manager +``` + +Then, call it as you would any other az command: +``` +az network manager -h +``` \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/__init__.py b/src/network-manager/azext_network_manager/__init__.py new file mode 100644 index 00000000000..d9854c0e211 --- /dev/null +++ b/src/network-manager/azext_network_manager/__init__.py @@ -0,0 +1,37 @@ +# -------------------------------------------------------------------------- +# 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 +import azext_network_manager._help + + +class NetworkManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_network_manager._client_factory import cf_network_cl + network_custom = CliCommandType( + operations_tmpl='azext_network_manager.custom#{}', + client_factory=cf_network_cl) + super(NetworkManagementClientCommandsLoader, self).__init__( + cli_ctx=cli_ctx, + custom_command_type=network_custom) + + def load_command_table(self, args): + from azext_network_manager.commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_network_manager._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = NetworkManagementClientCommandsLoader diff --git a/src/network-manager/azext_network_manager/_client_factory.py b/src/network-manager/azext_network_manager/_client_factory.py new file mode 100644 index 00000000000..acf2c427cd7 --- /dev/null +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -0,0 +1,59 @@ +# -------------------------------------------------------------------------- +# 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_network_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_network_manager.vendored_sdks import NetworkManagementClient + return get_mgmt_service_client(cli_ctx, NetworkManagementClient) + + +def cf_networkmanager(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_managers + + +def cf_networkmanagercommit(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_commits + + +def cf_networkmanagerdeploymentstatus(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_deployment_status + + +def cf_effectivevirtualnetwork(cli_ctx, *_): + return cf_network_cl(cli_ctx).effective_virtual_networks + + +def cf_activeconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_configurations + + +def cf_connectivityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).connectivity_configurations + + +def cf_effectiveconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).effective_configurations + + +def cf_networkgroup(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_groups + + +def cf_securityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).security_configurations + + +def cf_adminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).admin_rules + + +def cf_userrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).user_rules diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py new file mode 100644 index 00000000000..f007667847b --- /dev/null +++ b/src/network-manager/azext_network_manager/_help.py @@ -0,0 +1,559 @@ +# -------------------------------------------------------------------------- +# 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['network manager'] = """ + type: group + short-summary: Manage networkmanager with network +""" + +helps['network manager list'] = """ + type: command + short-summary: "List network managers in a resource group." + examples: + - name: List Azure Virtual Network Manager + text: |- + az network manager list --resource-group "rg1" +""" + +helps['network manager show'] = """ + type: command + short-summary: "Gets the specified Network Manager." + examples: + - name: Get Azure Virtual Network Manager + text: |- + az network manager show --name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager create'] = """ + type: command + short-summary: "Create a Network Manager." + parameters: + - name: --network-manager-scopes + short-summary: "Scope of Network Manager." + long-summary: | + Usage: --network-manager-scopes management-groups=XX subscriptions=XX + + management-groups: List of management groups. + subscriptions: List of subscriptions. + examples: + - name: Create/Update Azure Virtual Network Manager + text: |- + az network manager create --name "TestNetworkManager" --description "My Test Network Manager" \ +--display-name "TestNetworkManager" --network-manager-scope-accesses "Security" "Routing" "Connectivity" \ +--network-manager-scopes management-groups="/Microsoft.Management/testmg" subscriptions="/subscriptions/00000000-0000-0\ +000-0000-000000000000" --resource-group "rg1" +""" + +helps['network manager update'] = """ + type: command + short-summary: "Update a Network Manager." + parameters: + - name: --network-manager-scopes + short-summary: "Scope of Network Manager." + long-summary: | + Usage: --network-manager-scopes management-groups=XX subscriptions=XX + + management-groups: List of management groups. + subscriptions: List of subscriptions. +""" + +helps['network manager delete'] = """ + type: command + short-summary: "Deletes a network manager." + examples: + - name: Delete Azure Virtual Network Manager + text: |- + az network manager delete --name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager commit'] = """ + type: group + short-summary: Manage networkmanagercommit with network +""" + +helps['network manager commit post'] = """ + type: command + short-summary: "Post a Network Manager Commit." + examples: + - name: Post Azure Virtual Network Manager Commit + text: |- + az network manager commit post --network-manager-name "testNetworkManager" --commit-type "AdminPolicy" \ +--configuration-ids "/subscriptions/subscriptionC/resourceGroups/resoureGroupSample/providers/Microsoft.Network/network\ +Managers/testNetworkManager/securityConfigurations/SampleSecurityConfig" --target-locations "usest" --resource-group \ +"resoureGroupSample" +""" + +helps['network manager deploy-status'] = """ + type: group + short-summary: Manage networkmanagerdeploymentstatus with network +""" + +helps['network manager deploy-status list'] = """ + type: command + short-summary: "Post List of Network Manager Deployment Status." + examples: + - name: Post Azure Virtual Network Manager Deployment Status + text: |- + az network manager deploy-status list --network-manager-name "testNetworkManager" --deployment-types \ +"Connectivity" "AdminPolicy" --regions "eastus" "westus" --resource-group "resoureGroupSample" +""" + +helps['network manager effect-vnet'] = """ + type: group + short-summary: Manage effectivevirtualnetwork with network +""" + +helps['network manager effect-vnet list-by-network-group'] = """ + type: command + short-summary: "Lists all effective virtual networks by specified network group." + examples: + - name: List Effective Virtual Networks List By Network Groups + text: |- + az network manager effect-vnet list-by-network-group --network-group-name "TestNetworkGroup" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager effect-vnet list-by-network-manager'] = """ + type: command + short-summary: "List effective virtual networks in a network manager." + examples: + - name: List Effective Virtual Networks List By Network Groups + text: |- + az network manager effect-vnet list-by-network-manager --network-manager-name "testNetworkManager" \ +--conditional-members "location=\'useast2\'" --resource-group "rg1" +""" + +helps['network manager active-config'] = """ + type: group + short-summary: Manage activeconfiguration with network +""" + +helps['network manager active-config list'] = """ + type: command + short-summary: "Lists active configurations in a network manager." + examples: + - name: Get Azure Virtual Network Manager Active Configuration + text: |- + az network manager active-config list --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup" +""" + +helps['network manager connect-config'] = """ + type: group + short-summary: Manage connectivityconfiguration with network +""" + +helps['network manager connect-config list'] = """ + type: command + short-summary: "Lists all the network manager connectivity configuration in a specified network manager." + examples: + - name: Get Azure Virtual Network Manager Connecitivity Configuration List + text: |- + az network manager connect-config list --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup" +""" + +helps['network manager connect-config show'] = """ + type: command + short-summary: "Gets a Network Connectivity Configuration, specified by the resource group, network manager name, \ +and connectivity Configuration name." + examples: + - name: Get Azure Virtual Network Manager Connectivity Configuration + text: |- + az network manager connect-config show --configuration-name "myTestConnectivityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "myResourceGroup" +""" + +helps['network manager connect-config create'] = """ + type: command + short-summary: "Create a new network manager connectivity configuration." + parameters: + - name: --applies-to-groups + short-summary: "Groups for configuration" + long-summary: | + Usage: --applies-to-groups network-group-id=XX use-hub-gateway=XX is-global=XX group-connectivity=XX + + network-group-id: Network group Id. + use-hub-gateway: Flag if need to use hub gateway. + is-global: Flag if global is supported. + group-connectivity: Group connectivity type. + + Multiple actions can be specified by using more than one --applies-to-groups argument. + examples: + - name: Create/Update Azure Virtual Network Manager Connectivity Configuration + text: |- + az network manager connect-config create --configuration-name "myTestConnectivityConfig" --description \ +"Sample Configuration" --applies-to-groups group-connectivity="Transitive" is-global=false \ +network-group-id="subscriptions/subscriptionA/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManager\ +s/testNetworkManager/networkManagerGroups/group1" use-hub-gateway=true --connectivity-topology "HubAndSpokeTopology" \ +--delete-existing-peering true --display-name "myTestConnectivityConfig" --hub-id "subscriptions/subscriptionA/resource\ +Groups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig" --is-global true \ +--network-manager-name "testNetworkManager" --resource-group "myResourceGroup" +""" + +helps['network manager connect-config update'] = """ + type: command + short-summary: "Update a new network manager connectivity configuration." + parameters: + - name: --applies-to-groups + short-summary: "Groups for configuration" + long-summary: | + Usage: --applies-to-groups network-group-id=XX use-hub-gateway=XX is-global=XX group-connectivity=XX + + network-group-id: Network group Id. + use-hub-gateway: Flag if need to use hub gateway. + is-global: Flag if global is supported. + group-connectivity: Group connectivity type. + + Multiple actions can be specified by using more than one --applies-to-groups argument. +""" + +helps['network manager connect-config delete'] = """ + type: command + short-summary: "Deletes a network manager connectivity configuration, specified by the resource group, network \ +manager name, and connectivity configuration name." + examples: + - name: Get Azure Virtual Network Manager Connectivity Configuration + text: |- + az network manager connect-config delete --configuration-name "myTestConnectivityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "myResourceGroup" +""" + +helps['network effectiveconfiguration'] = """ + type: group + short-summary: Manage effectiveconfiguration with network +""" + +helps['network effectiveconfiguration list'] = """ + type: command + short-summary: "List all configurations in a virtual network." + examples: + - name: List Azure Virtual Network Manager Effective Configuration + text: |- + az network effectiveconfiguration list --resource-group "myResourceGroup" --virtual-network-name \ +"testVirtualNetwork" +""" + +helps['network manager group'] = """ + type: group + short-summary: Manage networkgroup with network +""" + +helps['network manager group list'] = """ + type: command + short-summary: "Lists the specified network group." + examples: + - name: List Azure Virtual Network Manager Network Groups + text: |- + az network manager group list --network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager group show'] = """ + type: command + short-summary: "Gets the specified network group." + examples: + - name: Get Azure Virtual Network Manager Network Group + text: |- + az network manager group show --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ +--resource-group "rg1" +""" + +helps['network manager group create'] = """ + type: command + short-summary: "Create a network group." + parameters: + - name: --group-members + short-summary: "Group members of network group." + long-summary: | + Usage: --group-members resource-id=XX + + resource-id: Resource Id. + + Multiple actions can be specified by using more than one --group-members argument. + examples: + - name: Create/Update Azure Virtual Network Manager Network Group + text: |- + az network manager group create --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ +--description "A sample group" --conditional-membership "" --display-name "My Network Group" --group-members \ +resource-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" \ +--member-type "VirtualNetwork" --resource-group "rg1" +""" + +helps['network manager group update'] = """ + type: command + short-summary: "Update a network group." + parameters: + - name: --group-members + short-summary: "Group members of network group." + long-summary: | + Usage: --group-members resource-id=XX + + resource-id: Resource Id. + + Multiple actions can be specified by using more than one --group-members argument. +""" + +helps['network manager group delete'] = """ + type: command + short-summary: "Deletes a network group." + examples: + - name: Delete Azure Virtual Network Manager Group + text: |- + az network manager group delete --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ +--resource-group "rg1" +""" + +helps['network manager security-config'] = """ + type: group + short-summary: Manage securityconfiguration with network +""" + +helps['network manager security-config list'] = """ + type: command + short-summary: "Lists all the network manager security configurations in a network manager, in a paginated \ +format." + examples: + - name: List security configurations in a network manager + text: |- + az network manager security-config list --network-manager-name "testNetworkManager" --resource-group \ +"rg1" +""" + +helps['network manager security-config show'] = """ + type: command + short-summary: "Retrieves a network manager security Configuration." + examples: + - name: Get security configurations + text: |- + az network manager security-config show --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager security-config create'] = """ + type: command + short-summary: "Create a network manager security Configuration." + parameters: + - name: --applies-to-groups + short-summary: "Groups for configuration" + long-summary: | + Usage: --applies-to-groups network-group-id=XX + + network-group-id: Network manager group Id. + + Multiple actions can be specified by using more than one --applies-to-groups argument. + examples: + - name: Create network manager security Configuration + text: |- + az network manager security-config create --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" --applies-to-groups \ +network-group-id="/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManage\ +r/networkGroups/testGroup" --delete-existing-ns-gs true --security-type "UserPolicy" +""" + +helps['network manager security-config update'] = """ + type: command + short-summary: "Update a network manager security Configuration." + parameters: + - name: --applies-to-groups + short-summary: "Groups for configuration" + long-summary: | + Usage: --applies-to-groups network-group-id=XX + + network-group-id: Network manager group Id. + + Multiple actions can be specified by using more than one --applies-to-groups argument. +""" + +helps['network manager security-config delete'] = """ + type: command + short-summary: "Deletes a network manager security Configuration." + examples: + - name: Delete network manager security Configuration + text: |- + az network manager security-config delete --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager security-config evaluate-import'] = """ + type: command + short-summary: "The operation to evaluate import NSG to security configurations." + parameters: + - name: --network-security-group-imports + short-summary: "List of nsg uris." + long-summary: | + Usage: --network-security-group-imports network-security-group-uri=XX + + network-security-group-uri: Network Security Group Uri. + + Multiple actions can be specified by using more than one --network-security-group-imports argument. + examples: + - name: Evaluate import NSG Rules + text: |- + az network manager security-config evaluate-import --configuration-name "myTestConfig" \ +--network-manager-name "testNetworkManager" --admin-security-configuration-uri "/subscriptions/subId/resourceGroups/rg1\ +/providers/Microsoft.Network/networkManagers/testNetworkManager/securityConfigurations/adminConfig" \ +--import-deny-rules-as-admin-rules true --network-security-group-imports network-security-group-uri="/subscriptions/sub\ +id/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1" \ +--remove-allow-azure-load-balancer-inbound-rule true --remove-allow-internet-outbound-rule true \ +--remove-allow-vnet-inbound-rule true --remove-allow-vnet-outbound-rule true --resource-group "rg1" +""" + +helps['network manager security-config import'] = """ + type: command + short-summary: "Imports network security rules to network manager security rules." + parameters: + - name: --network-security-group-imports + short-summary: "List of nsg uris." + long-summary: | + Usage: --network-security-group-imports network-security-group-uri=XX + + network-security-group-uri: Network Security Group Uri. + + Multiple actions can be specified by using more than one --network-security-group-imports argument. + examples: + - name: Import NSG Rules + text: |- + az network manager security-config import --configuration-name "myTestConfig" --network-manager-name \ +"testNetworkManager" --admin-security-configuration-uri "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Ne\ +twork/networkManagers/testNetworkManager/securityConfigurations/adminConfig" --import-deny-rules-as-admin-rules true \ +--network-security-group-imports network-security-group-uri="/subscriptions/subid/resourceGroups/rg1/providers/Microsof\ +t.Network/networkSecurityGroups/testnsg/securityRules/rule1" --remove-allow-azure-load-balancer-inbound-rule true \ +--remove-allow-internet-outbound-rule true --remove-allow-vnet-inbound-rule true --remove-allow-vnet-outbound-rule \ +true --resource-group "rg1" +""" + +helps['network manager admin-rule'] = """ + type: group + short-summary: Manage adminrule with network +""" + +helps['network manager admin-rule list'] = """ + type: command + short-summary: "Retrieves a network manager security configuration admin rule." + examples: + - name: List security admin rules + text: |- + az network manager admin-rule list --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" +""" + +helps['network manager admin-rule show'] = """ + type: command + short-summary: "Gets a network manager security configuration admin rule in a subscription." + examples: + - name: Gets security admin rule + text: |- + az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" +""" + +helps['network manager admin-rule delete'] = """ + type: command + short-summary: "Deletes an admin rule." + examples: + - name: Deletes an admin rule. + text: |- + az network manager admin-rule delete --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" +""" + +helps['network manager user-rule'] = """ + type: group + short-summary: Manage userrule with network +""" + +helps['network manager user-rule list'] = """ + type: command + short-summary: "Lists all user rules in a security configuration." + examples: + - name: List security user rules + text: |- + az network manager user-rule list --configuration-name "myTestConnectivityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager user-rule show'] = """ + type: command + short-summary: "Gets a user rule." + examples: + - name: Gets a user rule + text: |- + az network manager user-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" +""" + +helps['network manager user-rule create'] = """ + type: command + short-summary: "Create a user rule." + parameters: + - name: --source + short-summary: "The CIDR or source IP ranges." + long-summary: | + Usage: --source address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --source argument. + - name: --destination + short-summary: "The destination address prefixes. CIDR or destination IP ranges." + long-summary: | + Usage: --destination address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --destination argument. + examples: + - name: Create a user rule + text: |- + az network manager user-rule create --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" --description "Sample User Rule" \ +--destination address-prefix="*" address-prefix-type="IPPrefix" --destination-port-ranges "22" --direction "Inbound" \ +--source address-prefix="*" address-prefix-type="IPPrefix" --source-port-ranges "0-65535" --protocol "Tcp" +""" + +helps['network manager user-rule update'] = """ + type: command + short-summary: "Update a user rule." + parameters: + - name: --source + short-summary: "The CIDR or source IP ranges." + long-summary: | + Usage: --source address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --source argument. + - name: --destination + short-summary: "The destination address prefixes. CIDR or destination IP ranges." + long-summary: | + Usage: --destination address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --destination argument. +""" + +helps['network manager user-rule delete'] = """ + type: command + short-summary: "Deletes a user rule." + examples: + - name: Delete a user rule. + text: |- + az network manager user-rule delete --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" +""" diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py new file mode 100644 index 00000000000..dbfbfb9cb57 --- /dev/null +++ b/src/network-manager/azext_network_manager/_params.py @@ -0,0 +1,419 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.core.commands.parameters import ( + tags_type, + get_three_state_flag, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_network_manager.action import ( + AddNetworkManagerScopes, + AddConnectivityconfigurationsAppliesToGroups, + AddGroupMembers, + AddSecurityconfigurationsAppliesToGroups, + AddNetworkSecurityGroupImports, + AddSource, + AddDestination +) + +from azext_network_manager.vendored_sdks.models import ScopeAccesses + + +def load_arguments(self, _): + + # region network manager + with self.argument_context('network manager') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, + help='The name of the network manager.', id_part='name') + + with self.argument_context('network manager list') as c: + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager show') as c: + c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, + help='The name of the network manager.', id_part='name') + + with self.argument_context('network manager create') as c: + c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, + help='The name of the network manager.') + c.argument('id_', options_list=['--id'], type=str, help='Resource ID.') + # c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + # validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('display_name', type=str, help='A friendly name for the network manager.') + c.argument('description', type=str, help='A description of the network manager.') + c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network ' + 'Manager.') + c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access.', arg_type=get_enum_type(ScopeAccesses)) + + with self.argument_context('network manager update') as c: + c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, + help='The name of the network manager.', id_part='name') + c.argument('id_', options_list=['--id'], type=str, help='Resource ID.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('display_name', type=str, help='A friendly name for the network manager.') + c.argument('description', type=str, help='A description of the network manager.') + c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network ' + 'Manager.') + c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access.') + c.ignore('parameters') + + with self.argument_context('network manager delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, + help='The name of the network manager.', id_part='name') + + # endregion + with self.argument_context('network manager commit post') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('target_locations', nargs='+', help='List of target locations.') + c.argument('configuration_ids', nargs='+', help='List of configuration ids.') + c.argument('commit_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy', 'Routing', 'Connectivity']), + help='Commit Type.') + + with self.argument_context('network manager deploy-status list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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.') + c.argument('regions', nargs='+', help='List of locations.') + c.argument('deployment_types', nargs='+', help='List of configurations\' deployment types.') + + with self.argument_context('network manager effect-vnet list-by-network-group') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_group_name', type=str, help='The name of the network group to get.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager effect-vnet list-by-network-manager') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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.') + c.argument('conditional_members', type=str, help='Conditional Members.') + + with self.argument_context('network manager active-config list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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.') + c.argument('region', type=str, help='Location name') + + with self.argument_context('network manager connect-config list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager connect-config show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.', + id_part='child_name_1') + + with self.argument_context('network manager connect-config create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.') + c.argument('display_name', type=str, help='A friendly name for the resource.') + c.argument('description', type=str, help='A description of the connectivity configuration.') + c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']), + help='Connectivity topology type.') + c.argument('hub_id', type=str, help='The hub vnet Id.') + c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.') + c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' + 'for configuration') + c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current ' + 'existing peerings.') + + with self.argument_context('network manager connect-config update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.', + id_part='child_name_1') + c.argument('display_name', type=str, help='A friendly name for the resource.') + c.argument('description', type=str, help='A description of the connectivity configuration.') + c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']), + help='Connectivity topology type.') + c.argument('hub_id', type=str, help='The hub vnet Id.') + c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.') + c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' + 'for configuration') + c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current ' + 'existing peerings.') + c.ignore('connectivity_configuration') + + with self.argument_context('network manager connect-config delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.', + id_part='child_name_1') + + with self.argument_context('network effectiveconfiguration list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('virtual_network_name', type=str, help='The name of the virtual network.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager group list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager group show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' + 'name of the network group to get.', id_part='child_name_1') + + with self.argument_context('network manager group create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' + 'name of the network group to get.') + c.argument('if_match', type=str, help='The ETag of the transformation. Omit this value to always overwrite the ' + 'current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent ' + 'changes.') + c.argument('display_name', type=str, help='A friendly name for the network group.') + c.argument('description', type=str, help='A description of the network group.') + c.argument('member_type', arg_type=get_enum_type(['VirtualNetwork', 'Subnet']), help='Group member type.') + c.argument('group_members', action=AddGroupMembers, nargs='+', help='Group members of network group.') + c.argument('conditional_membership', type=str, help='Network group conditional filter.') + + with self.argument_context('network manager group update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' + 'name of the network group to get.', id_part='child_name_1') + c.argument('if_match', type=str, help='The ETag of the transformation. Omit this value to always overwrite the ' + 'current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent ' + 'changes.') + c.argument('display_name', type=str, help='A friendly name for the network group.') + c.argument('description', type=str, help='A description of the network group.') + c.argument('member_type', arg_type=get_enum_type(['VirtualNetwork', 'Subnet']), help='Group member type.') + c.argument('group_members', action=AddGroupMembers, nargs='+', help='Group members of network group.') + c.argument('conditional_membership', type=str, help='Network group conditional filter.') + c.ignore('parameters') + + with self.argument_context('network manager group delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' + 'name of the network group to get.', id_part='child_name_1') + + with self.argument_context('network manager security-config list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager security-config show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + + with self.argument_context('network manager security-config create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') + c.argument('display_name', type=str, help='A display name of the security Configuration.') + c.argument('description', type=str, help='A description of the security Configuration.') + c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.') + c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing ' + 'network security groups.') + c.argument('applies_to_groups', action=AddSecurityconfigurationsAppliesToGroups, nargs='+', help='Groups for ' + 'configuration') + + with self.argument_context('network manager security-config update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('display_name', type=str, help='A display name of the security Configuration.') + c.argument('description', type=str, help='A description of the security Configuration.') + c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.') + c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing ' + 'network security groups.') + c.argument('applies_to_groups', action=AddSecurityconfigurationsAppliesToGroups, nargs='+', help='Groups for ' + 'configuration') + c.ignore('security_configuration') + + with self.argument_context('network manager security-config delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + + with self.argument_context('network manager security-config evaluate-import') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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.') + c.argument('network_security_group_imports', action=AddNetworkSecurityGroupImports, nargs='+', help='List of ' + 'nsg uris.') + c.argument('import_deny_rules_as_admin_rules', arg_type=get_three_state_flag(), help='Flag if import deny ' + 'rules as admin rules.') + c.argument('admin_security_configuration_uri', type=str, help='Admin security configuration Uri.') + c.argument('remove_allow_vnet_inbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' + 'allow vnet inbound rule.') + c.argument('remove_allow_azure_load_balancer_inbound_rule', arg_type=get_three_state_flag(), help='Flag if ' + 'need to remove allow azure load balancer inbound rule.') + c.argument('remove_allow_vnet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' + 'allow vnet outbound rule.') + c.argument('remove_allow_internet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to ' + 'remove allow Internet outbound rule.') + + with self.argument_context('network manager security-config import') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('network_security_group_imports', action=AddNetworkSecurityGroupImports, nargs='+', help='List of ' + 'nsg uris.') + c.argument('import_deny_rules_as_admin_rules', arg_type=get_three_state_flag(), help='Flag if import deny ' + 'rules as admin rules.') + c.argument('admin_security_configuration_uri', type=str, help='Admin security configuration Uri.') + c.argument('remove_allow_vnet_inbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' + 'allow vnet inbound rule.') + c.argument('remove_allow_azure_load_balancer_inbound_rule', arg_type=get_three_state_flag(), help='Flag if ' + 'need to remove allow azure load balancer inbound rule.') + c.argument('remove_allow_vnet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' + 'allow vnet outbound rule.') + c.argument('remove_allow_internet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to ' + 'remove allow Internet outbound rule.') + + with self.argument_context('network manager admin-rule list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager admin-rule show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + + with self.argument_context('network manager admin-rule delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + + with self.argument_context('network manager user-rule list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager user-rule show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + + with self.argument_context('network manager user-rule create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') + c.argument('rule_name', type=str, help='The name of the rule.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' + 'protocol this rule applies to.') + c.argument('source', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') + c.argument('destination', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' + 'destination IP ranges.') + c.argument('source_port_ranges', nargs='+', help='The source port ranges.') + c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' + 'matched against the rule in inbound or outbound.') + + with self.argument_context('network manager user-rule update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' + 'protocol this rule applies to.') + c.argument('source', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') + c.argument('destination', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' + 'destination IP ranges.') + c.argument('source_port_ranges', nargs='+', help='The source port ranges.') + c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' + 'matched against the rule in inbound or outbound.') + c.ignore('user_rule') + + with self.argument_context('network manager user-rule delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') diff --git a/src/network-manager/azext_network_manager/_validators.py b/src/network-manager/azext_network_manager/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/network-manager/azext_network_manager/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/src/network-manager/azext_network_manager/action.py b/src/network-manager/azext_network_manager/action.py new file mode 100644 index 00000000000..e0c9776a16f --- /dev/null +++ b/src/network-manager/azext_network_manager/action.py @@ -0,0 +1,201 @@ +# -------------------------------------------------------------------------- +# 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=protected-access + +import argparse +from collections import defaultdict +from knack.util import CLIError + + +class AddNetworkManagerScopes(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.network_manager_scopes = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'management-groups': + d['management_groups'] = v + elif kl == 'subscriptions': + d['subscriptions'] = v + else: + raise CLIError('Unsupported Key {} is provided for parameter network_manager_scopes. All possible keys ' + 'are: management-groups, subscriptions'.format(k)) + return d + + +class AddConnectivityconfigurationsAppliesToGroups(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddConnectivityconfigurationsAppliesToGroups, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'network-group-id': + d['network_group_id'] = v[0] + elif kl == 'use-hub-gateway': + d['use_hub_gateway'] = v[0] + elif kl == 'is-global': + d['is_global'] = v[0] + elif kl == 'group-connectivity': + d['group_connectivity'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter applies_to_groups. All possible keys are: ' + 'network-group-id, use-hub-gateway, is-global, group-connectivity'.format(k)) + return d + + +class AddGroupMembers(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddGroupMembers, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'resource-id': + d['resource_id'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter group_members. All possible keys are: ' + 'resource-id'.format(k)) + return d + + +class AddSecurityconfigurationsAppliesToGroups(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddSecurityconfigurationsAppliesToGroups, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'network-group-id': + d['network_group_id'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter applies_to_groups. All possible keys are: ' + 'network-group-id'.format(k)) + return d + + +class AddNetworkSecurityGroupImports(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddNetworkSecurityGroupImports, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'network-security-group-uri': + d['network_security_group_uri'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter network_security_group_imports. All ' + 'possible keys are: network-security-group-uri'.format(k)) + return d + + +class AddSource(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddSource, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'address-prefix': + d['address_prefix'] = v[0] + elif kl == 'address-prefix-type': + d['address_prefix_type'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter source. All possible keys are: ' + 'address-prefix, address-prefix-type'.format(k)) + return d + + +class AddDestination(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddDestination, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'address-prefix': + d['address_prefix'] = v[0] + elif kl == 'address-prefix-type': + d['address_prefix_type'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter destination. All possible keys are: ' + 'address-prefix, address-prefix-type'.format(k)) + return d diff --git a/src/network-manager/azext_network_manager/azext_metadata.json b/src/network-manager/azext_network_manager/azext_metadata.json new file mode 100644 index 00000000000..30fdaf614ee --- /dev/null +++ b/src/network-manager/azext_network_manager/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.15.0" +} \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py new file mode 100644 index 00000000000..40cee1b970e --- /dev/null +++ b/src/network-manager/azext_network_manager/commands.py @@ -0,0 +1,134 @@ +# -------------------------------------------------------------------------- +# 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-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType +from azext_network_manager._client_factory import ( + cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, cf_effectivevirtualnetwork, + cf_activeconfiguration, cf_connectivityconfiguration, cf_effectiveconfiguration, cf_networkgroup, cf_userrule, + cf_adminrule, cf_securityconfiguration) + + +def load_command_table(self, _): + network_networkmanager = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._network_managers_operations#NetworkManagersOperations.{}', + client_factory=cf_networkmanager + ) + + network_networkmanagercommit = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._network_manager_commits_operations#NetworkManagercommitsOperations.{}', + client_factory=cf_networkmanagercommit + ) + + network_networkmanagerdeploymentstatus = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._network_manager_deployment_status_operations#NetworkManagerDeploymentStatusOperations.{}', + client_factory=cf_networkmanagerdeploymentstatus + ) + + network_effectivevirtualnetwork = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_virtual_networks_operations#EffectiveVirtualNetworksOperations.{}', + client_factory=cf_effectivevirtualnetwork) + + network_activeconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._active_configurations_operations#ActiveConfigurationsOperations.{}', + client_factory=cf_activeconfiguration + ) + + network_connectivityconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._connectivity_configurations_operations#ConnectivityConfigurationsOperations.{}', + client_factory=cf_connectivityconfiguration + ) + + network_effectiveconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_configurations_operations#EffectiveConfigurationsOperations.{}', + client_factory=cf_effectiveconfiguration + ) + + network_networkgroup = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._network_groups_operations#NetworkGroupsOperations.{}', + client_factory=cf_networkgroup + ) + + network_securityconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._security_configurations_operations#SecurityConfigurationsOperations.{}', + client_factory=cf_securityconfiguration + ) + + network_adminrule = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._admin_rules_operations#AdminRulesOperations.{}', + client_factory=cf_adminrule + ) + + network_userrule = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._user_rules_operations#UserRulesOperations.{}', + client_factory=cf_userrule + ) + + + with self.command_group('network manager', network_networkmanager, client_factory=cf_networkmanager) as g: + g.custom_command('create', 'network_manager_create') + g.custom_command('list', 'network_manager_list') + g.custom_show_command('show', 'network_manager_show') + g.generic_update_command('update', custom_func_name='network_manager_update') + g.custom_command('delete', 'network_manager_delete', confirmation=True) + + with self.command_group('network manager commit', network_networkmanagercommit, client_factory=cf_networkmanagercommit) as g: + g.custom_command('post', 'network_manager_commit_post') + + with self.command_group('network manager deploy-status', network_networkmanagerdeploymentstatus, client_factory=cf_networkmanagerdeploymentstatus) as g: + g.custom_command('list', 'network_manager_deploy_status_list') + + with self.command_group('network manager effect-vnet', network_effectivevirtualnetwork, client_factory=cf_effectivevirtualnetwork) as g: + g.custom_command('list-by-network-group', 'network_manager_effect_vnet_list_by_network_group') + g.custom_command('list-by-network-manager', 'network_manager_effect_vnet_list_by_network_manager') + + with self.command_group('network manager active-config', network_activeconfiguration, client_factory=cf_activeconfiguration) as g: + g.custom_command('list', 'network_manager_active_config_list') + + with self.command_group('network manager connect-config', network_connectivityconfiguration, client_factory=cf_connectivityconfiguration) as g: + g.custom_command('list', 'network_manager_connect_config_list') + g.custom_show_command('show', 'network_manager_connect_config_show') + g.custom_command('create', 'network_manager_connect_config_create') + g.generic_update_command('update', setter_arg_name='connectivity_configuration', custom_func_name='network_manager_connect_config_update') + g.custom_command('delete', 'network_manager_connect_config_delete', confirmation=True) + + with self.command_group('network effectiveconfiguration', network_effectiveconfiguration, + client_factory=cf_effectiveconfiguration) as g: + g.custom_command('list', 'network_effectiveconfiguration_list') + + with self.command_group('network manager group', network_networkgroup, client_factory=cf_networkgroup) as g: + g.custom_command('list', 'network_manager_group_list') + g.custom_show_command('show', 'network_manager_group_show') + g.custom_command('create', 'network_manager_group_create') + g.generic_update_command('update', custom_func_name='network_manager_group_update') + g.custom_command('delete', 'network_manager_group_delete', confirmation=True) + + with self.command_group('network manager security-config', network_securityconfiguration, client_factory=cf_securityconfiguration) as g: + g.custom_command('list', 'network_manager_security_config_list') + g.custom_show_command('show', 'network_manager_security_config_show') + g.custom_command('create', 'network_manager_security_config_create') + g.generic_update_command('update', setter_arg_name='security_configuration', custom_func_name='network_manager_security_config_update') + g.custom_command('delete', 'network_manager_security_config_delete', confirmation=True) + g.custom_command('evaluate-import', 'network_manager_security_config_evaluate_import') + g.custom_command('import', 'network_manager_security_config_import') + + with self.command_group('network manager admin-rule', network_adminrule, client_factory=cf_adminrule) as g: + g.custom_command('list', 'network_manager_admin_rule_list') + g.custom_show_command('show', 'network_manager_admin_rule_show') + g.custom_command('delete', 'network_manager_admin_rule_delete', confirmation=True) + + with self.command_group('network manager user-rule', network_userrule, client_factory=cf_userrule) as g: + g.custom_command('list', 'network_manager_user_rule_list') + g.custom_show_command('show', 'network_manager_user_rule_show') + g.custom_command('create', 'network_manager_user_rule_create') + g.generic_update_command('update', setter_arg_name='user_rule', custom_func_name='network_manager_user_rule_update') + g.custom_command('delete', 'network_manager_user_rule_delete', confirmation=True) + diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py new file mode 100644 index 00000000000..b99b0899cff --- /dev/null +++ b/src/network-manager/azext_network_manager/custom.py @@ -0,0 +1,582 @@ +# -------------------------------------------------------------------------- +# 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=unused-argument + + +def network_manager_list(client, + resource_group_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + top=top, + skip_token=skip_token) + + +def network_manager_show(client, + resource_group_name, + network_manager_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name) + + +def network_manager_create(client, + resource_group_name, + network_manager_name, + id_=None, + location=None, + tags=None, + display_name=None, + description=None, + network_manager_scopes=None, + network_manager_scope_accesses=None): + parameters = {} + parameters['id'] = id_ + parameters['location'] = location + parameters['tags'] = tags + parameters['display_name'] = display_name + parameters['description'] = description + parameters['network_manager_scopes'] = network_manager_scopes + parameters['network_manager_scope_accesses'] = network_manager_scope_accesses + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) + + +def network_manager_update(instance, + resource_group_name, + network_manager_name, + id_=None, + location=None, + tags=None, + display_name=None, + description=None, + network_manager_scopes=None, + network_manager_scope_accesses=None): + if id_ is not None: + instance.id = id_ + if location is not None: + instance.location = location + if tags is not None: + instance.tags = tags + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if network_manager_scopes is not None: + instance.network_manager_scopes = network_manager_scopes + if network_manager_scope_accesses is not None: + instance.network_manager_scope_accesses = network_manager_scope_accesses + return instance + + +def network_manager_delete(client, + resource_group_name, + network_manager_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name) + + +def network_manager_commit_post(client, + resource_group_name, + network_manager_name, + target_locations=None, + configuration_ids=None, + commit_type=None): + parameters = {} + parameters['target_locations'] = target_locations + parameters['configuration_ids'] = configuration_ids + parameters['commit_type'] = commit_type + return client.post(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) + + +def network_manager_deploy_status_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None, + regions=None, + deployment_types=None): + parameters = {} + parameters['regions'] = regions + parameters['deployment_types'] = deployment_types + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + parameters=parameters) + + +def network_manager_effect_vnet_list_by_network_group(client, + resource_group_name, + network_manager_name, + network_group_name, + top=None, + skip_token=None): + return client.list_by_network_group(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + top=top, + skip_token=skip_token) + + +def network_manager_effect_vnet_list_by_network_manager(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None, + conditional_members=None): + parameters = {} + parameters['conditional_members'] = conditional_members + return client.list_by_network_manager(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + parameters=parameters) + + +def network_manager_active_config_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None, + region=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + region=region) + + +def network_manager_connect_config_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token) + + +def network_manager_connect_config_show(client, + resource_group_name, + network_manager_name, + configuration_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name) + + +def network_manager_connect_config_create(client, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + connectivity_topology=None, + hub_id=None, + is_global=None, + applies_to_groups=None, + delete_existing_peering=None): + connectivity_configuration = {} + connectivity_configuration['display_name'] = display_name + connectivity_configuration['description'] = description + connectivity_configuration['connectivity_topology'] = connectivity_topology + connectivity_configuration['hub_id'] = hub_id + connectivity_configuration['is_global'] = is_global + connectivity_configuration['applies_to_groups'] = applies_to_groups + connectivity_configuration['delete_existing_peering'] = delete_existing_peering + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + connectivity_configuration=connectivity_configuration) + + +def network_manager_connect_config_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + connectivity_topology=None, + hub_id=None, + is_global=None, + applies_to_groups=None, + delete_existing_peering=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if connectivity_topology is not None: + instance.connectivity_topology = connectivity_topology + if hub_id is not None: + instance.hub_id = hub_id + if is_global is not None: + instance.is_global = is_global + if applies_to_groups is not None: + instance.applies_to_groups = applies_to_groups + if delete_existing_peering is not None: + instance.delete_existing_peering = delete_existing_peering + return instance + + +def network_manager_connect_config_delete(client, + resource_group_name, + network_manager_name, + configuration_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name) + + +def network_effectiveconfiguration_list(client, + resource_group_name, + virtual_network_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + top=top, + skip_token=skip_token) + + +def network_manager_group_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token) + + +def network_manager_group_show(client, + resource_group_name, + network_manager_name, + network_group_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name) + + +def network_manager_group_create(client, + resource_group_name, + network_manager_name, + network_group_name, + if_match=None, + display_name=None, + description=None, + member_type=None, + group_members=None, + conditional_membership=None): + parameters = {} + parameters['display_name'] = display_name + parameters['description'] = description + parameters['member_type'] = member_type + parameters['group_members'] = group_members + parameters['conditional_membership'] = conditional_membership + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + if_match=if_match, + parameters=parameters) + + +def network_manager_group_update(instance, + resource_group_name, + network_manager_name, + network_group_name, + if_match=None, + display_name=None, + description=None, + member_type=None, + group_members=None, + conditional_membership=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if member_type is not None: + instance.member_type = member_type + if group_members is not None: + instance.group_members = group_members + if conditional_membership is not None: + instance.conditional_membership = conditional_membership + return instance + + +def network_manager_group_delete(client, + resource_group_name, + network_manager_name, + network_group_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name) + + +def network_manager_security_config_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token) + + +def network_manager_security_config_show(client, + resource_group_name, + network_manager_name, + configuration_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name) + + +def network_manager_security_config_create(client, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + security_type=None, + delete_existing_ns_gs=None, + applies_to_groups=None): + security_configuration = {} + security_configuration['display_name'] = display_name + security_configuration['description'] = description + security_configuration['security_type'] = security_type + security_configuration['delete_existing_ns_gs'] = delete_existing_ns_gs + security_configuration['applies_to_groups'] = applies_to_groups + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + security_configuration=security_configuration) + + +def network_manager_security_config_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + security_type=None, + delete_existing_ns_gs=None, + applies_to_groups=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if security_type is not None: + instance.security_type = security_type + if delete_existing_ns_gs is not None: + instance.delete_existing_ns_gs = delete_existing_ns_gs + if applies_to_groups is not None: + instance.applies_to_groups = applies_to_groups + return instance + + +def network_manager_security_config_delete(client, + resource_group_name, + network_manager_name, + configuration_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name) + + +def network_manager_security_config_evaluate_import(client, + resource_group_name, + network_manager_name, + configuration_name, + top=None, + skip_token=None, + network_security_group_imports=None, + import_deny_rules_as_admin_rules=None, + admin_security_configuration_uri=None, + remove_allow_vnet_inbound_rule=None, + remove_allow_azure_load_balancer_inbound_rule=None, + remove_allow_vnet_outbound_rule=None, + remove_allow_internet_outbound_rule=None): + parameters = {} + parameters['network_security_group_imports'] = network_security_group_imports + parameters['import_deny_rules_as_admin_rules'] = import_deny_rules_as_admin_rules + parameters['admin_security_configuration_uri'] = admin_security_configuration_uri + parameters['remove_allow_vnet_inbound_rule'] = remove_allow_vnet_inbound_rule + parameters['remove_allow_azure_load_balancer_inbound_rule'] = remove_allow_azure_load_balancer_inbound_rule + parameters['remove_allow_vnet_outbound_rule'] = remove_allow_vnet_outbound_rule + parameters['remove_allow_internet_outbound_rule'] = remove_allow_internet_outbound_rule + return client.evaluate_import(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + parameters=parameters) + + +def network_manager_security_config_import(client, + resource_group_name, + network_manager_name, + configuration_name, + network_security_group_imports=None, + import_deny_rules_as_admin_rules=None, + admin_security_configuration_uri=None, + remove_allow_vnet_inbound_rule=None, + remove_allow_azure_load_balancer_inbound_rule=None, + remove_allow_vnet_outbound_rule=None, + remove_allow_internet_outbound_rule=None): + parameters = {} + parameters['network_security_group_imports'] = network_security_group_imports + parameters['import_deny_rules_as_admin_rules'] = import_deny_rules_as_admin_rules + parameters['admin_security_configuration_uri'] = admin_security_configuration_uri + parameters['remove_allow_vnet_inbound_rule'] = remove_allow_vnet_inbound_rule + parameters['remove_allow_azure_load_balancer_inbound_rule'] = remove_allow_azure_load_balancer_inbound_rule + parameters['remove_allow_vnet_outbound_rule'] = remove_allow_vnet_outbound_rule + parameters['remove_allow_internet_outbound_rule'] = remove_allow_internet_outbound_rule + return client.import_method(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + parameters=parameters) + + +def network_manager_admin_rule_list(client, + resource_group_name, + network_manager_name, + configuration_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token) + + +def network_manager_admin_rule_show(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_name=rule_name) + + +def network_manager_admin_rule_delete(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_name=rule_name) + + +def network_manager_user_rule_list(client, + resource_group_name, + network_manager_name, + configuration_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token) + + +def network_manager_user_rule_show(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_name=rule_name) + + +def network_manager_user_rule_create(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_name, + display_name=None, + description=None, + protocol=None, + source=None, + destination=None, + source_port_ranges=None, + destination_port_ranges=None, + direction=None): + user_rule = {} + user_rule['display_name'] = display_name + user_rule['description'] = description + user_rule['protocol'] = protocol + user_rule['source'] = source + user_rule['destination'] = destination + user_rule['source_port_ranges'] = source_port_ranges + user_rule['destination_port_ranges'] = destination_port_ranges + user_rule['direction'] = direction + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_name=rule_name, + user_rule=user_rule) + + +def network_manager_user_rule_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + rule_name, + display_name=None, + description=None, + protocol=None, + source=None, + destination=None, + source_port_ranges=None, + destination_port_ranges=None, + direction=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if protocol is not None: + instance.protocol = protocol + if source is not None: + instance.source = source + if destination is not None: + instance.destination = destination + if source_port_ranges is not None: + instance.source_port_ranges = source_port_ranges + if destination_port_ranges is not None: + instance.destination_port_ranges = destination_port_ranges + if direction is not None: + instance.direction = direction + return instance + + +def network_manager_user_rule_delete(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_name=rule_name) diff --git a/src/network-manager/azext_network_manager/tests/__init__.py b/src/network-manager/azext_network_manager/tests/__init__.py new file mode 100644 index 00000000000..3f57ebc3fd9 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/__init__.py @@ -0,0 +1,6 @@ +# 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. +# -------------------------------------------------------------------------- diff --git a/src/network-manager/azext_network_manager/tests/latest/__init__.py b/src/network-manager/azext_network_manager/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/__init__.py @@ -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__) diff --git a/src/network-manager/azext_network_manager/tests/latest/example_steps.py b/src/network-manager/azext_network_manager/tests/latest/example_steps.py new file mode 100644 index 00000000000..4429b2bb430 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/example_steps.py @@ -0,0 +1,432 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +# # EXAMPLE: /NetworkManagers/put/Put Network Manager +# @try_manual +# def step_manager_create(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager create ' +# '--name "{myNetworkManager2}" ' +# '--description "My Test Network Manager" ' +# '--display-name "{myNetworkManager2}" ' +# '--network-manager-scope-accesses "Security" "Routing" "Connectivity" ' +# '--network-manager-scopes management-groups="/Microsoft.Management/testmg" subscriptions="/subscriptions/{' +# 'subscription_id}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkManagers/get/List Network Manager +# @try_manual +# def step_manager_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager list ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkManagers/get/NetworkManagersGet +# @try_manual +# def step_manager_show(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager show ' +# '--name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /ActiveConfigurations/get/List Active Configurations +# @try_manual +# def step_manager_active_config_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager active-config list ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg_3}"', +# checks=checks) +# +# +# # EXAMPLE: /AdminRules/get/Gets security admin rule +# @try_manual +# def step_manager_admin_rule_show(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager admin-rule show ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}" ' +# '--rule-name "SampleAdminRule"', +# checks=checks) +# +# +# # EXAMPLE: /AdminRules/get/List security admin rules +# @try_manual +# def step_manager_admin_rule_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager admin-rule list ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /AdminRules/delete/Deletes an admin rule. +# @try_manual +# def step_manager_admin_rule_delete(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager admin-rule delete -y ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}" ' +# '--rule-name "SampleAdminRule"', +# checks=checks) +# +# +# # EXAMPLE: /ConnectivityConfigurations/put/ConnectivityConfigurationsPut +# @try_manual +# def step_manager_connect_config_create(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager connect-config create ' +# '--configuration-name "myTestConnectivityConfig" ' +# '--description "Sample Configuration" ' +# '--applies-to-groups group-connectivity="Transitive" is-global=false network-group-id="subscriptions/subsc' +# 'riptionA/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/ne' +# 'tworkManagerGroups/group1" use-hub-gateway=true ' +# '--connectivity-topology "HubAndSpokeTopology" ' +# '--delete-existing-peering true ' +# '--display-name "myTestConnectivityConfig" ' +# '--hub-id "subscriptions/subscriptionA/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualN' +# 'etworks/myTestConnectivityConfig" ' +# '--is-global true ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg_3}"', +# checks=checks) +# +# +# # EXAMPLE: /ConnectivityConfigurations/get/ConnectivityConfigurationsGet +# @try_manual +# def step_manager_connect_config_show(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager connect-config show ' +# '--configuration-name "myTestConnectivityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg_3}"', +# checks=checks) +# +# +# # EXAMPLE: /ConnectivityConfigurations/get/ConnectivityConfigurationsList +# @try_manual +# def step_manager_connect_config_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager connect-config list ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg_3}"', +# checks=checks) +# +# +# # EXAMPLE: /ConnectivityConfigurations/delete/ConnectivityConfigurationsDelete +# @try_manual +# def step_manager_connect_config_delete(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager connect-config delete -y ' +# '--configuration-name "myTestConnectivityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg_3}"', +# checks=checks) +# +# +# # EXAMPLE: /EffectiveConfigurations/get/List effective configuration +# @try_manual +# def step_effectiveconfiguration_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network effectiveconfiguration list ' +# '--resource-group "{rg_3}" ' +# '--virtual-network-name "{vn}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkGroups/put/NetworkGroupsPut +# @try_manual +# def step_manager_group_create(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager group create ' +# '--name "{myNetworkGroup}" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--description "A sample group" ' +# '--conditional-membership "" ' +# '--display-name "My Network Group" ' +# '--group-members resource-id="/subscriptions/{subscription_id}/resourceGroup/{{rg}}/providers/Microsoft.Ne' +# 'twork/virtualnetworks/{vn_2}" ' +# '--member-type "VirtualNetwork" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkGroups/get/NetworkGroupsGet +# @try_manual +# def step_manager_group_show(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager group show ' +# '--name "{myNetworkGroup}" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkGroups/get/NetworkGroupsList +# @try_manual +# def step_manager_group_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager group list ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /EffectiveVirtualNetworks/post/List Network Manager +# @try_manual +# def step_manager_effect_vnet_list_by_network_manager(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager effect-vnet list-by-network-manager ' +# '--network-manager-name "{myNetworkManager}" ' +# '--conditional-members "location=\'useast2\'" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /EffectiveVirtualNetworks/post/NetworkGroupsList +# @try_manual +# def step_manager_effect_vnet_list_by_network_group(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager effect-vnet list-by-network-group ' +# '--network-group-name "{myNetworkGroup}" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /SecurityConfigurations/put/Create network manager security Configuration +# @try_manual +# def step_manager_security_config_create(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager security-config create ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}" ' +# '--description "A sample policy" ' +# '--applies-to-groups network-group-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micr' +# 'osoft.Network/networkManagers/{myNetworkManager}/networkGroups/{myNetworkGroup2}" ' +# '--delete-existing-ns-gs true ' +# '--security-type "UserPolicy"', +# checks=checks) +# +# +# # EXAMPLE: /SecurityConfigurations/get/Get security configurations +# @try_manual +# def step_manager_security_config_show(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager security-config show ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /SecurityConfigurations/get/List security configurations in a network manager +# @try_manual +# def step_manager_security_config_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager security-config list ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /SecurityConfigurations/post/Evaluate import NSG Rules +# @try_manual +# def step_manager_security_config_evaluate_import(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager security-config evaluate-import ' +# '--configuration-name "myTestConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--admin-security-configuration-uri "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micros' +# 'oft.Network/networkManagers/{myNetworkManager}/securityConfigurations/{mySecurityConfiguration2}" ' +# '--import-deny-rules-as-admin-rules true ' +# '--network-security-group-imports network-security-group-uri="/subscriptions/{subscription_id}/resourceGro' +# 'ups/{rg}/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1" ' +# '--remove-allow-azure-load-balancer-inbound-rule true ' +# '--remove-allow-internet-outbound-rule true ' +# '--remove-allow-vnet-inbound-rule true ' +# '--remove-allow-vnet-outbound-rule true ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /SecurityConfigurations/post/Import NSG Rules +# @try_manual +# def step_manager_security_config_import(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager security-config import ' +# '--configuration-name "myTestConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--admin-security-configuration-uri "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micros' +# 'oft.Network/networkManagers/{myNetworkManager}/securityConfigurations/{mySecurityConfiguration2}" ' +# '--import-deny-rules-as-admin-rules true ' +# '--network-security-group-imports network-security-group-uri="/subscriptions/{subscription_id}/resourceGro' +# 'ups/{rg}/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1" ' +# '--remove-allow-azure-load-balancer-inbound-rule true ' +# '--remove-allow-internet-outbound-rule true ' +# '--remove-allow-vnet-inbound-rule true ' +# '--remove-allow-vnet-outbound-rule true ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkGroups/delete/NetworkGroupsDelete +# @try_manual +# def step_manager_group_delete(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager group delete -y ' +# '--name "{myNetworkGroup}" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkManagerCommits/post/NetworkManageCommitPost +# @try_manual +# def step_manager_commit_post(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager commit post ' +# '--network-manager-name "{myNetworkManager}" ' +# '--commit-type "AdminPolicy" ' +# '--configuration-ids "/subscriptions/{subscription_id}/resourceGroups/{rg_2}/providers/Microsoft.Network/n' +# 'etworkManagers/{myNetworkManager}/securityConfigurations/{mySecurityConfiguration}" ' +# '--target-locations "usest" ' +# '--resource-group "{rg_2}"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkManagerDeploymentStatus/post/NetworkManagerDeploymentStatusList +# @try_manual +# def step_manager_deploy_status_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager deploy-status list ' +# '--network-manager-name "{myNetworkManager}" ' +# '--deployment-types "Connectivity" "AdminPolicy" ' +# '--regions "eastus" "westus" ' +# '--resource-group "{rg_2}"', +# checks=checks) +# +# +# # EXAMPLE: /SecurityConfigurations/delete/Delete network manager security Configuration +# @try_manual +# def step_manager_security_config_delete(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager security-config delete -y ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /UserRules/put/Create a user rule +# @try_manual +# def step_manager_user_rule_create(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager user-rule create ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}" ' +# '--rule-name "SampleUserRule" ' +# '--description "Sample User Rule" ' +# '--destination address-prefix="*" address-prefix-type="IPPrefix" ' +# '--destination-port-ranges "22" ' +# '--direction "Inbound" ' +# '--source address-prefix="*" address-prefix-type="IPPrefix" ' +# '--source-port-ranges "0-65535" ' +# '--protocol "Tcp"', +# checks=checks) +# +# +# # EXAMPLE: /UserRules/get/Gets a user rule +# @try_manual +# def step_manager_user_rule_show(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager user-rule show ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}" ' +# '--rule-name "SampleUserRule"', +# checks=checks) +# +# +# # EXAMPLE: /UserRules/get/List security user rules +# @try_manual +# def step_manager_user_rule_list(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager user-rule list ' +# '--configuration-name "myTestConnectivityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# +# +# # EXAMPLE: /UserRules/delete/Delete a user rule. +# @try_manual +# def step_manager_user_rule_delete(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager user-rule delete -y ' +# '--configuration-name "myTestSecurityConfig" ' +# '--network-manager-name "{myNetworkManager}" ' +# '--resource-group "{rg}" ' +# '--rule-name "SampleUserRule"', +# checks=checks) +# +# +# # EXAMPLE: /NetworkManagers/delete/NetworkManagersDelete +# @try_manual +# def step_manager_delete(test, rg_2, rg, rg_3, checks=None): +# if checks is None: +# checks = [] +# test.cmd('az network manager delete -y ' +# '--name "{myNetworkManager}" ' +# '--resource-group "{rg}"', +# checks=checks) +# diff --git a/src/network-manager/azext_network_manager/tests/latest/preparers.py b/src/network-manager/azext_network_manager/tests/latest/preparers.py new file mode 100644 index 00000000000..0879e51945a --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/preparers.py @@ -0,0 +1,159 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +import os +from datetime import datetime +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' +KEY_VNET_NIC = 'nic' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --subnet-name default --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, + 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_key=KEY_RESOURCE_GROUP, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__(name_prefix, 15) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group = [resource_group_key, None] + self.vnet = [vnet_key, None] + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group[1]: + self.resource_group[1] = self.test_class_instance.kwargs.get( + self.resource_group[0]) + if not self.resource_group[1]: + raise CliTestError("Error: No resource group configured!") + if not self.vnet[1]: + self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) + if not self.vnet[1]: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + pass + + +class VnetNicPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.nic', + parameter_name='subnet', + resource_group_key=KEY_RESOURCE_GROUP, + vnet_key=KEY_VIRTUAL_NETWORK, + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_NIC_NAME', + key=KEY_VNET_NIC): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetNicPreparer, self).__init__(name_prefix, 15) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group = [resource_group_key, None] + self.vnet = [vnet_key, None] + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group[1]: + self.resource_group[1] = self.test_class_instance.kwargs.get( + self.resource_group[0]) + if not self.resource_group[1]: + raise CliTestError("Error: No resource group configured!") + if not self.vnet[1]: + self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) + if not self.vnet[1]: + raise CliTestError("Error: No vnet configured!") + + template = 'az network nic create --resource-group {} --name {} --vnet-name {} --subnet default ' + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group[1], name, self.vnet[1])) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, + 'az network nic delete --name {} --resource-group {}'.format(name, self.resource_group[1])) diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py new file mode 100644 index 00000000000..7db12659041 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------- +# 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=line-too-long + +import os +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer +from .preparers import VirtualNetworkPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Test class for Scenario +class NetworkScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(NetworkScenarioTest, self).__init__(*args, **kwargs) + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'myNetworkManager': 'testNetworkManager', + 'myNetworkManager2': 'TestNetworkManager', + 'myNetworkGroup2': 'testGroup', + 'myNetworkGroup': 'TestNetworkGroup', + 'mySecurityConfiguration': 'SampleSecurityConfig', + 'mySecurityConfiguration2': 'adminConfig', + }) + + @ResourceGroupPreparer(name_prefix='clitestnetwork_resoureGroupSample'[:7], key='rg_2', parameter_name='rg_2') + @ResourceGroupPreparer(name_prefix='clitestnetwork_rg1'[:7], key='rg', parameter_name='rg') + @ResourceGroupPreparer(name_prefix='clitestnetwork_myResourceGroup'[:7], key='rg_3', parameter_name='rg_3') + @VirtualNetworkPreparer(name_prefix='clitestnetwork_vnet1'[:7], key='vn_2', resource_group_key='rg_2') + @VirtualNetworkPreparer(name_prefix='clitestnetwork_testVirtualNetwork'[:7], key='vn', resource_group_key='rg_2') + def test_network_Scenario(self, rg_2, rg, rg_3): + pass diff --git a/src/network-manager/azext_network_manager/vendored_sdks/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c214c7c10b9 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py @@ -0,0 +1,11 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._network_management_client import NetworkManagementClient +__all__ = ['NetworkManagementClient'] + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py new file mode 100644 index 00000000000..22353bbf415 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py @@ -0,0 +1,70 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class NetworkManagementClientConfiguration(Configuration): + """Configuration for NetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(NetworkManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-02-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-network/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json b/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json new file mode 100644 index 00000000000..c3a743d58bf --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json @@ -0,0 +1,71 @@ +{ + "chosen_version": "2021-02-01-preview", + "total_api_version_list": ["2021-02-01-preview"], + "client": { + "name": "NetworkManagementClient", + "filename": "_network_management_client", + "description": "Network Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "network_managers": "NetworkManagersOperations", + "network_manager_commits": "NetworkManagerCommitsOperations", + "network_manager_deployment_status": "NetworkManagerDeploymentStatusOperations", + "effective_virtual_networks": "EffectiveVirtualNetworksOperations", + "active_configurations": "ActiveConfigurationsOperations", + "connectivity_configurations": "ConnectivityConfigurationsOperations", + "effective_configurations": "EffectiveConfigurationsOperations", + "network_groups": "NetworkGroupsOperations", + "security_configurations": "SecurityConfigurationsOperations", + "admin_rules": "AdminRulesOperations", + "user_rules": "UserRulesOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py new file mode 100644 index 00000000000..a7d24273c18 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py @@ -0,0 +1,118 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import NetworkManagementClientConfiguration +from .operations import NetworkManagersOperations +from .operations import NetworkManagerCommitsOperations +from .operations import NetworkManagerDeploymentStatusOperations +from .operations import EffectiveVirtualNetworksOperations +from .operations import ActiveConfigurationsOperations +from .operations import ConnectivityConfigurationsOperations +from .operations import EffectiveConfigurationsOperations +from .operations import NetworkGroupsOperations +from .operations import SecurityConfigurationsOperations +from .operations import AdminRulesOperations +from .operations import UserRulesOperations +from . import models + + +class NetworkManagementClient(object): + """Network Client. + + :ivar network_managers: NetworkManagersOperations operations + :vartype network_managers: azure.mgmt.network.v2021_02_preview.operations.NetworkManagersOperations + :ivar network_manager_commits: NetworkManagerCommitsOperations operations + :vartype network_manager_commits: azure.mgmt.network.v2021_02_preview.operations.NetworkManagerCommitsOperations + :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations + :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_preview.operations.NetworkManagerDeploymentStatusOperations + :ivar effective_virtual_networks: EffectiveVirtualNetworksOperations operations + :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_preview.operations.EffectiveVirtualNetworksOperations + :ivar active_configurations: ActiveConfigurationsOperations operations + :vartype active_configurations: azure.mgmt.network.v2021_02_preview.operations.ActiveConfigurationsOperations + :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations + :vartype connectivity_configurations: azure.mgmt.network.v2021_02_preview.operations.ConnectivityConfigurationsOperations + :ivar effective_configurations: EffectiveConfigurationsOperations operations + :vartype effective_configurations: azure.mgmt.network.v2021_02_preview.operations.EffectiveConfigurationsOperations + :ivar network_groups: NetworkGroupsOperations operations + :vartype network_groups: azure.mgmt.network.v2021_02_preview.operations.NetworkGroupsOperations + :ivar security_configurations: SecurityConfigurationsOperations operations + :vartype security_configurations: azure.mgmt.network.v2021_02_preview.operations.SecurityConfigurationsOperations + :ivar admin_rules: AdminRulesOperations operations + :vartype admin_rules: azure.mgmt.network.v2021_02_preview.operations.AdminRulesOperations + :ivar user_rules: UserRulesOperations operations + :vartype user_rules: azure.mgmt.network.v2021_02_preview.operations.UserRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = NetworkManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.network_managers = NetworkManagersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_manager_commits = NetworkManagerCommitsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.effective_virtual_networks = EffectiveVirtualNetworksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_configurations = ActiveConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.connectivity_configurations = ConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.effective_configurations = EffectiveConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_groups = NetworkGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.security_configurations = SecurityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_rules = AdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.user_rules = UserRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> NetworkManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py new file mode 100644 index 00000000000..1c78defcf22 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._network_management_client import NetworkManagementClient +__all__ = ['NetworkManagementClient'] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py new file mode 100644 index 00000000000..06887c8f98e --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class NetworkManagementClientConfiguration(Configuration): + """Configuration for NetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(NetworkManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-02-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-network/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py new file mode 100644 index 00000000000..97b335253f0 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import NetworkManagementClientConfiguration +from .operations import NetworkManagersOperations +from .operations import NetworkManagerCommitsOperations +from .operations import NetworkManagerDeploymentStatusOperations +from .operations import EffectiveVirtualNetworksOperations +from .operations import ActiveConfigurationsOperations +from .operations import ConnectivityConfigurationsOperations +from .operations import EffectiveConfigurationsOperations +from .operations import NetworkGroupsOperations +from .operations import SecurityConfigurationsOperations +from .operations import AdminRulesOperations +from .operations import UserRulesOperations +from .. import models + + +class NetworkManagementClient(object): + """Network Client. + + :ivar network_managers: NetworkManagersOperations operations + :vartype network_managers: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkManagersOperations + :ivar network_manager_commits: NetworkManagerCommitsOperations operations + :vartype network_manager_commits: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkManagerCommitsOperations + :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations + :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkManagerDeploymentStatusOperations + :ivar effective_virtual_networks: EffectiveVirtualNetworksOperations operations + :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_preview.aio.operations.EffectiveVirtualNetworksOperations + :ivar active_configurations: ActiveConfigurationsOperations operations + :vartype active_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.ActiveConfigurationsOperations + :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations + :vartype connectivity_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.ConnectivityConfigurationsOperations + :ivar effective_configurations: EffectiveConfigurationsOperations operations + :vartype effective_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.EffectiveConfigurationsOperations + :ivar network_groups: NetworkGroupsOperations operations + :vartype network_groups: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkGroupsOperations + :ivar security_configurations: SecurityConfigurationsOperations operations + :vartype security_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.SecurityConfigurationsOperations + :ivar admin_rules: AdminRulesOperations operations + :vartype admin_rules: azure.mgmt.network.v2021_02_preview.aio.operations.AdminRulesOperations + :ivar user_rules: UserRulesOperations operations + :vartype user_rules: azure.mgmt.network.v2021_02_preview.aio.operations.UserRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = NetworkManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.network_managers = NetworkManagersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_manager_commits = NetworkManagerCommitsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.effective_virtual_networks = EffectiveVirtualNetworksOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_configurations = ActiveConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.connectivity_configurations = ConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.effective_configurations = EffectiveConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_groups = NetworkGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.security_configurations = SecurityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_rules = AdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.user_rules = UserRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "NetworkManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py new file mode 100644 index 00000000000..ad5afd67132 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._network_managers_operations import NetworkManagersOperations +from ._network_manager_commits_operations import NetworkManagerCommitsOperations +from ._network_manager_deployment_status_operations import NetworkManagerDeploymentStatusOperations +from ._effective_virtual_networks_operations import EffectiveVirtualNetworksOperations +from ._active_configurations_operations import ActiveConfigurationsOperations +from ._connectivity_configurations_operations import ConnectivityConfigurationsOperations +from ._effective_configurations_operations import EffectiveConfigurationsOperations +from ._network_groups_operations import NetworkGroupsOperations +from ._security_configurations_operations import SecurityConfigurationsOperations +from ._admin_rules_operations import AdminRulesOperations +from ._user_rules_operations import UserRulesOperations + +__all__ = [ + 'NetworkManagersOperations', + 'NetworkManagerCommitsOperations', + 'NetworkManagerDeploymentStatusOperations', + 'EffectiveVirtualNetworksOperations', + 'ActiveConfigurationsOperations', + 'ConnectivityConfigurationsOperations', + 'EffectiveConfigurationsOperations', + 'NetworkGroupsOperations', + 'SecurityConfigurationsOperations', + 'AdminRulesOperations', + 'UserRulesOperations', +] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py new file mode 100644 index 00000000000..4568d09f421 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py @@ -0,0 +1,134 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActiveConfigurationsOperations: + """ActiveConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + region: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.ActiveConfigurationListResult"]: + """Lists active configurations in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :param region: Location name. + :type region: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActiveConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.ActiveConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if region is not None: + query_parameters['region'] = self._serialize.query("region", region, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ActiveConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/activeConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py new file mode 100644 index 00000000000..7313147c5cd --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py @@ -0,0 +1,340 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AdminRulesOperations: + """AdminRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.AdminRuleListResult"]: + """Retrieves a network manager security configuration admin rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AdminRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.AdminRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AdminRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_name: str, + **kwargs + ) -> "_models.AdminRule": + """Gets a network manager security configuration admin rule in a subscription. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AdminRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_name: str, + admin_rule: "_models.AdminRule", + **kwargs + ) -> "_models.AdminRule": + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param admin_rule: The admin rule to create or update. + :type admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(admin_rule, 'AdminRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AdminRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AdminRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_name: str, + **kwargs + ) -> None: + """Deletes an admin rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py new file mode 100644 index 00000000000..da3539abd5f --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py @@ -0,0 +1,327 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectivityConfigurationsOperations: + """ConnectivityConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs + ) -> "_models.ConnectivityConfiguration": + """Gets a Network Connectivity Configuration, specified by the resource group, network manager + name, and connectivity Configuration name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectivityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: "_models.ConnectivityConfiguration", + **kwargs + ) -> "_models.ConnectivityConfiguration": + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. + :type connectivity_configuration: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connectivity_configuration, 'ConnectivityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConnectivityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectivityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs + ) -> None: + """Deletes a network manager connectivity configuration, specified by the resource group, network + manager name, and connectivity configuration name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.ConnectivityConfigurationListResult"]: + """Lists all the network manager connectivity configuration in a specified network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectivityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConnectivityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py new file mode 100644 index 00000000000..fbbc7ed211e --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py @@ -0,0 +1,129 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EffectiveConfigurationsOperations: + """EffectiveConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + virtual_network_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.NetworkManagerEffectiveConfigurationListResult"]: + """List all configurations in a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerEffectiveConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerEffectiveConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerEffectiveConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/networkManagerEffectiveConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py new file mode 100644 index 00000000000..a5d18f98f75 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py @@ -0,0 +1,237 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EffectiveVirtualNetworksOperations: + """EffectiveVirtualNetworksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_network_manager( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + parameters: Optional["_models.EffectiveVirtualNetworksParameter"] = None, + **kwargs + ) -> AsyncIterable["_models.EffectiveVirtualNetworksListResult"]: + """List effective virtual networks in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :param parameters: Effective Virtual Networks Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_network_manager.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore + + def list_by_network_group( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.EffectiveVirtualNetworksListResult"]: + """Lists all effective virtual networks by specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_network_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py new file mode 100644 index 00000000000..6643a8b7f9e --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py @@ -0,0 +1,334 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkGroupsOperations: + """NetworkGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + **kwargs + ) -> "_models.NetworkGroup": + """Gets the specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkGroup, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: "_models.NetworkGroup", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.NetworkGroup": + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :param if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkGroup, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) + + if response.status_code == 201: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + **kwargs + ) -> None: + """Deletes a network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.NetworkGroupListResult"]: + """Lists the specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py new file mode 100644 index 00000000000..8fcc4432d76 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py @@ -0,0 +1,104 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagerCommitsOperations: + """NetworkManagerCommitsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManagerCommit", + **kwargs + ) -> None: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerCommit + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerCommit') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py new file mode 100644 index 00000000000..3bffcd9d4d0 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py @@ -0,0 +1,140 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagerDeploymentStatusOperations: + """NetworkManagerDeploymentStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManagerDeploymentStatusParameter", + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.NetworkManagerDeploymentStatusListResult"]: + """Post List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusParameter + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerDeploymentStatusListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerDeploymentStatusListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py new file mode 100644 index 00000000000..d281f3823dd --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py @@ -0,0 +1,453 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagersOperations: + """NetworkManagersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + **kwargs + ) -> "_models.NetworkManager": + """Gets the specified Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManager", + **kwargs + ) -> "_models.NetworkManager": + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManager') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + **kwargs + ) -> None: + """Deletes a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + async def patch_tags( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.TagsObject", + **kwargs + ) -> "_models.NetworkManager": + """Patch a NetworkManager Tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to update network manager tags. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.patch_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + def list_by_subscription( + self, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.NetworkManagerListResult"]: + """List all network managers in a subscription. + + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers'} # type: ignore + + def list( + self, + resource_group_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.NetworkManagerListResult"]: + """List network managers in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py new file mode 100644 index 00000000000..93c25596fde --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py @@ -0,0 +1,497 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SecurityConfigurationsOperations: + """SecurityConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.SecurityConfigurationListResult"]: + """Lists all the network manager security configurations in a network manager, in a paginated + format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations'} # type: ignore + + async def import_method( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + parameters: "_models.NetworkManagerSecurityConfigurationImport", + **kwargs + ) -> "_models.SecurityConfigurationImportResult": + """Imports network security rules to network manager security rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param parameters: Import Security configuration parameter. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfigurationImportResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationImportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationImportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_method.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfigurationImportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/import'} # type: ignore + + def evaluate_import( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + parameters: "_models.NetworkManagerSecurityConfigurationImport", + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.SecurityConfigurationRuleListResult"]: + """The operation to evaluate import NSG to security configurations. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param parameters: Import security configuration parameter. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.evaluate_import.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + evaluate_import.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/evaluateImport'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs + ) -> "_models.SecurityConfiguration": + """Retrieves a network manager security Configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_configuration: "_models.SecurityConfiguration", + **kwargs + ) -> "_models.SecurityConfiguration": + """Creates or updates a network manager security Configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param security_configuration: The security configuration to create or update. + :type security_configuration: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(security_configuration, 'SecurityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs + ) -> None: + """Deletes a network manager security Configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py new file mode 100644 index 00000000000..3bc67fa557c --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py @@ -0,0 +1,340 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UserRulesOperations: + """UserRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.UserRuleListResult"]: + """Lists all user rules in a security configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.UserRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('UserRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_name: str, + **kwargs + ) -> "_models.UserRule": + """Gets a user rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_name: str, + user_rule: "_models.UserRule", + **kwargs + ) -> "_models.UserRule": + """Creates or updates a user rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param user_rule: The user rule to create or update. + :type user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_rule, 'UserRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('UserRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('UserRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_name: str, + **kwargs + ) -> None: + """Deletes a user rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py new file mode 100644 index 00000000000..976debc5b29 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py @@ -0,0 +1,200 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActiveConfiguration + from ._models_py3 import ActiveConfigurationListResult + from ._models_py3 import AddressPrefixItem + from ._models_py3 import AdminRule + from ._models_py3 import AdminRuleListResult + from ._models_py3 import AzureAsyncOperationResult + from ._models_py3 import CloudErrorBody + from ._models_py3 import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties + from ._models_py3 import ConnectivityConfiguration + from ._models_py3 import ConnectivityConfigurationListResult + from ._models_py3 import ConnectivityGroupItem + from ._models_py3 import EffectiveConfiguration + from ._models_py3 import EffectiveVirtualNetwork + from ._models_py3 import EffectiveVirtualNetworksListResult + from ._models_py3 import EffectiveVirtualNetworksParameter + from ._models_py3 import Error + from ._models_py3 import ErrorDetails + from ._models_py3 import ExtendedLocation + from ._models_py3 import FailedImport + from ._models_py3 import GroupMembersItem + from ._models_py3 import ManagedServiceIdentity + from ._models_py3 import NetworkGroup + from ._models_py3 import NetworkGroupListResult + from ._models_py3 import NetworkManager + from ._models_py3 import NetworkManagerCommit + from ._models_py3 import NetworkManagerDeploymentStatus + from ._models_py3 import NetworkManagerDeploymentStatusListResult + from ._models_py3 import NetworkManagerDeploymentStatusParameter + from ._models_py3 import NetworkManagerEffectiveConfigurationListResult + from ._models_py3 import NetworkManagerListResult + from ._models_py3 import NetworkManagerPropertiesNetworkManagerScopes + from ._models_py3 import NetworkManagerSecurityConfigurationImport + from ._models_py3 import NetworkManagerSecurityGroupItem + from ._models_py3 import NetworkSecurityGroupImport + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import SecurityConfiguration + from ._models_py3 import SecurityConfigurationImportResult + from ._models_py3 import SecurityConfigurationListResult + from ._models_py3 import SecurityConfigurationRule + from ._models_py3 import SecurityConfigurationRuleListResult + from ._models_py3 import SubResource + from ._models_py3 import SystemData + from ._models_py3 import TagsObject + from ._models_py3 import UserRule + from ._models_py3 import UserRuleListResult +except (SyntaxError, ImportError): + from ._models import ActiveConfiguration # type: ignore + from ._models import ActiveConfigurationListResult # type: ignore + from ._models import AddressPrefixItem # type: ignore + from ._models import AdminRule # type: ignore + from ._models import AdminRuleListResult # type: ignore + from ._models import AzureAsyncOperationResult # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import ConnectivityConfiguration # type: ignore + from ._models import ConnectivityConfigurationListResult # type: ignore + from ._models import ConnectivityGroupItem # type: ignore + from ._models import EffectiveConfiguration # type: ignore + from ._models import EffectiveVirtualNetwork # type: ignore + from ._models import EffectiveVirtualNetworksListResult # type: ignore + from ._models import EffectiveVirtualNetworksParameter # type: ignore + from ._models import Error # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import ExtendedLocation # type: ignore + from ._models import FailedImport # type: ignore + from ._models import GroupMembersItem # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import NetworkGroup # type: ignore + from ._models import NetworkGroupListResult # type: ignore + from ._models import NetworkManager # type: ignore + from ._models import NetworkManagerCommit # type: ignore + from ._models import NetworkManagerDeploymentStatus # type: ignore + from ._models import NetworkManagerDeploymentStatusListResult # type: ignore + from ._models import NetworkManagerDeploymentStatusParameter # type: ignore + from ._models import NetworkManagerEffectiveConfigurationListResult # type: ignore + from ._models import NetworkManagerListResult # type: ignore + from ._models import NetworkManagerPropertiesNetworkManagerScopes # type: ignore + from ._models import NetworkManagerSecurityConfigurationImport # type: ignore + from ._models import NetworkManagerSecurityGroupItem # type: ignore + from ._models import NetworkSecurityGroupImport # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import SecurityConfiguration # type: ignore + from ._models import SecurityConfigurationImportResult # type: ignore + from ._models import SecurityConfigurationListResult # type: ignore + from ._models import SecurityConfigurationRule # type: ignore + from ._models import SecurityConfigurationRuleListResult # type: ignore + from ._models import SubResource # type: ignore + from ._models import SystemData # type: ignore + from ._models import TagsObject # type: ignore + from ._models import UserRule # type: ignore + from ._models import UserRuleListResult # type: ignore + +from ._network_management_client_enums import ( + Access, + AddressPrefixType, + AuthenticationMethod, + CommitType, + ConfigType, + ConnectivityTopology, + CreatedByType, + DeploymentStatus, + DeploymentType, + ExtendedLocationTypes, + GroupConnectivity, + IPAllocationMethod, + IPVersion, + MemberType, + MembershipType, + NetworkOperationStatus, + ProvisioningState, + ResourceIdentityType, + ScopeAccesses, + SecurityConfigurationRuleAccess, + SecurityConfigurationRuleDirection, + SecurityConfigurationRuleProtocol, + SecurityType, +) + +__all__ = [ + 'ActiveConfiguration', + 'ActiveConfigurationListResult', + 'AddressPrefixItem', + 'AdminRule', + 'AdminRuleListResult', + 'AzureAsyncOperationResult', + 'CloudErrorBody', + 'Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties', + 'ConnectivityConfiguration', + 'ConnectivityConfigurationListResult', + 'ConnectivityGroupItem', + 'EffectiveConfiguration', + 'EffectiveVirtualNetwork', + 'EffectiveVirtualNetworksListResult', + 'EffectiveVirtualNetworksParameter', + 'Error', + 'ErrorDetails', + 'ExtendedLocation', + 'FailedImport', + 'GroupMembersItem', + 'ManagedServiceIdentity', + 'NetworkGroup', + 'NetworkGroupListResult', + 'NetworkManager', + 'NetworkManagerCommit', + 'NetworkManagerDeploymentStatus', + 'NetworkManagerDeploymentStatusListResult', + 'NetworkManagerDeploymentStatusParameter', + 'NetworkManagerEffectiveConfigurationListResult', + 'NetworkManagerListResult', + 'NetworkManagerPropertiesNetworkManagerScopes', + 'NetworkManagerSecurityConfigurationImport', + 'NetworkManagerSecurityGroupItem', + 'NetworkSecurityGroupImport', + 'ProxyResource', + 'Resource', + 'SecurityConfiguration', + 'SecurityConfigurationImportResult', + 'SecurityConfigurationListResult', + 'SecurityConfigurationRule', + 'SecurityConfigurationRuleListResult', + 'SubResource', + 'SystemData', + 'TagsObject', + 'UserRule', + 'UserRuleListResult', + 'Access', + 'AddressPrefixType', + 'AuthenticationMethod', + 'CommitType', + 'ConfigType', + 'ConnectivityTopology', + 'CreatedByType', + 'DeploymentStatus', + 'DeploymentType', + 'ExtendedLocationTypes', + 'GroupConnectivity', + 'IPAllocationMethod', + 'IPVersion', + 'MemberType', + 'MembershipType', + 'NetworkOperationStatus', + 'ProvisioningState', + 'ResourceIdentityType', + 'ScopeAccesses', + 'SecurityConfigurationRuleAccess', + 'SecurityConfigurationRuleDirection', + 'SecurityConfigurationRuleProtocol', + 'SecurityType', +] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py new file mode 100644 index 00000000000..4bb41d3f105 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py @@ -0,0 +1,1612 @@ +# 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. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class EffectiveConfiguration(msrest.serialization.Model): + """The network manager effective configuration. + + :param config_type: Effective configuration. Possible values include: "AdminPolicy", + "UserPolicy", "Connectivity". + :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType + :param connectivity_configuration: Connectivity configuration object. + :type connectivity_configuration: + ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :param security_admin_rule: Security admin rule object. + :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :param security_user_rule: Security user rule object. + :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param configuration_groups: Effective configuration groups. + :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + """ + + _attribute_map = { + 'config_type': {'key': 'configType', 'type': 'str'}, + 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, + 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, + 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveConfiguration, self).__init__(**kwargs) + self.config_type = kwargs.get('config_type', None) + self.connectivity_configuration = kwargs.get('connectivity_configuration', None) + self.security_admin_rule = kwargs.get('security_admin_rule', None) + self.security_user_rule = kwargs.get('security_user_rule', None) + self.configuration_groups = kwargs.get('configuration_groups', None) + + +class ActiveConfiguration(EffectiveConfiguration): + """Active Configuration. + + :param config_type: Effective configuration. Possible values include: "AdminPolicy", + "UserPolicy", "Connectivity". + :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType + :param connectivity_configuration: Connectivity configuration object. + :type connectivity_configuration: + ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :param security_admin_rule: Security admin rule object. + :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :param security_user_rule: Security user rule object. + :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param configuration_groups: Effective configuration groups. + :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + """ + + _attribute_map = { + 'config_type': {'key': 'configType', 'type': 'str'}, + 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, + 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, + 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveConfiguration, self).__init__(**kwargs) + self.commit_time = kwargs.get('commit_time', None) + self.region = kwargs.get('region', None) + + +class ActiveConfigurationListResult(msrest.serialization.Model): + """Result of the request to list active configurations. It contains a list of active configurations and a URL link to get the next set of results. + + :param value: Gets a page of active configurations. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.ActiveConfiguration] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActiveConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AddressPrefixItem(msrest.serialization.Model): + """Address prefix item. + + :param address_prefix: Address prefix. + :type address_prefix: str + :param address_prefix_type: Address prefix type. Possible values include: "IPPrefix", + "ServiceTag". + :type address_prefix_type: str or ~azure.mgmt.network.v2021_02_preview.models.AddressPrefixType + """ + + _attribute_map = { + 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, + 'address_prefix_type': {'key': 'addressPrefixType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AddressPrefixItem, self).__init__(**kwargs) + self.address_prefix = kwargs.get('address_prefix', None) + self.address_prefix_type = kwargs.get('address_prefix_type', None) + + +class ProxyResource(msrest.serialization.Model): + """Proxy resource representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class AdminRule(ProxyResource): + """Network admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol + :param source: The CIDR or source IP ranges. + :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param destination: The destination address prefixes. CIDR or destination IP ranges. + :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :type access: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleAccess + :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :type priority: int + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security Configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, + 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(AdminRule, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.protocol = kwargs.get('protocol', None) + self.source = kwargs.get('source', None) + self.destination = kwargs.get('destination', None) + self.source_port_ranges = kwargs.get('source_port_ranges', None) + self.destination_port_ranges = kwargs.get('destination_port_ranges', None) + self.access = kwargs.get('access', None) + self.priority = kwargs.get('priority', None) + self.direction = kwargs.get('direction', None) + self.provisioning_state = None + self.applies_to_groups = kwargs.get('applies_to_groups', None) + + +class AdminRuleListResult(msrest.serialization.Model): + """Security configuration admin rule list result. + + :param value: A list of admin rules. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.AdminRule] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AdminRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AdminRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AzureAsyncOperationResult(msrest.serialization.Model): + """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. + + :param status: Status of the Azure async operation. Possible values include: "InProgress", + "Succeeded", "Failed". + :type status: str or ~azure.mgmt.network.v2021_02_preview.models.NetworkOperationStatus + :param error: Details of the error occurred during specified asynchronous operation. + :type error: ~azure.mgmt.network.v2021_02_preview.models.Error + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureAsyncOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user + interface. + :type message: str + :param target: The target of the particular error. For example, the name of the property in + error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.network.v2021_02_preview.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ConnectivityConfiguration(ProxyResource): + """The network manager connectivity configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the resource. + :type display_name: str + :param description: A description of the connectivity configuration. + :type description: str + :param connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpokeTopology", "MeshTopology". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_preview.models.ConnectivityTopology + :param hub_id: The hub vnet Id. + :type hub_id: str + :param is_global: Flag if global mesh is supported. + :type is_global: bool + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. + :type delete_existing_peering: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, + 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'bool'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectivityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.connectivity_topology = kwargs.get('connectivity_topology', None) + self.hub_id = kwargs.get('hub_id', None) + self.is_global = kwargs.get('is_global', None) + self.applies_to_groups = kwargs.get('applies_to_groups', None) + self.provisioning_state = None + self.delete_existing_peering = kwargs.get('delete_existing_peering', None) + + +class ConnectivityConfigurationListResult(msrest.serialization.Model): + """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. + + :param value: Gets a page of Connectivity Configurations. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectivityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectivityConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ConnectivityGroupItem(msrest.serialization.Model): + """ConnectivityGroupItem. + + :param network_group_id: Network group Id. + :type network_group_id: str + :param use_hub_gateway: Flag if need to use hub gateway. + :type use_hub_gateway: bool + :param is_global: Flag if global is supported. + :type is_global: bool + :param group_connectivity: Group connectivity type. Possible values include: "None", + "DirectlyConnected". + :type group_connectivity: str or ~azure.mgmt.network.v2021_02_preview.models.GroupConnectivity + """ + + _attribute_map = { + 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, + 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'bool'}, + 'is_global': {'key': 'isGlobal', 'type': 'bool'}, + 'group_connectivity': {'key': 'groupConnectivity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectivityGroupItem, self).__init__(**kwargs) + self.network_group_id = kwargs.get('network_group_id', None) + self.use_hub_gateway = kwargs.get('use_hub_gateway', None) + self.is_global = kwargs.get('is_global', None) + self.group_connectivity = kwargs.get('group_connectivity', None) + + +class EffectiveVirtualNetwork(msrest.serialization.Model): + """Effective Virtual Network. + + :param id: Effective vnet Id. + :type id: str + :param location: Location of vnet. + :type location: str + :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". + :type membership_type: str or ~azure.mgmt.network.v2021_02_preview.models.MembershipType + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'membership_type': {'key': 'membershipType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveVirtualNetwork, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.location = kwargs.get('location', None) + self.membership_type = kwargs.get('membership_type', None) + + +class EffectiveVirtualNetworksListResult(msrest.serialization.Model): + """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. + + :param value: Gets a page of EffectiveVirtualNetwork. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetwork] + :param total_records: Total Records. + :type total_records: int + :param first_index: First Index. + :type first_index: int + :param page_size: Page Size. + :type page_size: int + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, + 'total_records': {'key': 'totalRecords', 'type': 'int'}, + 'first_index': {'key': 'firstIndex', 'type': 'int'}, + 'page_size': {'key': 'pageSize', 'type': 'int'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.total_records = kwargs.get('total_records', None) + self.first_index = kwargs.get('first_index', None) + self.page_size = kwargs.get('page_size', None) + self.next_link = kwargs.get('next_link', None) + + +class EffectiveVirtualNetworksParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. + + :param conditional_members: Conditional Members. + :type conditional_members: str + """ + + _attribute_map = { + 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) + self.conditional_members = kwargs.get('conditional_members', None) + + +class Error(msrest.serialization.Model): + """Common error representation. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + :param target: Error target. + :type target: str + :param details: Error details. + :type details: list[~azure.mgmt.network.v2021_02_preview.models.ErrorDetails] + :param inner_error: Inner error message. + :type inner_error: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'inner_error': {'key': 'innerError', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.inner_error = kwargs.get('inner_error', None) + + +class ErrorDetails(msrest.serialization.Model): + """Common error details representation. + + :param code: Error code. + :type code: str + :param target: Error target. + :type target: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.target = kwargs.get('target', None) + self.message = kwargs.get('message', None) + + +class ExtendedLocation(msrest.serialization.Model): + """ExtendedLocation complex type. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the extended location. + :type name: str + :param type: Required. The type of the extended location. Possible values include: "EdgeZone". + :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ExtendedLocationTypes + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedLocation, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class FailedImport(msrest.serialization.Model): + """Failed imports object. + + :param failure_code: Failure code. + :type failure_code: str + :param failure_reason: Failure reason. + :type failure_reason: str + """ + + _attribute_map = { + 'failure_code': {'key': 'failureCode', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FailedImport, self).__init__(**kwargs) + self.failure_code = kwargs.get('failure_code', None) + self.failure_reason = kwargs.get('failure_reason', None) + + +class GroupMembersItem(msrest.serialization.Model): + """GroupMembers Item. + + :param resource_id: Resource Id. + :type resource_id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupMembersItem, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity. This property will only + be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the virtual machine. Possible + values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with resource. The user + identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.network.v2021_02_preview.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class NetworkGroup(ProxyResource): + """The network group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the network group. + :type display_name: str + :param description: A description of the network group. + :type description: str + :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". + :type member_type: str or ~azure.mgmt.network.v2021_02_preview.models.MemberType + :param group_members: Group members of network group. + :type group_members: list[~azure.mgmt.network.v2021_02_preview.models.GroupMembersItem] + :param conditional_membership: Network group conditional filter. + :type conditional_membership: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'member_type': {'key': 'properties.memberType', 'type': 'str'}, + 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, + 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkGroup, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.member_type = kwargs.get('member_type', None) + self.group_members = kwargs.get('group_members', None) + self.conditional_membership = kwargs.get('conditional_membership', None) + self.provisioning_state = None + + +class NetworkGroupListResult(msrest.serialization.Model): + """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. + + :param value: Gets a page of NetworkGroup. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Resource(msrest.serialization.Model): + """Common resource representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class NetworkManager(Resource): + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the network manager. + :type display_name: str + :param description: A description of the network manager. + :type description: str + :param network_manager_scopes: Scope of Network Manager. + :type network_manager_scopes: + ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerPropertiesNetworkManagerScopes + :param network_manager_scope_accesses: Scope Access. + :type network_manager_scope_accesses: list[str or + ~azure.mgmt.network.v2021_02_preview.models.ScopeAccesses] + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'network_manager_scopes': {'key': 'properties.networkManagerScopes', 'type': 'NetworkManagerPropertiesNetworkManagerScopes'}, + 'network_manager_scope_accesses': {'key': 'properties.networkManagerScopeAccesses', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManager, self).__init__(**kwargs) + self.etag = None + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.network_manager_scopes = kwargs.get('network_manager_scopes', None) + self.network_manager_scope_accesses = kwargs.get('network_manager_scope_accesses', None) + self.provisioning_state = None + + +class NetworkManagerCommit(msrest.serialization.Model): + """Network Manager Commit. + + :param target_locations: List of target locations. + :type target_locations: list[str] + :param configuration_ids: List of configuration ids. + :type configuration_ids: list[str] + :param commit_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy", + "Routing", "Connectivity". + :type commit_type: str or ~azure.mgmt.network.v2021_02_preview.models.CommitType + """ + + _attribute_map = { + 'target_locations': {'key': 'targetLocations', 'type': '[str]'}, + 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, + 'commit_type': {'key': 'commitType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerCommit, self).__init__(**kwargs) + self.target_locations = kwargs.get('target_locations', None) + self.configuration_ids = kwargs.get('configuration_ids', None) + self.commit_type = kwargs.get('commit_type', None) + + +class NetworkManagerDeploymentStatus(msrest.serialization.Model): + """Network Manager Deployment Status. + + :param commit_time: Commit Time. + :type commit_time: ~datetime.datetime + :param region: Region Name. + :type region: str + :param deployment_status: Deployment Status. Possible values include: "NotStarted", + "Deploying", "Deployed", "Failed". + :type deployment_status: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentStatus + :param configuration_ids: List of configuration ids. + :type configuration_ids: list[str] + :param deployment_type: Configuration Deployment Type. Possible values include: "AdminPolicy", + "UserPolicy", "Routing", "Connectivity". + :type deployment_type: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType + :param error_message: Error Message. + :type error_message: str + """ + + _attribute_map = { + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerDeploymentStatus, self).__init__(**kwargs) + self.commit_time = kwargs.get('commit_time', None) + self.region = kwargs.get('region', None) + self.deployment_status = kwargs.get('deployment_status', None) + self.configuration_ids = kwargs.get('configuration_ids', None) + self.deployment_type = kwargs.get('deployment_type', None) + self.error_message = kwargs.get('error_message', None) + + +class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): + """A list of Network Manager Deployment Status. + + :param value: Gets a page of Network Manager Deployment Status. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatus] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): + """Network Manager Deployment Status Parameter. + + :param regions: List of locations. + :type regions: list[str] + :param deployment_types: List of configurations' deployment types. + :type deployment_types: list[str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType] + """ + + _attribute_map = { + 'regions': {'key': 'regions', 'type': '[str]'}, + 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) + self.regions = kwargs.get('regions', None) + self.deployment_types = kwargs.get('deployment_types', None) + + +class NetworkManagerEffectiveConfigurationListResult(msrest.serialization.Model): + """Result of the request to list networkManagerEffectiveConfiguration. It contains a list of groups and a URL link to get the next set of results. + + :param value: Gets a page of NetworkManagerEffectiveConfiguration. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveConfiguration] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EffectiveConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerEffectiveConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NetworkManagerListResult(msrest.serialization.Model): + """Result of the request to list NetworkManager. It contains a list of network managers and a URL link to get the next set of results. + + :param value: Gets a page of NetworkManager. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManager] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkManager]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NetworkManagerPropertiesNetworkManagerScopes(msrest.serialization.Model): + """Scope of Network Manager. + + :param management_groups: List of management groups. + :type management_groups: list[str] + :param subscriptions: List of subscriptions. + :type subscriptions: list[str] + """ + + _attribute_map = { + 'management_groups': {'key': 'managementGroups', 'type': '[str]'}, + 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerPropertiesNetworkManagerScopes, self).__init__(**kwargs) + self.management_groups = kwargs.get('management_groups', None) + self.subscriptions = kwargs.get('subscriptions', None) + + +class NetworkManagerSecurityConfigurationImport(msrest.serialization.Model): + """Network manager security configuration import parameters. + + :param network_security_group_imports: List of nsg uris. + :type network_security_group_imports: + list[~azure.mgmt.network.v2021_02_preview.models.NetworkSecurityGroupImport] + :param import_deny_rules_as_admin_rules: Flag if import deny rules as admin rules. + :type import_deny_rules_as_admin_rules: bool + :param admin_security_configuration_uri: Admin security configuration Uri. + :type admin_security_configuration_uri: str + :param remove_allow_vnet_inbound_rule: Flag if need to remove allow vnet inbound rule. + :type remove_allow_vnet_inbound_rule: bool + :param remove_allow_azure_load_balancer_inbound_rule: Flag if need to remove allow azure load + balancer inbound rule. + :type remove_allow_azure_load_balancer_inbound_rule: bool + :param remove_allow_vnet_outbound_rule: Flag if need to remove allow vnet outbound rule. + :type remove_allow_vnet_outbound_rule: bool + :param remove_allow_internet_outbound_rule: Flag if need to remove allow Internet outbound + rule. + :type remove_allow_internet_outbound_rule: bool + """ + + _attribute_map = { + 'network_security_group_imports': {'key': 'networkSecurityGroupImports', 'type': '[NetworkSecurityGroupImport]'}, + 'import_deny_rules_as_admin_rules': {'key': 'importDenyRulesAsAdminRules', 'type': 'bool'}, + 'admin_security_configuration_uri': {'key': 'adminSecurityConfigurationUri', 'type': 'str'}, + 'remove_allow_vnet_inbound_rule': {'key': 'removeAllowVnetInboundRule', 'type': 'bool'}, + 'remove_allow_azure_load_balancer_inbound_rule': {'key': 'removeAllowAzureLoadBalancerInboundRule', 'type': 'bool'}, + 'remove_allow_vnet_outbound_rule': {'key': 'removeAllowVnetOutboundRule', 'type': 'bool'}, + 'remove_allow_internet_outbound_rule': {'key': 'removeAllowInternetOutboundRule', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerSecurityConfigurationImport, self).__init__(**kwargs) + self.network_security_group_imports = kwargs.get('network_security_group_imports', None) + self.import_deny_rules_as_admin_rules = kwargs.get('import_deny_rules_as_admin_rules', None) + self.admin_security_configuration_uri = kwargs.get('admin_security_configuration_uri', None) + self.remove_allow_vnet_inbound_rule = kwargs.get('remove_allow_vnet_inbound_rule', None) + self.remove_allow_azure_load_balancer_inbound_rule = kwargs.get('remove_allow_azure_load_balancer_inbound_rule', None) + self.remove_allow_vnet_outbound_rule = kwargs.get('remove_allow_vnet_outbound_rule', None) + self.remove_allow_internet_outbound_rule = kwargs.get('remove_allow_internet_outbound_rule', None) + + +class NetworkManagerSecurityGroupItem(msrest.serialization.Model): + """Network manager security group item. + + :param network_group_id: Network manager group Id. + :type network_group_id: str + """ + + _attribute_map = { + 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerSecurityGroupItem, self).__init__(**kwargs) + self.network_group_id = kwargs.get('network_group_id', None) + + +class NetworkSecurityGroupImport(msrest.serialization.Model): + """Network Security Group Import. + + :param network_security_group_uri: Network Security Group Uri. + :type network_security_group_uri: str + """ + + _attribute_map = { + 'network_security_group_uri': {'key': 'networkSecurityGroupUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkSecurityGroupImport, self).__init__(**kwargs) + self.network_security_group_uri = kwargs.get('network_security_group_uri', None) + + +class SecurityConfiguration(ProxyResource): + """Defines the security Configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A display name of the security Configuration. + :type display_name: str + :param description: A description of the security Configuration. + :type description: str + :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". + :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType + :param delete_existing_ns_gs: Flag if need to delete existing network security groups. + :type delete_existing_ns_gs: bool + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'security_type': {'key': 'properties.securityType', 'type': 'str'}, + 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'bool'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.security_type = kwargs.get('security_type', None) + self.delete_existing_ns_gs = kwargs.get('delete_existing_ns_gs', None) + self.applies_to_groups = kwargs.get('applies_to_groups', None) + self.provisioning_state = None + + +class SecurityConfigurationImportResult(msrest.serialization.Model): + """Security configuration import Result. + + :param user_security_configuration: User security configuration Id. + :type user_security_configuration: str + :param admin_security_configuration: Admin security configuration Id. + :type admin_security_configuration: str + :param failed_import: failed imports code and reason. + :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + """ + + _attribute_map = { + 'user_security_configuration': {'key': 'userSecurityConfiguration', 'type': 'str'}, + 'admin_security_configuration': {'key': 'adminSecurityConfiguration', 'type': 'str'}, + 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityConfigurationImportResult, self).__init__(**kwargs) + self.user_security_configuration = kwargs.get('user_security_configuration', None) + self.admin_security_configuration = kwargs.get('admin_security_configuration', None) + self.failed_import = kwargs.get('failed_import', None) + + +class SecurityConfigurationListResult(msrest.serialization.Model): + """A list of managed network security configurations. + + :param value: Gets a page of security configurations. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SecurityConfigurationRule(msrest.serialization.Model): + """General security configuration Rule. + + :param security_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy". + :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType + :param security_admin_rule: Security admin rule. + :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :param security_user_rule: Security user rule. + :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + """ + + _attribute_map = { + 'security_type': {'key': 'securityType', 'type': 'str'}, + 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, + 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityConfigurationRule, self).__init__(**kwargs) + self.security_type = kwargs.get('security_type', None) + self.security_admin_rule = kwargs.get('security_admin_rule', None) + self.security_user_rule = kwargs.get('security_user_rule', None) + + +class SecurityConfigurationRuleListResult(msrest.serialization.Model): + """Security configuration rule list result. + + :param value: A list of network manager security configuration rules. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRule] + :param failed_import: Failed Imports. + :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityConfigurationRule]'}, + 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityConfigurationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.failed_import = kwargs.get('failed_import', None) + self.next_link = kwargs.get('next_link', None) + + +class SubResource(msrest.serialization.Model): + """Reference to another subresource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsObject, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class UserRule(ProxyResource): + """Network security admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. Restricted to 140 chars. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol + :param source: The CIDR or source IP ranges. + :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param destination: The destination address prefixes. CIDR or destination IP ranges. + :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security Configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, + 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserRule, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.protocol = kwargs.get('protocol', None) + self.source = kwargs.get('source', None) + self.destination = kwargs.get('destination', None) + self.source_port_ranges = kwargs.get('source_port_ranges', None) + self.destination_port_ranges = kwargs.get('destination_port_ranges', None) + self.direction = kwargs.get('direction', None) + self.provisioning_state = None + + +class UserRuleListResult(msrest.serialization.Model): + """Security configuration user rule list result. + + :param value: A list of user rules. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.UserRule] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py new file mode 100644 index 00000000000..29b7cac92f1 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py @@ -0,0 +1,1812 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._network_management_client_enums import * + + +class EffectiveConfiguration(msrest.serialization.Model): + """The network manager effective configuration. + + :param config_type: Effective configuration. Possible values include: "AdminPolicy", + "UserPolicy", "Connectivity". + :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType + :param connectivity_configuration: Connectivity configuration object. + :type connectivity_configuration: + ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :param security_admin_rule: Security admin rule object. + :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :param security_user_rule: Security user rule object. + :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param configuration_groups: Effective configuration groups. + :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + """ + + _attribute_map = { + 'config_type': {'key': 'configType', 'type': 'str'}, + 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, + 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, + 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + } + + def __init__( + self, + *, + config_type: Optional[Union[str, "ConfigType"]] = None, + connectivity_configuration: Optional["ConnectivityConfiguration"] = None, + security_admin_rule: Optional["AdminRule"] = None, + security_user_rule: Optional["UserRule"] = None, + configuration_groups: Optional[List["NetworkGroup"]] = None, + **kwargs + ): + super(EffectiveConfiguration, self).__init__(**kwargs) + self.config_type = config_type + self.connectivity_configuration = connectivity_configuration + self.security_admin_rule = security_admin_rule + self.security_user_rule = security_user_rule + self.configuration_groups = configuration_groups + + +class ActiveConfiguration(EffectiveConfiguration): + """Active Configuration. + + :param config_type: Effective configuration. Possible values include: "AdminPolicy", + "UserPolicy", "Connectivity". + :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType + :param connectivity_configuration: Connectivity configuration object. + :type connectivity_configuration: + ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :param security_admin_rule: Security admin rule object. + :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :param security_user_rule: Security user rule object. + :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param configuration_groups: Effective configuration groups. + :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + """ + + _attribute_map = { + 'config_type': {'key': 'configType', 'type': 'str'}, + 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, + 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, + 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + *, + config_type: Optional[Union[str, "ConfigType"]] = None, + connectivity_configuration: Optional["ConnectivityConfiguration"] = None, + security_admin_rule: Optional["AdminRule"] = None, + security_user_rule: Optional["UserRule"] = None, + configuration_groups: Optional[List["NetworkGroup"]] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + **kwargs + ): + super(ActiveConfiguration, self).__init__(config_type=config_type, connectivity_configuration=connectivity_configuration, security_admin_rule=security_admin_rule, security_user_rule=security_user_rule, configuration_groups=configuration_groups, **kwargs) + self.commit_time = commit_time + self.region = region + + +class ActiveConfigurationListResult(msrest.serialization.Model): + """Result of the request to list active configurations. It contains a list of active configurations and a URL link to get the next set of results. + + :param value: Gets a page of active configurations. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.ActiveConfiguration] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActiveConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ActiveConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ActiveConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AddressPrefixItem(msrest.serialization.Model): + """Address prefix item. + + :param address_prefix: Address prefix. + :type address_prefix: str + :param address_prefix_type: Address prefix type. Possible values include: "IPPrefix", + "ServiceTag". + :type address_prefix_type: str or ~azure.mgmt.network.v2021_02_preview.models.AddressPrefixType + """ + + _attribute_map = { + 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, + 'address_prefix_type': {'key': 'addressPrefixType', 'type': 'str'}, + } + + def __init__( + self, + *, + address_prefix: Optional[str] = None, + address_prefix_type: Optional[Union[str, "AddressPrefixType"]] = None, + **kwargs + ): + super(AddressPrefixItem, self).__init__(**kwargs) + self.address_prefix = address_prefix + self.address_prefix_type = address_prefix_type + + +class ProxyResource(msrest.serialization.Model): + """Proxy resource representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class AdminRule(ProxyResource): + """Network admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol + :param source: The CIDR or source IP ranges. + :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param destination: The destination address prefixes. CIDR or destination IP ranges. + :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :type access: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleAccess + :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :type priority: int + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security Configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, + 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, + source: Optional[List["AddressPrefixItem"]] = None, + destination: Optional[List["AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "SecurityConfigurationRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, + applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + **kwargs + ): + super(AdminRule, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.protocol = protocol + self.source = source + self.destination = destination + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None + self.applies_to_groups = applies_to_groups + + +class AdminRuleListResult(msrest.serialization.Model): + """Security configuration admin rule list result. + + :param value: A list of admin rules. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.AdminRule] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AdminRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AdminRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AdminRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AzureAsyncOperationResult(msrest.serialization.Model): + """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. + + :param status: Status of the Azure async operation. Possible values include: "InProgress", + "Succeeded", "Failed". + :type status: str or ~azure.mgmt.network.v2021_02_preview.models.NetworkOperationStatus + :param error: Details of the error occurred during specified asynchronous operation. + :type error: ~azure.mgmt.network.v2021_02_preview.models.Error + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "NetworkOperationStatus"]] = None, + error: Optional["Error"] = None, + **kwargs + ): + super(AzureAsyncOperationResult, self).__init__(**kwargs) + self.status = status + self.error = error + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user + interface. + :type message: str + :param target: The target of the particular error. For example, the name of the property in + error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.network.v2021_02_preview.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ConnectivityConfiguration(ProxyResource): + """The network manager connectivity configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the resource. + :type display_name: str + :param description: A description of the connectivity configuration. + :type description: str + :param connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpokeTopology", "MeshTopology". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_preview.models.ConnectivityTopology + :param hub_id: The hub vnet Id. + :type hub_id: str + :param is_global: Flag if global mesh is supported. + :type is_global: bool + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. + :type delete_existing_peering: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, + 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'bool'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'bool'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, + hub_id: Optional[str] = None, + is_global: Optional[bool] = None, + applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, + delete_existing_peering: Optional[bool] = None, + **kwargs + ): + super(ConnectivityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.connectivity_topology = connectivity_topology + self.hub_id = hub_id + self.is_global = is_global + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + self.delete_existing_peering = delete_existing_peering + + +class ConnectivityConfigurationListResult(msrest.serialization.Model): + """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. + + :param value: Gets a page of Connectivity Configurations. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectivityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConnectivityConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ConnectivityConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConnectivityGroupItem(msrest.serialization.Model): + """ConnectivityGroupItem. + + :param network_group_id: Network group Id. + :type network_group_id: str + :param use_hub_gateway: Flag if need to use hub gateway. + :type use_hub_gateway: bool + :param is_global: Flag if global is supported. + :type is_global: bool + :param group_connectivity: Group connectivity type. Possible values include: "None", + "DirectlyConnected". + :type group_connectivity: str or ~azure.mgmt.network.v2021_02_preview.models.GroupConnectivity + """ + + _attribute_map = { + 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, + 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'bool'}, + 'is_global': {'key': 'isGlobal', 'type': 'bool'}, + 'group_connectivity': {'key': 'groupConnectivity', 'type': 'str'}, + } + + def __init__( + self, + *, + network_group_id: Optional[str] = None, + use_hub_gateway: Optional[bool] = None, + is_global: Optional[bool] = None, + group_connectivity: Optional[Union[str, "GroupConnectivity"]] = None, + **kwargs + ): + super(ConnectivityGroupItem, self).__init__(**kwargs) + self.network_group_id = network_group_id + self.use_hub_gateway = use_hub_gateway + self.is_global = is_global + self.group_connectivity = group_connectivity + + +class EffectiveVirtualNetwork(msrest.serialization.Model): + """Effective Virtual Network. + + :param id: Effective vnet Id. + :type id: str + :param location: Location of vnet. + :type location: str + :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". + :type membership_type: str or ~azure.mgmt.network.v2021_02_preview.models.MembershipType + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'membership_type': {'key': 'membershipType', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + location: Optional[str] = None, + membership_type: Optional[Union[str, "MembershipType"]] = None, + **kwargs + ): + super(EffectiveVirtualNetwork, self).__init__(**kwargs) + self.id = id + self.location = location + self.membership_type = membership_type + + +class EffectiveVirtualNetworksListResult(msrest.serialization.Model): + """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. + + :param value: Gets a page of EffectiveVirtualNetwork. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetwork] + :param total_records: Total Records. + :type total_records: int + :param first_index: First Index. + :type first_index: int + :param page_size: Page Size. + :type page_size: int + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, + 'total_records': {'key': 'totalRecords', 'type': 'int'}, + 'first_index': {'key': 'firstIndex', 'type': 'int'}, + 'page_size': {'key': 'pageSize', 'type': 'int'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EffectiveVirtualNetwork"]] = None, + total_records: Optional[int] = None, + first_index: Optional[int] = None, + page_size: Optional[int] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) + self.value = value + self.total_records = total_records + self.first_index = first_index + self.page_size = page_size + self.next_link = next_link + + +class EffectiveVirtualNetworksParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. + + :param conditional_members: Conditional Members. + :type conditional_members: str + """ + + _attribute_map = { + 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, + } + + def __init__( + self, + *, + conditional_members: Optional[str] = None, + **kwargs + ): + super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) + self.conditional_members = conditional_members + + +class Error(msrest.serialization.Model): + """Common error representation. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + :param target: Error target. + :type target: str + :param details: Error details. + :type details: list[~azure.mgmt.network.v2021_02_preview.models.ErrorDetails] + :param inner_error: Inner error message. + :type inner_error: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'inner_error': {'key': 'innerError', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["ErrorDetails"]] = None, + inner_error: Optional[str] = None, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.inner_error = inner_error + + +class ErrorDetails(msrest.serialization.Model): + """Common error details representation. + + :param code: Error code. + :type code: str + :param target: Error target. + :type target: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class ExtendedLocation(msrest.serialization.Model): + """ExtendedLocation complex type. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the extended location. + :type name: str + :param type: Required. The type of the extended location. Possible values include: "EdgeZone". + :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ExtendedLocationTypes + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "ExtendedLocationTypes"], + **kwargs + ): + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +class FailedImport(msrest.serialization.Model): + """Failed imports object. + + :param failure_code: Failure code. + :type failure_code: str + :param failure_reason: Failure reason. + :type failure_reason: str + """ + + _attribute_map = { + 'failure_code': {'key': 'failureCode', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + } + + def __init__( + self, + *, + failure_code: Optional[str] = None, + failure_reason: Optional[str] = None, + **kwargs + ): + super(FailedImport, self).__init__(**kwargs) + self.failure_code = failure_code + self.failure_reason = failure_reason + + +class GroupMembersItem(msrest.serialization.Model): + """GroupMembers Item. + + :param resource_id: Resource Id. + :type resource_id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + **kwargs + ): + super(GroupMembersItem, self).__init__(**kwargs) + self.resource_id = resource_id + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity. This property will only + be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the virtual machine. Possible + values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with resource. The user + identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.network.v2021_02_preview.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class NetworkGroup(ProxyResource): + """The network group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the network group. + :type display_name: str + :param description: A description of the network group. + :type description: str + :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". + :type member_type: str or ~azure.mgmt.network.v2021_02_preview.models.MemberType + :param group_members: Group members of network group. + :type group_members: list[~azure.mgmt.network.v2021_02_preview.models.GroupMembersItem] + :param conditional_membership: Network group conditional filter. + :type conditional_membership: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'member_type': {'key': 'properties.memberType', 'type': 'str'}, + 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, + 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + member_type: Optional[Union[str, "MemberType"]] = None, + group_members: Optional[List["GroupMembersItem"]] = None, + conditional_membership: Optional[str] = None, + **kwargs + ): + super(NetworkGroup, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.member_type = member_type + self.group_members = group_members + self.conditional_membership = conditional_membership + self.provisioning_state = None + + +class NetworkGroupListResult(msrest.serialization.Model): + """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. + + :param value: Gets a page of NetworkGroup. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkGroup"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Resource(msrest.serialization.Model): + """Common resource representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = id + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class NetworkManager(Resource): + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the network manager. + :type display_name: str + :param description: A description of the network manager. + :type description: str + :param network_manager_scopes: Scope of Network Manager. + :type network_manager_scopes: + ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerPropertiesNetworkManagerScopes + :param network_manager_scope_accesses: Scope Access. + :type network_manager_scope_accesses: list[str or + ~azure.mgmt.network.v2021_02_preview.models.ScopeAccesses] + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'network_manager_scopes': {'key': 'properties.networkManagerScopes', 'type': 'NetworkManagerPropertiesNetworkManagerScopes'}, + 'network_manager_scope_accesses': {'key': 'properties.networkManagerScopeAccesses', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + network_manager_scopes: Optional["NetworkManagerPropertiesNetworkManagerScopes"] = None, + network_manager_scope_accesses: Optional[List[Union[str, "ScopeAccesses"]]] = None, + **kwargs + ): + super(NetworkManager, self).__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.system_data = None + self.display_name = display_name + self.description = description + self.network_manager_scopes = network_manager_scopes + self.network_manager_scope_accesses = network_manager_scope_accesses + self.provisioning_state = None + + +class NetworkManagerCommit(msrest.serialization.Model): + """Network Manager Commit. + + :param target_locations: List of target locations. + :type target_locations: list[str] + :param configuration_ids: List of configuration ids. + :type configuration_ids: list[str] + :param commit_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy", + "Routing", "Connectivity". + :type commit_type: str or ~azure.mgmt.network.v2021_02_preview.models.CommitType + """ + + _attribute_map = { + 'target_locations': {'key': 'targetLocations', 'type': '[str]'}, + 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, + 'commit_type': {'key': 'commitType', 'type': 'str'}, + } + + def __init__( + self, + *, + target_locations: Optional[List[str]] = None, + configuration_ids: Optional[List[str]] = None, + commit_type: Optional[Union[str, "CommitType"]] = None, + **kwargs + ): + super(NetworkManagerCommit, self).__init__(**kwargs) + self.target_locations = target_locations + self.configuration_ids = configuration_ids + self.commit_type = commit_type + + +class NetworkManagerDeploymentStatus(msrest.serialization.Model): + """Network Manager Deployment Status. + + :param commit_time: Commit Time. + :type commit_time: ~datetime.datetime + :param region: Region Name. + :type region: str + :param deployment_status: Deployment Status. Possible values include: "NotStarted", + "Deploying", "Deployed", "Failed". + :type deployment_status: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentStatus + :param configuration_ids: List of configuration ids. + :type configuration_ids: list[str] + :param deployment_type: Configuration Deployment Type. Possible values include: "AdminPolicy", + "UserPolicy", "Routing", "Connectivity". + :type deployment_type: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType + :param error_message: Error Message. + :type error_message: str + """ + + _attribute_map = { + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + deployment_status: Optional[Union[str, "DeploymentStatus"]] = None, + configuration_ids: Optional[List[str]] = None, + deployment_type: Optional[Union[str, "DeploymentType"]] = None, + error_message: Optional[str] = None, + **kwargs + ): + super(NetworkManagerDeploymentStatus, self).__init__(**kwargs) + self.commit_time = commit_time + self.region = region + self.deployment_status = deployment_status + self.configuration_ids = configuration_ids + self.deployment_type = deployment_type + self.error_message = error_message + + +class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): + """A list of Network Manager Deployment Status. + + :param value: Gets a page of Network Manager Deployment Status. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatus] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkManagerDeploymentStatus"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): + """Network Manager Deployment Status Parameter. + + :param regions: List of locations. + :type regions: list[str] + :param deployment_types: List of configurations' deployment types. + :type deployment_types: list[str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType] + """ + + _attribute_map = { + 'regions': {'key': 'regions', 'type': '[str]'}, + 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, + } + + def __init__( + self, + *, + regions: Optional[List[str]] = None, + deployment_types: Optional[List[Union[str, "DeploymentType"]]] = None, + **kwargs + ): + super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) + self.regions = regions + self.deployment_types = deployment_types + + +class NetworkManagerEffectiveConfigurationListResult(msrest.serialization.Model): + """Result of the request to list networkManagerEffectiveConfiguration. It contains a list of groups and a URL link to get the next set of results. + + :param value: Gets a page of NetworkManagerEffectiveConfiguration. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveConfiguration] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EffectiveConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EffectiveConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkManagerEffectiveConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkManagerListResult(msrest.serialization.Model): + """Result of the request to list NetworkManager. It contains a list of network managers and a URL link to get the next set of results. + + :param value: Gets a page of NetworkManager. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManager] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkManager]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkManager"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkManagerListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkManagerPropertiesNetworkManagerScopes(msrest.serialization.Model): + """Scope of Network Manager. + + :param management_groups: List of management groups. + :type management_groups: list[str] + :param subscriptions: List of subscriptions. + :type subscriptions: list[str] + """ + + _attribute_map = { + 'management_groups': {'key': 'managementGroups', 'type': '[str]'}, + 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + } + + def __init__( + self, + *, + management_groups: Optional[List[str]] = None, + subscriptions: Optional[List[str]] = None, + **kwargs + ): + super(NetworkManagerPropertiesNetworkManagerScopes, self).__init__(**kwargs) + self.management_groups = management_groups + self.subscriptions = subscriptions + + +class NetworkManagerSecurityConfigurationImport(msrest.serialization.Model): + """Network manager security configuration import parameters. + + :param network_security_group_imports: List of nsg uris. + :type network_security_group_imports: + list[~azure.mgmt.network.v2021_02_preview.models.NetworkSecurityGroupImport] + :param import_deny_rules_as_admin_rules: Flag if import deny rules as admin rules. + :type import_deny_rules_as_admin_rules: bool + :param admin_security_configuration_uri: Admin security configuration Uri. + :type admin_security_configuration_uri: str + :param remove_allow_vnet_inbound_rule: Flag if need to remove allow vnet inbound rule. + :type remove_allow_vnet_inbound_rule: bool + :param remove_allow_azure_load_balancer_inbound_rule: Flag if need to remove allow azure load + balancer inbound rule. + :type remove_allow_azure_load_balancer_inbound_rule: bool + :param remove_allow_vnet_outbound_rule: Flag if need to remove allow vnet outbound rule. + :type remove_allow_vnet_outbound_rule: bool + :param remove_allow_internet_outbound_rule: Flag if need to remove allow Internet outbound + rule. + :type remove_allow_internet_outbound_rule: bool + """ + + _attribute_map = { + 'network_security_group_imports': {'key': 'networkSecurityGroupImports', 'type': '[NetworkSecurityGroupImport]'}, + 'import_deny_rules_as_admin_rules': {'key': 'importDenyRulesAsAdminRules', 'type': 'bool'}, + 'admin_security_configuration_uri': {'key': 'adminSecurityConfigurationUri', 'type': 'str'}, + 'remove_allow_vnet_inbound_rule': {'key': 'removeAllowVnetInboundRule', 'type': 'bool'}, + 'remove_allow_azure_load_balancer_inbound_rule': {'key': 'removeAllowAzureLoadBalancerInboundRule', 'type': 'bool'}, + 'remove_allow_vnet_outbound_rule': {'key': 'removeAllowVnetOutboundRule', 'type': 'bool'}, + 'remove_allow_internet_outbound_rule': {'key': 'removeAllowInternetOutboundRule', 'type': 'bool'}, + } + + def __init__( + self, + *, + network_security_group_imports: Optional[List["NetworkSecurityGroupImport"]] = None, + import_deny_rules_as_admin_rules: Optional[bool] = None, + admin_security_configuration_uri: Optional[str] = None, + remove_allow_vnet_inbound_rule: Optional[bool] = None, + remove_allow_azure_load_balancer_inbound_rule: Optional[bool] = None, + remove_allow_vnet_outbound_rule: Optional[bool] = None, + remove_allow_internet_outbound_rule: Optional[bool] = None, + **kwargs + ): + super(NetworkManagerSecurityConfigurationImport, self).__init__(**kwargs) + self.network_security_group_imports = network_security_group_imports + self.import_deny_rules_as_admin_rules = import_deny_rules_as_admin_rules + self.admin_security_configuration_uri = admin_security_configuration_uri + self.remove_allow_vnet_inbound_rule = remove_allow_vnet_inbound_rule + self.remove_allow_azure_load_balancer_inbound_rule = remove_allow_azure_load_balancer_inbound_rule + self.remove_allow_vnet_outbound_rule = remove_allow_vnet_outbound_rule + self.remove_allow_internet_outbound_rule = remove_allow_internet_outbound_rule + + +class NetworkManagerSecurityGroupItem(msrest.serialization.Model): + """Network manager security group item. + + :param network_group_id: Network manager group Id. + :type network_group_id: str + """ + + _attribute_map = { + 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, + } + + def __init__( + self, + *, + network_group_id: Optional[str] = None, + **kwargs + ): + super(NetworkManagerSecurityGroupItem, self).__init__(**kwargs) + self.network_group_id = network_group_id + + +class NetworkSecurityGroupImport(msrest.serialization.Model): + """Network Security Group Import. + + :param network_security_group_uri: Network Security Group Uri. + :type network_security_group_uri: str + """ + + _attribute_map = { + 'network_security_group_uri': {'key': 'networkSecurityGroupUri', 'type': 'str'}, + } + + def __init__( + self, + *, + network_security_group_uri: Optional[str] = None, + **kwargs + ): + super(NetworkSecurityGroupImport, self).__init__(**kwargs) + self.network_security_group_uri = network_security_group_uri + + +class SecurityConfiguration(ProxyResource): + """Defines the security Configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A display name of the security Configuration. + :type display_name: str + :param description: A description of the security Configuration. + :type description: str + :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". + :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType + :param delete_existing_ns_gs: Flag if need to delete existing network security groups. + :type delete_existing_ns_gs: bool + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'security_type': {'key': 'properties.securityType', 'type': 'str'}, + 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'bool'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + security_type: Optional[Union[str, "SecurityType"]] = None, + delete_existing_ns_gs: Optional[bool] = None, + applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + **kwargs + ): + super(SecurityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.security_type = security_type + self.delete_existing_ns_gs = delete_existing_ns_gs + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + + +class SecurityConfigurationImportResult(msrest.serialization.Model): + """Security configuration import Result. + + :param user_security_configuration: User security configuration Id. + :type user_security_configuration: str + :param admin_security_configuration: Admin security configuration Id. + :type admin_security_configuration: str + :param failed_import: failed imports code and reason. + :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + """ + + _attribute_map = { + 'user_security_configuration': {'key': 'userSecurityConfiguration', 'type': 'str'}, + 'admin_security_configuration': {'key': 'adminSecurityConfiguration', 'type': 'str'}, + 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + } + + def __init__( + self, + *, + user_security_configuration: Optional[str] = None, + admin_security_configuration: Optional[str] = None, + failed_import: Optional["FailedImport"] = None, + **kwargs + ): + super(SecurityConfigurationImportResult, self).__init__(**kwargs) + self.user_security_configuration = user_security_configuration + self.admin_security_configuration = admin_security_configuration + self.failed_import = failed_import + + +class SecurityConfigurationListResult(msrest.serialization.Model): + """A list of managed network security configurations. + + :param value: Gets a page of security configurations. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SecurityConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SecurityConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecurityConfigurationRule(msrest.serialization.Model): + """General security configuration Rule. + + :param security_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy". + :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType + :param security_admin_rule: Security admin rule. + :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :param security_user_rule: Security user rule. + :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + """ + + _attribute_map = { + 'security_type': {'key': 'securityType', 'type': 'str'}, + 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, + 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + } + + def __init__( + self, + *, + security_type: Optional[Union[str, "SecurityType"]] = None, + security_admin_rule: Optional["AdminRule"] = None, + security_user_rule: Optional["UserRule"] = None, + **kwargs + ): + super(SecurityConfigurationRule, self).__init__(**kwargs) + self.security_type = security_type + self.security_admin_rule = security_admin_rule + self.security_user_rule = security_user_rule + + +class SecurityConfigurationRuleListResult(msrest.serialization.Model): + """Security configuration rule list result. + + :param value: A list of network manager security configuration rules. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRule] + :param failed_import: Failed Imports. + :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityConfigurationRule]'}, + 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SecurityConfigurationRule"]] = None, + failed_import: Optional["FailedImport"] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SecurityConfigurationRuleListResult, self).__init__(**kwargs) + self.value = value + self.failed_import = failed_import + self.next_link = next_link + + +class SubResource(msrest.serialization.Model): + """Reference to another subresource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsObject, self).__init__(**kwargs) + self.tags = tags + + +class UserRule(ProxyResource): + """Network security admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. Restricted to 140 chars. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol + :param source: The CIDR or source IP ranges. + :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param destination: The destination address prefixes. CIDR or destination IP ranges. + :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security Configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, + 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, + source: Optional[List["AddressPrefixItem"]] = None, + destination: Optional[List["AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, + **kwargs + ): + super(UserRule, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.protocol = protocol + self.source = source + self.destination = destination + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.direction = direction + self.provisioning_state = None + + +class UserRuleListResult(msrest.serialization.Model): + """Security configuration user rule list result. + + :param value: A list of user rules. + :type value: list[~azure.mgmt.network.v2021_02_preview.models.UserRule] + :param next_link: Gets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(UserRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py new file mode 100644 index 00000000000..04097bd3132 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py @@ -0,0 +1,209 @@ +# 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. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class Access(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Access to be allowed or denied. + """ + + ALLOW = "Allow" + DENY = "Deny" + +class AddressPrefixType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Address prefix type. + """ + + IP_PREFIX = "IPPrefix" + SERVICE_TAG = "ServiceTag" + +class AuthenticationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """VPN client authentication method. + """ + + EAPTLS = "EAPTLS" + EAPMSCHA_PV2 = "EAPMSCHAPv2" + +class CommitType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Commit Type. + """ + + ADMIN_POLICY = "AdminPolicy" + USER_POLICY = "UserPolicy" + ROUTING = "Routing" + CONNECTIVITY = "Connectivity" + +class ConfigType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Effective configuration. + """ + + ADMIN_POLICY = "AdminPolicy" + USER_POLICY = "UserPolicy" + CONNECTIVITY = "Connectivity" + +class ConnectivityTopology(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Connectivity topology type. + """ + + HUB_AND_SPOKE_TOPOLOGY = "HubAndSpokeTopology" + MESH_TOPOLOGY = "MeshTopology" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Deployment Status. + """ + + NOT_STARTED = "NotStarted" + DEPLOYING = "Deploying" + DEPLOYED = "Deployed" + FAILED = "Failed" + +class DeploymentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Configuration Deployment Type. + """ + + ADMIN_POLICY = "AdminPolicy" + USER_POLICY = "UserPolicy" + ROUTING = "Routing" + CONNECTIVITY = "Connectivity" + +class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network + resources. + """ + + EDGE_ZONE = "EdgeZone" + +class GroupConnectivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Group connectivity type. + """ + + NONE = "None" + DIRECTLY_CONNECTED = "DirectlyConnected" + +class IPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP address allocation method. + """ + + STATIC = "Static" + DYNAMIC = "Dynamic" + +class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP address version. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + +class MembershipType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Membership Type. + """ + + STATIC = "Static" + DYNAMIC = "Dynamic" + +class MemberType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Group member type. + """ + + VIRTUAL_NETWORK = "VirtualNetwork" + SUBNET = "Subnet" + +class NetworkOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Azure async operation. + """ + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the virtual machine. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class ScopeAccesses(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + SECURITY = "Security" + ROUTING = "Routing" + CONNECTIVITY = "Connectivity" + +class SecurityConfigurationRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether network traffic is allowed or denied. + """ + + ALLOW = "Allow" + DENY = "Deny" + ALWAYS_ALLOW = "AlwaysAllow" + +class SecurityConfigurationRuleDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The direction of the rule. The direction specifies if the rule will be evaluated on incoming or + outgoing traffic. + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class SecurityConfigurationRuleProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Network protocol this rule applies to. + """ + + TCP = "Tcp" + UDP = "Udp" + ICMP = "Icmp" + ESP = "Esp" + ANY = "Any" + AH = "Ah" + +class SecurityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Security Type. + """ + + ADMIN_POLICY = "AdminPolicy" + USER_POLICY = "UserPolicy" diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py new file mode 100644 index 00000000000..ad5afd67132 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py @@ -0,0 +1,33 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._network_managers_operations import NetworkManagersOperations +from ._network_manager_commits_operations import NetworkManagerCommitsOperations +from ._network_manager_deployment_status_operations import NetworkManagerDeploymentStatusOperations +from ._effective_virtual_networks_operations import EffectiveVirtualNetworksOperations +from ._active_configurations_operations import ActiveConfigurationsOperations +from ._connectivity_configurations_operations import ConnectivityConfigurationsOperations +from ._effective_configurations_operations import EffectiveConfigurationsOperations +from ._network_groups_operations import NetworkGroupsOperations +from ._security_configurations_operations import SecurityConfigurationsOperations +from ._admin_rules_operations import AdminRulesOperations +from ._user_rules_operations import UserRulesOperations + +__all__ = [ + 'NetworkManagersOperations', + 'NetworkManagerCommitsOperations', + 'NetworkManagerDeploymentStatusOperations', + 'EffectiveVirtualNetworksOperations', + 'ActiveConfigurationsOperations', + 'ConnectivityConfigurationsOperations', + 'EffectiveConfigurationsOperations', + 'NetworkGroupsOperations', + 'SecurityConfigurationsOperations', + 'AdminRulesOperations', + 'UserRulesOperations', +] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py new file mode 100644 index 00000000000..46cdf86c0b9 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py @@ -0,0 +1,139 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActiveConfigurationsOperations(object): + """ActiveConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + region=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ActiveConfigurationListResult"] + """Lists active configurations in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :param region: Location name. + :type region: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActiveConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.ActiveConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if region is not None: + query_parameters['region'] = self._serialize.query("region", region, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ActiveConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/activeConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py new file mode 100644 index 00000000000..f8dd3a34a1b --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py @@ -0,0 +1,348 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AdminRulesOperations(object): + """AdminRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AdminRuleListResult"] + """Retrieves a network manager security configuration admin rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AdminRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.AdminRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AdminRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AdminRule" + """Gets a network manager security configuration admin rule in a subscription. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AdminRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_name, # type: str + admin_rule, # type: "_models.AdminRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.AdminRule" + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param admin_rule: The admin rule to create or update. + :type admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(admin_rule, 'AdminRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AdminRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AdminRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an admin rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py new file mode 100644 index 00000000000..259820953c1 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py @@ -0,0 +1,335 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ConnectivityConfigurationsOperations(object): + """ConnectivityConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConnectivityConfiguration" + """Gets a Network Connectivity Configuration, specified by the resource group, network manager + name, and connectivity Configuration name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectivityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + connectivity_configuration, # type: "_models.ConnectivityConfiguration" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConnectivityConfiguration" + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. + :type connectivity_configuration: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connectivity_configuration, 'ConnectivityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConnectivityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectivityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network manager connectivity configuration, specified by the resource group, network + manager name, and connectivity configuration name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConnectivityConfigurationListResult"] + """Lists all the network manager connectivity configuration in a specified network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectivityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConnectivityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py new file mode 100644 index 00000000000..41a7e375552 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py @@ -0,0 +1,134 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EffectiveConfigurationsOperations(object): + """EffectiveConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + virtual_network_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkManagerEffectiveConfigurationListResult"] + """List all configurations in a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerEffectiveConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerEffectiveConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerEffectiveConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/networkManagerEffectiveConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py new file mode 100644 index 00000000000..23455cde92f --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py @@ -0,0 +1,243 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EffectiveVirtualNetworksOperations(object): + """EffectiveVirtualNetworksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_network_manager( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + parameters=None, # type: Optional["_models.EffectiveVirtualNetworksParameter"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EffectiveVirtualNetworksListResult"] + """List effective virtual networks in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :param parameters: Effective Virtual Networks Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_network_manager.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore + + def list_by_network_group( + self, + resource_group_name, # type: str + network_manager_name, # type: str + network_group_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EffectiveVirtualNetworksListResult"] + """Lists all effective virtual networks by specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_network_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py new file mode 100644 index 00000000000..05714e4b2e6 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py @@ -0,0 +1,342 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkGroupsOperations(object): + """NetworkGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + network_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkGroup" + """Gets the specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkGroup, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + network_group_name, # type: str + parameters, # type: "_models.NetworkGroup" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkGroup" + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :param if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkGroup, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) + + if response.status_code == 201: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + network_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group to get. + :type network_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkGroupListResult"] + """Lists the specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py new file mode 100644 index 00000000000..6e3219b74bb --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py @@ -0,0 +1,109 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagerCommitsOperations(object): + """NetworkManagerCommitsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def post( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.NetworkManagerCommit" + **kwargs # type: Any + ): + # type: (...) -> None + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerCommit + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerCommit') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py new file mode 100644 index 00000000000..094b4e7243b --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py @@ -0,0 +1,145 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagerDeploymentStatusOperations(object): + """NetworkManagerDeploymentStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.NetworkManagerDeploymentStatusParameter" + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkManagerDeploymentStatusListResult"] + """Post List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusParameter + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerDeploymentStatusListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerDeploymentStatusListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py new file mode 100644 index 00000000000..d57668b4630 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py @@ -0,0 +1,463 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagersOperations(object): + """NetworkManagersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkManager" + """Gets the specified Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.NetworkManager" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkManager" + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManager') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + def patch_tags( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkManager" + """Patch a NetworkManager Tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Parameters supplied to update network manager tags. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.patch_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManager', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + def list_by_subscription( + self, + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkManagerListResult"] + """List all network managers in a subscription. + + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers'} # type: ignore + + def list( + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkManagerListResult"] + """List network managers in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py new file mode 100644 index 00000000000..e6c9b3fc5f0 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py @@ -0,0 +1,507 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SecurityConfigurationsOperations(object): + """SecurityConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SecurityConfigurationListResult"] + """Lists all the network manager security configurations in a network manager, in a paginated + format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations'} # type: ignore + + def import_method( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + parameters, # type: "_models.NetworkManagerSecurityConfigurationImport" + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfigurationImportResult" + """Imports network security rules to network manager security rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param parameters: Import Security configuration parameter. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfigurationImportResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationImportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationImportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_method.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfigurationImportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/import'} # type: ignore + + def evaluate_import( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + parameters, # type: "_models.NetworkManagerSecurityConfigurationImport" + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SecurityConfigurationRuleListResult"] + """The operation to evaluate import NSG to security configurations. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param parameters: Import security configuration parameter. + :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.evaluate_import.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + evaluate_import.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/evaluateImport'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfiguration" + """Retrieves a network manager security Configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + security_configuration, # type: "_models.SecurityConfiguration" + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfiguration" + """Creates or updates a network manager security Configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param security_configuration: The security configuration to create or update. + :type security_configuration: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(security_configuration, 'SecurityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network manager security Configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py new file mode 100644 index 00000000000..4e0b2665654 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py @@ -0,0 +1,348 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class UserRulesOperations(object): + """UserRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.UserRuleListResult"] + """Lists all user rules in a security configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.UserRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UserRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.UserRule" + """Gets a user rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_name, # type: str + user_rule, # type: "_models.UserRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.UserRule" + """Creates or updates a user rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param user_rule: The user rule to create or update. + :type user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_rule, 'UserRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('UserRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('UserRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a user rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/py.typed b/src/network-manager/azext_network_manager/vendored_sdks/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/network-manager/setup.cfg b/src/network-manager/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/network-manager/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/network-manager/setup.py b/src/network-manager/setup.py new file mode 100644 index 00000000000..7c09b0c8cdc --- /dev/null +++ b/src/network-manager/setup.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='network', + version=VERSION, + description='Microsoft Azure Command-Line Tools NetworkManagementClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/network-manager', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_network_manager': ['azext_metadata.json']}, +) From 6e1b8c83dfc525edfd0a74358ddcac2b926cbe90 Mon Sep 17 00:00:00 2001 From: kai ru <69238381+kairu-ms@users.noreply.github.com> Date: Wed, 21 Jul 2021 14:34:00 +0800 Subject: [PATCH 02/28] add tests --- .../azext_network_manager/commands.py | 1 - .../tests/latest/test_network_scenario.py | 20 ++----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 40cee1b970e..f5a0cddeb57 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -72,7 +72,6 @@ def load_command_table(self, _): client_factory=cf_userrule ) - with self.command_group('network manager', network_networkmanager, client_factory=cf_networkmanager) as g: g.custom_command('create', 'network_manager_create') g.custom_command('list', 'network_manager_list') diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 7db12659041..870b0a5a713 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -23,23 +23,7 @@ class NetworkScenarioTest(ScenarioTest): def __init__(self, *args, **kwargs): super(NetworkScenarioTest, self).__init__(*args, **kwargs) - self.kwargs.update({ - 'subscription_id': self.get_subscription_id() - }) - self.kwargs.update({ - 'myNetworkManager': 'testNetworkManager', - 'myNetworkManager2': 'TestNetworkManager', - 'myNetworkGroup2': 'testGroup', - 'myNetworkGroup': 'TestNetworkGroup', - 'mySecurityConfiguration': 'SampleSecurityConfig', - 'mySecurityConfiguration2': 'adminConfig', - }) - - @ResourceGroupPreparer(name_prefix='clitestnetwork_resoureGroupSample'[:7], key='rg_2', parameter_name='rg_2') - @ResourceGroupPreparer(name_prefix='clitestnetwork_rg1'[:7], key='rg', parameter_name='rg') - @ResourceGroupPreparer(name_prefix='clitestnetwork_myResourceGroup'[:7], key='rg_3', parameter_name='rg_3') - @VirtualNetworkPreparer(name_prefix='clitestnetwork_vnet1'[:7], key='vn_2', resource_group_key='rg_2') - @VirtualNetworkPreparer(name_prefix='clitestnetwork_testVirtualNetwork'[:7], key='vn', resource_group_key='rg_2') - def test_network_Scenario(self, rg_2, rg, rg_3): + @ResourceGroupPreparer(name_prefix='test_network_manager', location='jioindiawest') + def test_network_manager(self, resource_group): pass From 931c291e5c6d85f74a34532a651751f655f1eb4b Mon Sep 17 00:00:00 2001 From: kai ru <69238381+kairu-ms@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:52:22 +0800 Subject: [PATCH 03/28] update location definition --- src/network-manager/azext_network_manager/_params.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index dbfbfb9cb57..6e2544275dc 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -54,8 +54,8 @@ def load_arguments(self, _): c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, help='The name of the network manager.') c.argument('id_', options_list=['--id'], type=str, help='Resource ID.') - # c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - # validator=get_default_location_from_resource_group) + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) c.argument('tags', tags_type) c.argument('display_name', type=str, help='A friendly name for the network manager.') c.argument('description', type=str, help='A description of the network manager.') @@ -67,8 +67,7 @@ def load_arguments(self, _): c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, help='The name of the network manager.', id_part='name') c.argument('id_', options_list=['--id'], type=str, help='Resource ID.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) + c.argument('location', arg_type=get_location_type(self.cli_ctx)) c.argument('tags', tags_type) c.argument('display_name', type=str, help='A friendly name for the network manager.') c.argument('description', type=str, help='A description of the network manager.') From ce2f081710c7d36a8ee0ed23415b920b68efa7b0 Mon Sep 17 00:00:00 2001 From: kai ru <69238381+kairu-ms@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:53:22 +0800 Subject: [PATCH 04/28] update location definition --- src/network-manager/azext_network_manager/_params.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 6e2544275dc..23a10156a05 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -54,8 +54,7 @@ def load_arguments(self, _): c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, help='The name of the network manager.') c.argument('id_', options_list=['--id'], type=str, help='Resource ID.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) + c.argument('location', arg_type=get_location_type(self.cli_ctx)) c.argument('tags', tags_type) c.argument('display_name', type=str, help='A friendly name for the network manager.') c.argument('description', type=str, help='A description of the network manager.') From 3efe5130eebc6564f96b3436269f8afe34235203 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Wed, 25 Aug 2021 10:29:14 +0800 Subject: [PATCH 05/28] add nm basic crud test --- .../recordings/test_network_manager_crud.yaml | 150 ++++++++++++++++++ .../tests/latest/test_network_scenario.py | 28 +++- 2 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml new file mode 100644 index 00000000000..b0dae10b0c4 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml @@ -0,0 +1,150 @@ +interactions: +- request: + body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["Routing", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '283' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.27.1 azsdk-python-mgmt-network/unknown Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"616d2e6b-d8bb-4dae-a2be-583516374282"}}' + headers: + cache-control: + - no-cache + content-length: + - '683' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Aug 2021 09:00:34 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager list + Connection: + - keep-alive + ParameterSetName: + - --resource-group + User-Agent: + - AZURECLI/2.27.1 azsdk-python-mgmt-network/unknown Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"0400da92-0000-4e00-0000-6124b5310000\"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"616d2e6b-d8bb-4dae-a2be-583516374282"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '749' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Aug 2021 09:00:36 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.27.1 azsdk-python-mgmt-network/unknown Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 24 Aug 2021 09:00:41 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 870b0a5a713..7f567d18297 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -10,8 +10,10 @@ # pylint: disable=line-too-long import os + from azure.cli.testsdk import ScenarioTest from azure.cli.testsdk import ResourceGroupPreparer + from .preparers import VirtualNetworkPreparer @@ -25,5 +27,27 @@ def __init__(self, *args, **kwargs): super(NetworkScenarioTest, self).__init__(*args, **kwargs) @ResourceGroupPreparer(name_prefix='test_network_manager', location='jioindiawest') - def test_network_manager(self, resource_group): - pass + def test_network_manager_crud(self, resource_group): + self.kwargs.update({ + 'name': 'TestNetworkManager', + 'description': '"My Test Network Manager"', + 'display_name': 'TestNetworkManager', + 'mg': '/providers/Microsoft.Management/managementGroups/azure-cli-management-groupxk66tmjjbhwp72', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()) + }) + + self.cmd('network manager create --name {name} --description {description} --display-name {display_name} ' + '--network-manager-scope-accesses "Routing" "Connectivity" ' + '--network-manager-scopes ' + # 'management-groups={mg} ' + ' subscriptions={sub} ' + '-l jioindiawest ' + '--resource-group {rg}') + + # Update is not allowed for NM. + # self.cmd('network manager update --resource-group {rg} --name {name} --tags key1=value1') + + self.cmd('network manager list --resource-group {rg}') + + self.cmd('network manager delete --resource-group {rg} --name {name} --yes') + From 677856de9dd1ca0fc065d920dc065fc76e7f65c9 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 30 Aug 2021 16:45:53 +0800 Subject: [PATCH 06/28] regen vendor sdk --- .../vendored_sdks/__init__.py | 8 + .../vendored_sdks/_configuration.py | 3 +- .../vendored_sdks/_metadata.json | 78 +- .../_network_management_client.py | 106 +- .../vendored_sdks/_version.py | 9 + .../vendored_sdks/aio/_configuration.py | 3 +- .../aio/_network_management_client.py | 105 +- .../vendored_sdks/aio/operations/__init__.py | 32 +- .../_active_configurations_operations.py | 134 - ..._connectivity_configurations_operations.py | 107 + ..._active_security_admin_rules_operations.py | 107 + .../_active_security_user_rules_operations.py | 107 + .../_admin_rule_collections_operations.py | 343 +++ .../aio/operations/_admin_rules_operations.py | 72 +- ..._connectivity_configurations_operations.py | 18 +- .../_effective_configurations_operations.py | 129 - ..._connectivity_configurations_operations.py | 107 + .../_effective_virtual_networks_operations.py | 236 +- .../operations/_network_groups_operations.py | 18 +- .../_network_manager_commits_operations.py | 21 +- ...rk_manager_deployment_status_operations.py | 123 +- ...fective_security_admin_rules_operations.py | 107 + .../_network_managers_operations.py | 28 +- ...network_security_perimeters_operations.py} | 484 ++- ...er_associable_resource_types_operations.py | 96 + ...ecurity_admin_configurations_operations.py | 325 ++ ...security_user_configurations_operations.py | 325 ++ .../_user_rule_collections_operations.py | 343 +++ .../aio/operations/_user_rules_operations.py | 70 +- .../vendored_sdks/models/__init__.py | 178 +- .../vendored_sdks/models/_models.py | 2285 +++++++++++--- .../vendored_sdks/models/_models_py3.py | 2702 +++++++++++++---- .../_network_management_client_enums.py | 122 +- .../vendored_sdks/operations/__init__.py | 32 +- .../_active_configurations_operations.py | 139 - ..._connectivity_configurations_operations.py | 112 + ..._active_security_admin_rules_operations.py | 112 + .../_active_security_user_rules_operations.py | 112 + .../_admin_rule_collections_operations.py | 351 +++ .../operations/_admin_rules_operations.py | 64 +- ..._connectivity_configurations_operations.py | 10 +- .../_effective_configurations_operations.py | 134 - ..._connectivity_configurations_operations.py | 112 + .../_effective_virtual_networks_operations.py | 228 +- .../operations/_network_groups_operations.py | 10 +- .../_network_manager_commits_operations.py | 19 +- ...rk_manager_deployment_status_operations.py | 119 +- ...fective_security_admin_rules_operations.py | 112 + .../_network_managers_operations.py | 16 +- ...network_security_perimeters_operations.py} | 479 ++- ...er_associable_resource_types_operations.py | 101 + ...ecurity_admin_configurations_operations.py | 333 ++ ...security_user_configurations_operations.py | 333 ++ .../_user_rule_collections_operations.py | 351 +++ .../operations/_user_rules_operations.py | 62 +- 55 files changed, 9223 insertions(+), 3049 deletions(-) create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/_version.py delete mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py delete mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py rename src/network-manager/azext_network_manager/vendored_sdks/aio/operations/{_security_configurations_operations.py => _network_security_perimeters_operations.py} (59%) create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py delete mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py delete mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py rename src/network-manager/azext_network_manager/vendored_sdks/operations/{_security_configurations_operations.py => _network_security_perimeters_operations.py} (59%) create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py create mode 100644 src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py diff --git a/src/network-manager/azext_network_manager/vendored_sdks/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py index c214c7c10b9..cbe2d6051b9 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py @@ -7,5 +7,13 @@ # -------------------------------------------------------------------------- from ._network_management_client import NetworkManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['NetworkManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py index 22353bbf415..d3ec9ffb0ec 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class NetworkManagementClientConfiguration(Configuration): """Configuration for NetworkManagementClient. diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json b/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json index c3a743d58bf..3b8e77f02a2 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json +++ b/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": true + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetworkManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetworkManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true @@ -42,30 +44,78 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "network_managers": "NetworkManagersOperations", "network_manager_commits": "NetworkManagerCommitsOperations", "network_manager_deployment_status": "NetworkManagerDeploymentStatusOperations", "effective_virtual_networks": "EffectiveVirtualNetworksOperations", - "active_configurations": "ActiveConfigurationsOperations", + "active_connectivity_configurations": "ActiveConnectivityConfigurationsOperations", + "active_security_admin_rules": "ActiveSecurityAdminRulesOperations", + "active_security_user_rules": "ActiveSecurityUserRulesOperations", "connectivity_configurations": "ConnectivityConfigurationsOperations", - "effective_configurations": "EffectiveConfigurationsOperations", + "effective_connectivity_configurations": "EffectiveConnectivityConfigurationsOperations", + "network_manager_effective_security_admin_rules": "NetworkManagerEffectiveSecurityAdminRulesOperations", "network_groups": "NetworkGroupsOperations", - "security_configurations": "SecurityConfigurationsOperations", + "security_user_configurations": "SecurityUserConfigurationsOperations", + "user_rule_collections": "UserRuleCollectionsOperations", + "user_rules": "UserRulesOperations", + "security_admin_configurations": "SecurityAdminConfigurationsOperations", + "admin_rule_collections": "AdminRuleCollectionsOperations", "admin_rules": "AdminRulesOperations", - "user_rules": "UserRulesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "network_security_perimeters": "NetworkSecurityPerimetersOperations", + "perimeter_associable_resource_types": "PerimeterAssociableResourceTypesOperations" + } } \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py index a7d24273c18..7ff3d376174 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py @@ -16,19 +16,28 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import NetworkManagementClientConfiguration from .operations import NetworkManagersOperations from .operations import NetworkManagerCommitsOperations from .operations import NetworkManagerDeploymentStatusOperations from .operations import EffectiveVirtualNetworksOperations -from .operations import ActiveConfigurationsOperations +from .operations import ActiveConnectivityConfigurationsOperations +from .operations import ActiveSecurityAdminRulesOperations +from .operations import ActiveSecurityUserRulesOperations from .operations import ConnectivityConfigurationsOperations -from .operations import EffectiveConfigurationsOperations +from .operations import EffectiveConnectivityConfigurationsOperations +from .operations import NetworkManagerEffectiveSecurityAdminRulesOperations from .operations import NetworkGroupsOperations -from .operations import SecurityConfigurationsOperations -from .operations import AdminRulesOperations +from .operations import SecurityUserConfigurationsOperations +from .operations import UserRuleCollectionsOperations from .operations import UserRulesOperations +from .operations import SecurityAdminConfigurationsOperations +from .operations import AdminRuleCollectionsOperations +from .operations import AdminRulesOperations +from .operations import NetworkSecurityPerimetersOperations +from .operations import PerimeterAssociableResourceTypesOperations from . import models @@ -36,27 +45,43 @@ class NetworkManagementClient(object): """Network Client. :ivar network_managers: NetworkManagersOperations operations - :vartype network_managers: azure.mgmt.network.v2021_02_preview.operations.NetworkManagersOperations + :vartype network_managers: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagersOperations :ivar network_manager_commits: NetworkManagerCommitsOperations operations - :vartype network_manager_commits: azure.mgmt.network.v2021_02_preview.operations.NetworkManagerCommitsOperations + :vartype network_manager_commits: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagerCommitsOperations :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations - :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_preview.operations.NetworkManagerDeploymentStatusOperations + :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagerDeploymentStatusOperations :ivar effective_virtual_networks: EffectiveVirtualNetworksOperations operations - :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_preview.operations.EffectiveVirtualNetworksOperations - :ivar active_configurations: ActiveConfigurationsOperations operations - :vartype active_configurations: azure.mgmt.network.v2021_02_preview.operations.ActiveConfigurationsOperations + :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_01_preview.operations.EffectiveVirtualNetworksOperations + :ivar active_connectivity_configurations: ActiveConnectivityConfigurationsOperations operations + :vartype active_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.operations.ActiveConnectivityConfigurationsOperations + :ivar active_security_admin_rules: ActiveSecurityAdminRulesOperations operations + :vartype active_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.operations.ActiveSecurityAdminRulesOperations + :ivar active_security_user_rules: ActiveSecurityUserRulesOperations operations + :vartype active_security_user_rules: azure.mgmt.network.v2021_02_01_preview.operations.ActiveSecurityUserRulesOperations :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations - :vartype connectivity_configurations: azure.mgmt.network.v2021_02_preview.operations.ConnectivityConfigurationsOperations - :ivar effective_configurations: EffectiveConfigurationsOperations operations - :vartype effective_configurations: azure.mgmt.network.v2021_02_preview.operations.EffectiveConfigurationsOperations + :vartype connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.operations.ConnectivityConfigurationsOperations + :ivar effective_connectivity_configurations: EffectiveConnectivityConfigurationsOperations operations + :vartype effective_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.operations.EffectiveConnectivityConfigurationsOperations + :ivar network_manager_effective_security_admin_rules: NetworkManagerEffectiveSecurityAdminRulesOperations operations + :vartype network_manager_effective_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagerEffectiveSecurityAdminRulesOperations :ivar network_groups: NetworkGroupsOperations operations - :vartype network_groups: azure.mgmt.network.v2021_02_preview.operations.NetworkGroupsOperations - :ivar security_configurations: SecurityConfigurationsOperations operations - :vartype security_configurations: azure.mgmt.network.v2021_02_preview.operations.SecurityConfigurationsOperations - :ivar admin_rules: AdminRulesOperations operations - :vartype admin_rules: azure.mgmt.network.v2021_02_preview.operations.AdminRulesOperations + :vartype network_groups: azure.mgmt.network.v2021_02_01_preview.operations.NetworkGroupsOperations + :ivar security_user_configurations: SecurityUserConfigurationsOperations operations + :vartype security_user_configurations: azure.mgmt.network.v2021_02_01_preview.operations.SecurityUserConfigurationsOperations + :ivar user_rule_collections: UserRuleCollectionsOperations operations + :vartype user_rule_collections: azure.mgmt.network.v2021_02_01_preview.operations.UserRuleCollectionsOperations :ivar user_rules: UserRulesOperations operations - :vartype user_rules: azure.mgmt.network.v2021_02_preview.operations.UserRulesOperations + :vartype user_rules: azure.mgmt.network.v2021_02_01_preview.operations.UserRulesOperations + :ivar security_admin_configurations: SecurityAdminConfigurationsOperations operations + :vartype security_admin_configurations: azure.mgmt.network.v2021_02_01_preview.operations.SecurityAdminConfigurationsOperations + :ivar admin_rule_collections: AdminRuleCollectionsOperations operations + :vartype admin_rule_collections: azure.mgmt.network.v2021_02_01_preview.operations.AdminRuleCollectionsOperations + :ivar admin_rules: AdminRulesOperations operations + :vartype admin_rules: azure.mgmt.network.v2021_02_01_preview.operations.AdminRulesOperations + :ivar network_security_perimeters: NetworkSecurityPerimetersOperations operations + :vartype network_security_perimeters: azure.mgmt.network.v2021_02_01_preview.operations.NetworkSecurityPerimetersOperations + :ivar perimeter_associable_resource_types: PerimeterAssociableResourceTypesOperations operations + :vartype perimeter_associable_resource_types: azure.mgmt.network.v2021_02_01_preview.operations.PerimeterAssociableResourceTypesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -79,6 +104,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.network_managers = NetworkManagersOperations( @@ -89,20 +115,54 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.effective_virtual_networks = EffectiveVirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize) - self.active_configurations = ActiveConfigurationsOperations( + self.active_connectivity_configurations = ActiveConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_security_admin_rules = ActiveSecurityAdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_security_user_rules = ActiveSecurityUserRulesOperations( self._client, self._config, self._serialize, self._deserialize) self.connectivity_configurations = ConnectivityConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.effective_configurations = EffectiveConfigurationsOperations( + self.effective_connectivity_configurations = EffectiveConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_manager_effective_security_admin_rules = NetworkManagerEffectiveSecurityAdminRulesOperations( self._client, self._config, self._serialize, self._deserialize) self.network_groups = NetworkGroupsOperations( self._client, self._config, self._serialize, self._deserialize) - self.security_configurations = SecurityConfigurationsOperations( + self.security_user_configurations = SecurityUserConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.admin_rules = AdminRulesOperations( + self.user_rule_collections = UserRuleCollectionsOperations( self._client, self._config, self._serialize, self._deserialize) self.user_rules = UserRulesOperations( self._client, self._config, self._serialize, self._deserialize) + self.security_admin_configurations = SecurityAdminConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_rule_collections = AdminRuleCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_rules = AdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_security_perimeters = NetworkSecurityPerimetersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.perimeter_associable_resource_types = PerimeterAssociableResourceTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_version.py b/src/network-manager/azext_network_manager/vendored_sdks/_version.py new file mode 100644 index 00000000000..e5754a47ce6 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py index 06887c8f98e..05295a7364a 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class NetworkManagementClientConfiguration(Configuration): """Configuration for NetworkManagementClient. diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py index 97b335253f0..9de340f52e3 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -20,13 +21,21 @@ from .operations import NetworkManagerCommitsOperations from .operations import NetworkManagerDeploymentStatusOperations from .operations import EffectiveVirtualNetworksOperations -from .operations import ActiveConfigurationsOperations +from .operations import ActiveConnectivityConfigurationsOperations +from .operations import ActiveSecurityAdminRulesOperations +from .operations import ActiveSecurityUserRulesOperations from .operations import ConnectivityConfigurationsOperations -from .operations import EffectiveConfigurationsOperations +from .operations import EffectiveConnectivityConfigurationsOperations +from .operations import NetworkManagerEffectiveSecurityAdminRulesOperations from .operations import NetworkGroupsOperations -from .operations import SecurityConfigurationsOperations -from .operations import AdminRulesOperations +from .operations import SecurityUserConfigurationsOperations +from .operations import UserRuleCollectionsOperations from .operations import UserRulesOperations +from .operations import SecurityAdminConfigurationsOperations +from .operations import AdminRuleCollectionsOperations +from .operations import AdminRulesOperations +from .operations import NetworkSecurityPerimetersOperations +from .operations import PerimeterAssociableResourceTypesOperations from .. import models @@ -34,27 +43,43 @@ class NetworkManagementClient(object): """Network Client. :ivar network_managers: NetworkManagersOperations operations - :vartype network_managers: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkManagersOperations + :vartype network_managers: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagersOperations :ivar network_manager_commits: NetworkManagerCommitsOperations operations - :vartype network_manager_commits: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkManagerCommitsOperations + :vartype network_manager_commits: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagerCommitsOperations :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations - :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkManagerDeploymentStatusOperations + :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagerDeploymentStatusOperations :ivar effective_virtual_networks: EffectiveVirtualNetworksOperations operations - :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_preview.aio.operations.EffectiveVirtualNetworksOperations - :ivar active_configurations: ActiveConfigurationsOperations operations - :vartype active_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.ActiveConfigurationsOperations + :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_01_preview.aio.operations.EffectiveVirtualNetworksOperations + :ivar active_connectivity_configurations: ActiveConnectivityConfigurationsOperations operations + :vartype active_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.ActiveConnectivityConfigurationsOperations + :ivar active_security_admin_rules: ActiveSecurityAdminRulesOperations operations + :vartype active_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.ActiveSecurityAdminRulesOperations + :ivar active_security_user_rules: ActiveSecurityUserRulesOperations operations + :vartype active_security_user_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.ActiveSecurityUserRulesOperations :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations - :vartype connectivity_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.ConnectivityConfigurationsOperations - :ivar effective_configurations: EffectiveConfigurationsOperations operations - :vartype effective_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.EffectiveConfigurationsOperations + :vartype connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.ConnectivityConfigurationsOperations + :ivar effective_connectivity_configurations: EffectiveConnectivityConfigurationsOperations operations + :vartype effective_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.EffectiveConnectivityConfigurationsOperations + :ivar network_manager_effective_security_admin_rules: NetworkManagerEffectiveSecurityAdminRulesOperations operations + :vartype network_manager_effective_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagerEffectiveSecurityAdminRulesOperations :ivar network_groups: NetworkGroupsOperations operations - :vartype network_groups: azure.mgmt.network.v2021_02_preview.aio.operations.NetworkGroupsOperations - :ivar security_configurations: SecurityConfigurationsOperations operations - :vartype security_configurations: azure.mgmt.network.v2021_02_preview.aio.operations.SecurityConfigurationsOperations - :ivar admin_rules: AdminRulesOperations operations - :vartype admin_rules: azure.mgmt.network.v2021_02_preview.aio.operations.AdminRulesOperations + :vartype network_groups: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkGroupsOperations + :ivar security_user_configurations: SecurityUserConfigurationsOperations operations + :vartype security_user_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.SecurityUserConfigurationsOperations + :ivar user_rule_collections: UserRuleCollectionsOperations operations + :vartype user_rule_collections: azure.mgmt.network.v2021_02_01_preview.aio.operations.UserRuleCollectionsOperations :ivar user_rules: UserRulesOperations operations - :vartype user_rules: azure.mgmt.network.v2021_02_preview.aio.operations.UserRulesOperations + :vartype user_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.UserRulesOperations + :ivar security_admin_configurations: SecurityAdminConfigurationsOperations operations + :vartype security_admin_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.SecurityAdminConfigurationsOperations + :ivar admin_rule_collections: AdminRuleCollectionsOperations operations + :vartype admin_rule_collections: azure.mgmt.network.v2021_02_01_preview.aio.operations.AdminRuleCollectionsOperations + :ivar admin_rules: AdminRulesOperations operations + :vartype admin_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.AdminRulesOperations + :ivar network_security_perimeters: NetworkSecurityPerimetersOperations operations + :vartype network_security_perimeters: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkSecurityPerimetersOperations + :ivar perimeter_associable_resource_types: PerimeterAssociableResourceTypesOperations operations + :vartype perimeter_associable_resource_types: azure.mgmt.network.v2021_02_01_preview.aio.operations.PerimeterAssociableResourceTypesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -76,6 +101,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.network_managers = NetworkManagersOperations( @@ -86,20 +112,53 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.effective_virtual_networks = EffectiveVirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize) - self.active_configurations = ActiveConfigurationsOperations( + self.active_connectivity_configurations = ActiveConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_security_admin_rules = ActiveSecurityAdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_security_user_rules = ActiveSecurityUserRulesOperations( self._client, self._config, self._serialize, self._deserialize) self.connectivity_configurations = ConnectivityConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.effective_configurations = EffectiveConfigurationsOperations( + self.effective_connectivity_configurations = EffectiveConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_manager_effective_security_admin_rules = NetworkManagerEffectiveSecurityAdminRulesOperations( self._client, self._config, self._serialize, self._deserialize) self.network_groups = NetworkGroupsOperations( self._client, self._config, self._serialize, self._deserialize) - self.security_configurations = SecurityConfigurationsOperations( + self.security_user_configurations = SecurityUserConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.admin_rules = AdminRulesOperations( + self.user_rule_collections = UserRuleCollectionsOperations( self._client, self._config, self._serialize, self._deserialize) self.user_rules = UserRulesOperations( self._client, self._config, self._serialize, self._deserialize) + self.security_admin_configurations = SecurityAdminConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_rule_collections = AdminRuleCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_rules = AdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_security_perimeters = NetworkSecurityPerimetersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.perimeter_associable_resource_types = PerimeterAssociableResourceTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py index ad5afd67132..e3ab4d13aca 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py @@ -10,24 +10,40 @@ from ._network_manager_commits_operations import NetworkManagerCommitsOperations from ._network_manager_deployment_status_operations import NetworkManagerDeploymentStatusOperations from ._effective_virtual_networks_operations import EffectiveVirtualNetworksOperations -from ._active_configurations_operations import ActiveConfigurationsOperations +from ._active_connectivity_configurations_operations import ActiveConnectivityConfigurationsOperations +from ._active_security_admin_rules_operations import ActiveSecurityAdminRulesOperations +from ._active_security_user_rules_operations import ActiveSecurityUserRulesOperations from ._connectivity_configurations_operations import ConnectivityConfigurationsOperations -from ._effective_configurations_operations import EffectiveConfigurationsOperations +from ._effective_connectivity_configurations_operations import EffectiveConnectivityConfigurationsOperations +from ._network_manager_effective_security_admin_rules_operations import NetworkManagerEffectiveSecurityAdminRulesOperations from ._network_groups_operations import NetworkGroupsOperations -from ._security_configurations_operations import SecurityConfigurationsOperations -from ._admin_rules_operations import AdminRulesOperations +from ._security_user_configurations_operations import SecurityUserConfigurationsOperations +from ._user_rule_collections_operations import UserRuleCollectionsOperations from ._user_rules_operations import UserRulesOperations +from ._security_admin_configurations_operations import SecurityAdminConfigurationsOperations +from ._admin_rule_collections_operations import AdminRuleCollectionsOperations +from ._admin_rules_operations import AdminRulesOperations +from ._network_security_perimeters_operations import NetworkSecurityPerimetersOperations +from ._perimeter_associable_resource_types_operations import PerimeterAssociableResourceTypesOperations __all__ = [ 'NetworkManagersOperations', 'NetworkManagerCommitsOperations', 'NetworkManagerDeploymentStatusOperations', 'EffectiveVirtualNetworksOperations', - 'ActiveConfigurationsOperations', + 'ActiveConnectivityConfigurationsOperations', + 'ActiveSecurityAdminRulesOperations', + 'ActiveSecurityUserRulesOperations', 'ConnectivityConfigurationsOperations', - 'EffectiveConfigurationsOperations', + 'EffectiveConnectivityConfigurationsOperations', + 'NetworkManagerEffectiveSecurityAdminRulesOperations', 'NetworkGroupsOperations', - 'SecurityConfigurationsOperations', - 'AdminRulesOperations', + 'SecurityUserConfigurationsOperations', + 'UserRuleCollectionsOperations', 'UserRulesOperations', + 'SecurityAdminConfigurationsOperations', + 'AdminRuleCollectionsOperations', + 'AdminRulesOperations', + 'NetworkSecurityPerimetersOperations', + 'PerimeterAssociableResourceTypesOperations', ] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py deleted file mode 100644 index 4568d09f421..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_configurations_operations.py +++ /dev/null @@ -1,134 +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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ActiveConfigurationsOperations: - """ActiveConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - network_manager_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - region: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ActiveConfigurationListResult"]: - """Lists active configurations in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str - :param region: Location name. - :type region: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ActiveConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.ActiveConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConfigurationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if region is not None: - query_parameters['region'] = self._serialize.query("region", region, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ActiveConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/activeConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py new file mode 100644 index 00000000000..3abf2e35153 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActiveConnectivityConfigurationsOperations: + """ActiveConnectivityConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveConnectivityConfigurationsListResult": + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveConnectivityConfigurationsListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfigurationsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConnectivityConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveConnectivityConfigurationsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py new file mode 100644 index 00000000000..23e9a9b4987 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActiveSecurityAdminRulesOperations: + """ActiveSecurityAdminRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveSecurityAdminRulesListResult": + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py new file mode 100644 index 00000000000..8cef3bdce40 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActiveSecurityUserRulesOperations: + """ActiveSecurityUserRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveSecurityUserRulesListResult": + """Lists Active Security User Rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityUserRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityUserRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityUserRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityUserRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py new file mode 100644 index 00000000000..eca2c67749c --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py @@ -0,0 +1,343 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AdminRuleCollectionsOperations: + """AdminRuleCollectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleCollectionListResult"]: + """Lists all the rule collections in a security admin configuration, in a paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> "_models.RuleCollection": + """Gets a network manager security admin configuration rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: "_models.RuleCollection", + **kwargs: Any + ) -> "_models.RuleCollection": + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. + :type rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(rule_collection, 'RuleCollection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> None: + """Deletes an admin rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py index 7313147c5cd..4d41ba8a9b6 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py @@ -26,7 +26,7 @@ class AdminRulesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -46,11 +46,12 @@ def list( resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AdminRuleListResult"]: - """Retrieves a network manager security configuration admin rule. + """List all network manager security configuration admin rules. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -58,6 +59,9 @@ def list( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -67,7 +71,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AdminRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.AdminRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRuleListResult"] @@ -91,6 +95,7 @@ def prepare_request(next_link=None): 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -130,17 +135,18 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore async def get( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, rule_name: str, - **kwargs - ) -> "_models.AdminRule": - """Gets a network manager security configuration admin rule in a subscription. + **kwargs: Any + ) -> "_models.BaseAdminRule": + """Gets a network manager security configuration admin rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -148,14 +154,17 @@ async def get( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :return: BaseAdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -170,6 +179,7 @@ async def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -190,23 +200,24 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AdminRule', pipeline_response) + deserialized = self._deserialize('BaseAdminRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore async def create_or_update( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, rule_name: str, - admin_rule: "_models.AdminRule", - **kwargs - ) -> "_models.AdminRule": + admin_rule: "_models.BaseAdminRule", + **kwargs: Any + ) -> "_models.BaseAdminRule": """Creates or updates an admin rule. :param resource_group_name: The name of the resource group. @@ -215,16 +226,19 @@ async def create_or_update( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :param admin_rule: The admin rule to create or update. - :type admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :type admin_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule :keyword callable cls: A custom type or function that will be passed the direct response - :return: AdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :return: BaseAdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,6 +254,7 @@ async def create_or_update( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -254,7 +269,7 @@ async def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(admin_rule, 'AdminRule') + body_content = self._serialize.body(admin_rule, 'BaseAdminRule') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -265,24 +280,25 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AdminRule', pipeline_response) + deserialized = self._deserialize('BaseAdminRule', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AdminRule', pipeline_response) + deserialized = self._deserialize('BaseAdminRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes an admin rule. @@ -292,6 +308,9 @@ async def delete( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,6 +333,7 @@ async def delete( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -337,4 +357,4 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py index da3539abd5f..7aaf0f0a2c5 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py @@ -26,7 +26,7 @@ class ConnectivityConfigurationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -46,7 +46,7 @@ async def get( resource_group_name: str, network_manager_name: str, configuration_name: str, - **kwargs + **kwargs: Any ) -> "_models.ConnectivityConfiguration": """Gets a Network Connectivity Configuration, specified by the resource group, network manager name, and connectivity Configuration name. @@ -59,7 +59,7 @@ async def get( :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -110,7 +110,7 @@ async def create_or_update( network_manager_name: str, configuration_name: str, connectivity_configuration: "_models.ConnectivityConfiguration", - **kwargs + **kwargs: Any ) -> "_models.ConnectivityConfiguration": """Creates/Updates a new network manager connectivity configuration. @@ -122,10 +122,10 @@ async def create_or_update( :type configuration_name: str :param connectivity_configuration: Parameters supplied to create/update a network manager connectivity configuration. - :type connectivity_configuration: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :type connectivity_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -184,7 +184,7 @@ async def delete( resource_group_name: str, network_manager_name: str, configuration_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a network manager connectivity configuration, specified by the resource group, network manager name, and connectivity configuration name. @@ -245,7 +245,7 @@ def list( network_manager_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ConnectivityConfigurationListResult"]: """Lists all the network manager connectivity configuration in a specified network manager. @@ -262,7 +262,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectivityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfigurationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfigurationListResult"] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py deleted file mode 100644 index fbbc7ed211e..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_configurations_operations.py +++ /dev/null @@ -1,129 +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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class EffectiveConfigurationsOperations: - """EffectiveConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - virtual_network_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.NetworkManagerEffectiveConfigurationListResult"]: - """List all configurations in a virtual network. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerEffectiveConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerEffectiveConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConfigurationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerEffectiveConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/networkManagerEffectiveConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py new file mode 100644 index 00000000000..a25307a9064 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EffectiveConnectivityConfigurationsOperations: + """EffectiveConnectivityConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.NetworkManagerEffectiveConnectivityConfigurationListResult": + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveConnectivityConfigurationListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConnectivityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueryRequestOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveConnectivityConfigurationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py index a5d18f98f75..d603814b3c4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py @@ -5,10 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest @@ -26,7 +25,7 @@ class EffectiveVirtualNetworksOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,15 +40,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list_by_network_manager( + async def list_by_network_manager( self, resource_group_name: str, network_manager_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, parameters: Optional["_models.EffectiveVirtualNetworksParameter"] = None, - **kwargs - ) -> AsyncIterable["_models.EffectiveVirtualNetworksListResult"]: + **kwargs: Any + ) -> "_models.EffectiveVirtualNetworksListResult": """List effective virtual networks in a network manager. :param resource_group_name: The name of the resource group. @@ -64,10 +63,10 @@ def list_by_network_manager( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :param parameters: Effective Virtual Networks Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksParameter + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :return: EffectiveVirtualNetworksListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] @@ -76,84 +75,61 @@ def list_by_network_manager( } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = "application/json" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_network_manager.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) + # Construct URL + url = self.list_by_network_manager.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore - def list_by_network_group( + async def list_by_network_group( self, resource_group_name: str, network_manager_name: str, network_group_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.EffectiveVirtualNetworksListResult"]: + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.EffectiveVirtualNetworksListResult": """Lists all effective virtual networks by specified network group. :param resource_group_name: The name of the resource group. @@ -162,16 +138,11 @@ def list_by_network_group( :type network_manager_name: str :param network_group_name: The name of the network group to get. :type network_group_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :return: EffectiveVirtualNetworksListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] @@ -180,58 +151,43 @@ def list_by_network_group( } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_network_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) + # Construct URL + url = self.list_by_network_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueryRequestOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized list_by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py index 6643a8b7f9e..5393f2574ab 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py @@ -26,7 +26,7 @@ class NetworkGroupsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -46,7 +46,7 @@ async def get( resource_group_name: str, network_manager_name: str, network_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkGroup": """Gets the specified network group. @@ -58,7 +58,7 @@ async def get( :type network_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -110,7 +110,7 @@ async def create_or_update( network_group_name: str, parameters: "_models.NetworkGroup", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.NetworkGroup": """Creates or updates a network group. @@ -121,14 +121,14 @@ async def create_or_update( :param network_group_name: The name of the network group to get. :type network_group_name: str :param parameters: Parameters supplied to the specify which network group need to create. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup :param if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -192,7 +192,7 @@ async def delete( resource_group_name: str, network_manager_name: str, network_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a network group. @@ -252,7 +252,7 @@ def list( network_manager_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NetworkGroupListResult"]: """Lists the specified network group. @@ -269,7 +269,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NetworkGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkGroupListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroupListResult"] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py index 8fcc4432d76..edb5e278cd4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py @@ -25,7 +25,7 @@ class NetworkManagerCommitsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,8 +45,8 @@ async def post( resource_group_name: str, network_manager_name: str, parameters: "_models.NetworkManagerCommit", - **kwargs - ) -> None: + **kwargs: Any + ) -> "_models.NetworkManagerCommit": """Post a Network Manager Commit. :param resource_group_name: The name of the resource group. @@ -54,13 +54,13 @@ async def post( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network commit is. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerCommit + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: NetworkManagerCommit, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerCommit"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -94,11 +94,14 @@ async def post( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize('NetworkManagerCommit', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py index 3bffcd9d4d0..217199348e4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py @@ -5,10 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest @@ -26,7 +25,7 @@ class NetworkManagerDeploymentStatusOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,33 +40,24 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list( + async def list( self, resource_group_name: str, network_manager_name: str, parameters: "_models.NetworkManagerDeploymentStatusParameter", - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.NetworkManagerDeploymentStatusListResult"]: - """Post List of Network Manager Deployment Status. + **kwargs: Any + ) -> "_models.NetworkManagerDeploymentStatusListResult": + """Post to List of Network Manager Deployment Status. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network deployment status is. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusParameter - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusParameter :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerDeploymentStatusListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusListResult] + :return: NetworkManagerDeploymentStatusListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerDeploymentStatusListResult"] @@ -76,65 +66,42 @@ def list( } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = "application/json" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerDeploymentStatusListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerDeploymentStatusListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py new file mode 100644 index 00000000000..0d2ea772371 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagerEffectiveSecurityAdminRulesOperations: + """NetworkManagerEffectiveSecurityAdminRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.NetworkManagerEffectiveSecurityAdminRulesListResult": + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueryRequestOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py index d281f3823dd..922ec5fdb52 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py @@ -26,7 +26,7 @@ class NetworkManagersOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,7 +45,7 @@ async def get( self, resource_group_name: str, network_manager_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkManager": """Gets the specified Network Manager. @@ -55,7 +55,7 @@ async def get( :type network_manager_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -104,7 +104,7 @@ async def create_or_update( resource_group_name: str, network_manager_name: str, parameters: "_models.NetworkManager", - **kwargs + **kwargs: Any ) -> "_models.NetworkManager": """Creates or updates a Network Manager. @@ -113,10 +113,10 @@ async def create_or_update( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which network manager is. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -173,7 +173,7 @@ async def delete( self, resource_group_name: str, network_manager_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a network manager. @@ -229,7 +229,7 @@ async def patch_tags( resource_group_name: str, network_manager_name: str, parameters: "_models.TagsObject", - **kwargs + **kwargs: Any ) -> "_models.NetworkManager": """Patch a NetworkManager Tags. @@ -238,10 +238,10 @@ async def patch_tags( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to update network manager tags. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.TagsObject + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -294,7 +294,7 @@ def list_by_subscription( self, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NetworkManagerListResult"]: """List all network managers in a subscription. @@ -307,7 +307,7 @@ def list_by_subscription( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] @@ -374,7 +374,7 @@ def list( resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NetworkManagerListResult"]: """List network managers in a resource group. @@ -389,7 +389,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py similarity index 59% rename from src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py rename to src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py index 93c25596fde..e848ca499c6 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py @@ -19,14 +19,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SecurityConfigurationsOperations: - """SecurityConfigurationsOperations async operations. +class NetworkSecurityPerimetersOperations: + """NetworkSecurityPerimetersOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,34 +41,24 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list( + async def get( self, resource_group_name: str, - network_manager_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.SecurityConfigurationListResult"]: - """Lists all the network manager security configurations in a network manager, in a paginated - format. + network_security_perimeter_name: str, + **kwargs: Any + ) -> "_models.NetworkSecurityPerimeter": + """Gets the specified network security perimeter by the name. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str + :param network_security_perimeter_name: The name of the network security perimeter. + :type network_security_perimeter_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationListResult] + :return: NetworkSecurityPerimeter, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,83 +66,60 @@ def list( api_version = "2021-02-01-preview" accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - async def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - async def get_next(next_link=None): - request = prepare_request(next_link) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations'} # type: ignore + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - async def import_method( + async def create_or_update( self, resource_group_name: str, - network_manager_name: str, - configuration_name: str, - parameters: "_models.NetworkManagerSecurityConfigurationImport", - **kwargs - ) -> "_models.SecurityConfigurationImportResult": - """Imports network security rules to network manager security rules. + network_security_perimeter_name: str, + parameters: "_models.NetworkSecurityPerimeter", + **kwargs: Any + ) -> "_models.NetworkSecurityPerimeter": + """Creates or updates a Network Security Perimeter. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :param parameters: Import Security configuration parameter. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :param network_security_perimeter_name: The name of the network security perimeter. + :type network_security_perimeter_name: str + :param parameters: Parameter supplied to create or update the network security perimeter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityConfigurationImportResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationImportResult + :return: NetworkSecurityPerimeter, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationImportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -162,12 +129,11 @@ async def import_method( accept = "application/json" # Construct URL - url = self.import_method.metadata['url'] # type: ignore + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -181,44 +147,91 @@ async def import_method( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content = self._serialize.body(parameters, 'NetworkSecurityPerimeter') body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityConfigurationImportResult', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/import'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - def evaluate_import( + async def delete( self, resource_group_name: str, - network_manager_name: str, - configuration_name: str, - parameters: "_models.NetworkManagerSecurityConfigurationImport", - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.SecurityConfigurationRuleListResult"]: - """The operation to evaluate import NSG to security configurations. + network_security_perimeter_name: str, + **kwargs: Any + ) -> None: + """Deletes a network security perimeter. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :param parameters: Import security configuration parameter. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :param network_security_perimeter_name: The name of the network security perimeter. + :type network_security_perimeter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore + + def list_by_subscription( + self, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkSecurityPerimeterListResult"]: + """List all network security perimeters in a subscription. + :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -227,33 +240,28 @@ def evaluate_import( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleListResult] + :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationRuleListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = "application/json" accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL - url = self.evaluate_import.metadata['url'] # type: ignore + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -264,21 +272,15 @@ def prepare_request(next_link=None): if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationRuleListResult', pipeline_response) + deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -299,199 +301,87 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - evaluate_import.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/evaluateImport'} # type: ignore - - async def get( - self, - resource_group_name: str, - network_manager_name: str, - configuration_name: str, - **kwargs - ) -> "_models.SecurityConfiguration": - """Retrieves a network manager security Configuration. + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SecurityConfiguration', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore - - async def create_or_update( + def list( self, resource_group_name: str, - network_manager_name: str, - configuration_name: str, - security_configuration: "_models.SecurityConfiguration", - **kwargs - ) -> "_models.SecurityConfiguration": - """Creates or updates a network manager security Configuration. + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkSecurityPerimeterListResult"]: + """List network security perimeters in a resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :param security_configuration: The security configuration to create or update. - :type security_configuration: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_configuration, 'SecurityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('SecurityConfiguration', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('SecurityConfiguration', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore - - async def delete( - self, - resource_group_name: str, - network_manager_name: str, - configuration_name: str, - **kwargs - ) -> None: - """Deletes a network manager security Configuration. + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + async def get_next(next_link=None): + request = prepare_request(next_link) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + return pipeline_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py new file mode 100644 index 00000000000..7052642970c --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py @@ -0,0 +1,96 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PerimeterAssociableResourceTypesOperations: + """PerimeterAssociableResourceTypesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + location: str, + **kwargs: Any + ) -> "_models.PerimeterAssociableResourcesListResult": + """Gets the list of resources that are onboarded with NSP. These resources can be associated with + a network security perimeter. + + :param location: The location of the where the association is present. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PerimeterAssociableResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PerimeterAssociableResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PerimeterAssociableResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/perimeterAssociableResourceTypes'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py new file mode 100644 index 00000000000..1376e034b69 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py @@ -0,0 +1,325 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SecurityAdminConfigurationsOperations: + """SecurityAdminConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SecurityConfigurationListResult"]: + """Lists all the network manager security admin configurations in a network manager, in a + paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.SecurityConfiguration": + """Retrieves a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: "_models.SecurityConfiguration", + **kwargs: Any + ) -> "_models.SecurityConfiguration": + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. + :type security_admin_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(security_admin_configuration, 'SecurityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> None: + """Deletes a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py new file mode 100644 index 00000000000..90c23233f46 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py @@ -0,0 +1,325 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SecurityUserConfigurationsOperations: + """SecurityUserConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SecurityConfigurationListResult"]: + """Lists all the network manager security user configurations in a network manager, in a paginated + format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.SecurityConfiguration": + """Retrieves a network manager security user configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_user_configuration: "_models.SecurityConfiguration", + **kwargs: Any + ) -> "_models.SecurityConfiguration": + """Creates or updates a network manager security user configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param security_user_configuration: The security user configuration to create or update. + :type security_user_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(security_user_configuration, 'SecurityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> None: + """Deletes a network manager security user configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py new file mode 100644 index 00000000000..ef488639df0 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py @@ -0,0 +1,343 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UserRuleCollectionsOperations: + """UserRuleCollectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleCollectionListResult"]: + """Lists all the user rule collections in a security configuration, in a paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> "_models.RuleCollection": + """Gets a network manager security user configuration rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + user_rule_collection: "_models.RuleCollection", + **kwargs: Any + ) -> "_models.RuleCollection": + """Creates or updates a user rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :param user_rule_collection: The User Rule Collection to create or update. + :type user_rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_rule_collection, 'RuleCollection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> None: + """Deletes a user rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py index 3bc67fa557c..895b099aca7 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py @@ -26,7 +26,7 @@ class UserRulesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -46,11 +46,12 @@ def list( resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserRuleListResult"]: - """Lists all user rules in a security configuration. + """Lists all user rules in a rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -58,6 +59,9 @@ def list( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -67,7 +71,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_preview.models.UserRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.UserRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRuleListResult"] @@ -91,6 +95,7 @@ def prepare_request(next_link=None): 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -130,16 +135,17 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore async def get( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, rule_name: str, - **kwargs - ) -> "_models.UserRule": + **kwargs: Any + ) -> "_models.BaseUserRule": """Gets a user rule. :param resource_group_name: The name of the resource group. @@ -148,14 +154,17 @@ async def get( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: UserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :return: BaseUserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -170,6 +179,7 @@ async def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -190,23 +200,24 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('UserRule', pipeline_response) + deserialized = self._deserialize('BaseUserRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore async def create_or_update( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, rule_name: str, - user_rule: "_models.UserRule", - **kwargs - ) -> "_models.UserRule": + user_rule: "_models.BaseUserRule", + **kwargs: Any + ) -> "_models.BaseUserRule": """Creates or updates a user rule. :param resource_group_name: The name of the resource group. @@ -215,16 +226,19 @@ async def create_or_update( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :param user_rule: The user rule to create or update. - :type user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :type user_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule :keyword callable cls: A custom type or function that will be passed the direct response - :return: UserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :return: BaseUserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,6 +254,7 @@ async def create_or_update( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -254,7 +269,7 @@ async def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user_rule, 'UserRule') + body_content = self._serialize.body(user_rule, 'BaseUserRule') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -265,24 +280,25 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('UserRule', pipeline_response) + deserialized = self._deserialize('BaseUserRule', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('UserRule', pipeline_response) + deserialized = self._deserialize('BaseUserRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + rule_collection_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a user rule. @@ -292,6 +308,9 @@ async def delete( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,6 +333,7 @@ async def delete( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -337,4 +357,4 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py index 976debc5b29..3f8f582e653 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py @@ -7,27 +7,37 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import ActiveConfiguration - from ._models_py3 import ActiveConfigurationListResult + from ._models_py3 import ActiveBaseSecurityAdminRule + from ._models_py3 import ActiveBaseSecurityUserRule + from ._models_py3 import ActiveConfigurationParameter + from ._models_py3 import ActiveConnectivityConfiguration + from ._models_py3 import ActiveConnectivityConfigurationsListResult + from ._models_py3 import ActiveDefaultSecurityAdminRule + from ._models_py3 import ActiveDefaultSecurityUserRule + from ._models_py3 import ActiveSecurityAdminRule + from ._models_py3 import ActiveSecurityAdminRulesListResult + from ._models_py3 import ActiveSecurityUserRule + from ._models_py3 import ActiveSecurityUserRulesListResult from ._models_py3 import AddressPrefixItem from ._models_py3 import AdminRule from ._models_py3 import AdminRuleListResult - from ._models_py3 import AzureAsyncOperationResult + from ._models_py3 import BaseAdminRule + from ._models_py3 import BaseUserRule from ._models_py3 import CloudErrorBody - from ._models_py3 import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties + from ._models_py3 import ConfigurationGroup from ._models_py3 import ConnectivityConfiguration from ._models_py3 import ConnectivityConfigurationListResult from ._models_py3 import ConnectivityGroupItem - from ._models_py3 import EffectiveConfiguration + from ._models_py3 import DefaultAdminRule + from ._models_py3 import DefaultUserRule + from ._models_py3 import EffectiveBaseSecurityAdminRule + from ._models_py3 import EffectiveConnectivityConfiguration + from ._models_py3 import EffectiveDefaultSecurityAdminRule + from ._models_py3 import EffectiveSecurityAdminRule from ._models_py3 import EffectiveVirtualNetwork from ._models_py3 import EffectiveVirtualNetworksListResult from ._models_py3 import EffectiveVirtualNetworksParameter - from ._models_py3 import Error - from ._models_py3 import ErrorDetails - from ._models_py3 import ExtendedLocation - from ._models_py3 import FailedImport from ._models_py3 import GroupMembersItem - from ._models_py3 import ManagedServiceIdentity from ._models_py3 import NetworkGroup from ._models_py3 import NetworkGroupListResult from ._models_py3 import NetworkManager @@ -35,46 +45,58 @@ from ._models_py3 import NetworkManagerDeploymentStatus from ._models_py3 import NetworkManagerDeploymentStatusListResult from ._models_py3 import NetworkManagerDeploymentStatusParameter - from ._models_py3 import NetworkManagerEffectiveConfigurationListResult + from ._models_py3 import NetworkManagerEffectiveConnectivityConfigurationListResult + from ._models_py3 import NetworkManagerEffectiveSecurityAdminRulesListResult from ._models_py3 import NetworkManagerListResult from ._models_py3 import NetworkManagerPropertiesNetworkManagerScopes - from ._models_py3 import NetworkManagerSecurityConfigurationImport from ._models_py3 import NetworkManagerSecurityGroupItem - from ._models_py3 import NetworkSecurityGroupImport + from ._models_py3 import NetworkSecurityPerimeter + from ._models_py3 import NetworkSecurityPerimeterListResult + from ._models_py3 import PerimeterAssociableResource + from ._models_py3 import PerimeterAssociableResourcesListResult from ._models_py3 import ProxyResource + from ._models_py3 import QueryRequestOptions from ._models_py3 import Resource + from ._models_py3 import RuleCollection + from ._models_py3 import RuleCollectionListResult from ._models_py3 import SecurityConfiguration - from ._models_py3 import SecurityConfigurationImportResult from ._models_py3 import SecurityConfigurationListResult - from ._models_py3 import SecurityConfigurationRule - from ._models_py3 import SecurityConfigurationRuleListResult - from ._models_py3 import SubResource from ._models_py3 import SystemData from ._models_py3 import TagsObject from ._models_py3 import UserRule from ._models_py3 import UserRuleListResult except (SyntaxError, ImportError): - from ._models import ActiveConfiguration # type: ignore - from ._models import ActiveConfigurationListResult # type: ignore + from ._models import ActiveBaseSecurityAdminRule # type: ignore + from ._models import ActiveBaseSecurityUserRule # type: ignore + from ._models import ActiveConfigurationParameter # type: ignore + from ._models import ActiveConnectivityConfiguration # type: ignore + from ._models import ActiveConnectivityConfigurationsListResult # type: ignore + from ._models import ActiveDefaultSecurityAdminRule # type: ignore + from ._models import ActiveDefaultSecurityUserRule # type: ignore + from ._models import ActiveSecurityAdminRule # type: ignore + from ._models import ActiveSecurityAdminRulesListResult # type: ignore + from ._models import ActiveSecurityUserRule # type: ignore + from ._models import ActiveSecurityUserRulesListResult # type: ignore from ._models import AddressPrefixItem # type: ignore from ._models import AdminRule # type: ignore from ._models import AdminRuleListResult # type: ignore - from ._models import AzureAsyncOperationResult # type: ignore + from ._models import BaseAdminRule # type: ignore + from ._models import BaseUserRule # type: ignore from ._models import CloudErrorBody # type: ignore - from ._models import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import ConfigurationGroup # type: ignore from ._models import ConnectivityConfiguration # type: ignore from ._models import ConnectivityConfigurationListResult # type: ignore from ._models import ConnectivityGroupItem # type: ignore - from ._models import EffectiveConfiguration # type: ignore + from ._models import DefaultAdminRule # type: ignore + from ._models import DefaultUserRule # type: ignore + from ._models import EffectiveBaseSecurityAdminRule # type: ignore + from ._models import EffectiveConnectivityConfiguration # type: ignore + from ._models import EffectiveDefaultSecurityAdminRule # type: ignore + from ._models import EffectiveSecurityAdminRule # type: ignore from ._models import EffectiveVirtualNetwork # type: ignore from ._models import EffectiveVirtualNetworksListResult # type: ignore from ._models import EffectiveVirtualNetworksParameter # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorDetails # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import FailedImport # type: ignore from ._models import GroupMembersItem # type: ignore - from ._models import ManagedServiceIdentity # type: ignore from ._models import NetworkGroup # type: ignore from ._models import NetworkGroupListResult # type: ignore from ._models import NetworkManager # type: ignore @@ -82,73 +104,83 @@ from ._models import NetworkManagerDeploymentStatus # type: ignore from ._models import NetworkManagerDeploymentStatusListResult # type: ignore from ._models import NetworkManagerDeploymentStatusParameter # type: ignore - from ._models import NetworkManagerEffectiveConfigurationListResult # type: ignore + from ._models import NetworkManagerEffectiveConnectivityConfigurationListResult # type: ignore + from ._models import NetworkManagerEffectiveSecurityAdminRulesListResult # type: ignore from ._models import NetworkManagerListResult # type: ignore from ._models import NetworkManagerPropertiesNetworkManagerScopes # type: ignore - from ._models import NetworkManagerSecurityConfigurationImport # type: ignore from ._models import NetworkManagerSecurityGroupItem # type: ignore - from ._models import NetworkSecurityGroupImport # type: ignore + from ._models import NetworkSecurityPerimeter # type: ignore + from ._models import NetworkSecurityPerimeterListResult # type: ignore + from ._models import PerimeterAssociableResource # type: ignore + from ._models import PerimeterAssociableResourcesListResult # type: ignore from ._models import ProxyResource # type: ignore + from ._models import QueryRequestOptions # type: ignore from ._models import Resource # type: ignore + from ._models import RuleCollection # type: ignore + from ._models import RuleCollectionListResult # type: ignore from ._models import SecurityConfiguration # type: ignore - from ._models import SecurityConfigurationImportResult # type: ignore from ._models import SecurityConfigurationListResult # type: ignore - from ._models import SecurityConfigurationRule # type: ignore - from ._models import SecurityConfigurationRuleListResult # type: ignore - from ._models import SubResource # type: ignore from ._models import SystemData # type: ignore from ._models import TagsObject # type: ignore from ._models import UserRule # type: ignore from ._models import UserRuleListResult # type: ignore from ._network_management_client_enums import ( - Access, AddressPrefixType, - AuthenticationMethod, - CommitType, - ConfigType, + AdminRuleKind, + ConfigurationType, ConnectivityTopology, CreatedByType, + DeleteExistingNSGs, + DeleteExistingPeering, DeploymentStatus, - DeploymentType, - ExtendedLocationTypes, + EffectiveAdminRuleKind, + EffectiveUserRuleKind, GroupConnectivity, - IPAllocationMethod, - IPVersion, + IsGlobal, MemberType, MembershipType, - NetworkOperationStatus, ProvisioningState, - ResourceIdentityType, - ScopeAccesses, SecurityConfigurationRuleAccess, SecurityConfigurationRuleDirection, SecurityConfigurationRuleProtocol, SecurityType, + UseHubGateway, + UserRuleKind, ) __all__ = [ - 'ActiveConfiguration', - 'ActiveConfigurationListResult', + 'ActiveBaseSecurityAdminRule', + 'ActiveBaseSecurityUserRule', + 'ActiveConfigurationParameter', + 'ActiveConnectivityConfiguration', + 'ActiveConnectivityConfigurationsListResult', + 'ActiveDefaultSecurityAdminRule', + 'ActiveDefaultSecurityUserRule', + 'ActiveSecurityAdminRule', + 'ActiveSecurityAdminRulesListResult', + 'ActiveSecurityUserRule', + 'ActiveSecurityUserRulesListResult', 'AddressPrefixItem', 'AdminRule', 'AdminRuleListResult', - 'AzureAsyncOperationResult', + 'BaseAdminRule', + 'BaseUserRule', 'CloudErrorBody', - 'Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties', + 'ConfigurationGroup', 'ConnectivityConfiguration', 'ConnectivityConfigurationListResult', 'ConnectivityGroupItem', - 'EffectiveConfiguration', + 'DefaultAdminRule', + 'DefaultUserRule', + 'EffectiveBaseSecurityAdminRule', + 'EffectiveConnectivityConfiguration', + 'EffectiveDefaultSecurityAdminRule', + 'EffectiveSecurityAdminRule', 'EffectiveVirtualNetwork', 'EffectiveVirtualNetworksListResult', 'EffectiveVirtualNetworksParameter', - 'Error', - 'ErrorDetails', - 'ExtendedLocation', - 'FailedImport', 'GroupMembersItem', - 'ManagedServiceIdentity', 'NetworkGroup', 'NetworkGroupListResult', 'NetworkManager', @@ -156,45 +188,45 @@ 'NetworkManagerDeploymentStatus', 'NetworkManagerDeploymentStatusListResult', 'NetworkManagerDeploymentStatusParameter', - 'NetworkManagerEffectiveConfigurationListResult', + 'NetworkManagerEffectiveConnectivityConfigurationListResult', + 'NetworkManagerEffectiveSecurityAdminRulesListResult', 'NetworkManagerListResult', 'NetworkManagerPropertiesNetworkManagerScopes', - 'NetworkManagerSecurityConfigurationImport', 'NetworkManagerSecurityGroupItem', - 'NetworkSecurityGroupImport', + 'NetworkSecurityPerimeter', + 'NetworkSecurityPerimeterListResult', + 'PerimeterAssociableResource', + 'PerimeterAssociableResourcesListResult', 'ProxyResource', + 'QueryRequestOptions', 'Resource', + 'RuleCollection', + 'RuleCollectionListResult', 'SecurityConfiguration', - 'SecurityConfigurationImportResult', 'SecurityConfigurationListResult', - 'SecurityConfigurationRule', - 'SecurityConfigurationRuleListResult', - 'SubResource', 'SystemData', 'TagsObject', 'UserRule', 'UserRuleListResult', - 'Access', 'AddressPrefixType', - 'AuthenticationMethod', - 'CommitType', - 'ConfigType', + 'AdminRuleKind', + 'ConfigurationType', 'ConnectivityTopology', 'CreatedByType', + 'DeleteExistingNSGs', + 'DeleteExistingPeering', 'DeploymentStatus', - 'DeploymentType', - 'ExtendedLocationTypes', + 'EffectiveAdminRuleKind', + 'EffectiveUserRuleKind', 'GroupConnectivity', - 'IPAllocationMethod', - 'IPVersion', + 'IsGlobal', 'MemberType', 'MembershipType', - 'NetworkOperationStatus', 'ProvisioningState', - 'ResourceIdentityType', - 'ScopeAccesses', 'SecurityConfigurationRuleAccess', 'SecurityConfigurationRuleDirection', 'SecurityConfigurationRuleProtocol', 'SecurityType', + 'UseHubGateway', + 'UserRuleKind', ] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py index 4bb41d3f105..82c90a284bd 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py @@ -9,70 +9,293 @@ import msrest.serialization -class EffectiveConfiguration(msrest.serialization.Model): - """The network manager effective configuration. - - :param config_type: Effective configuration. Possible values include: "AdminPolicy", - "UserPolicy", "Connectivity". - :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType - :param connectivity_configuration: Connectivity configuration object. - :type connectivity_configuration: - ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration - :param security_admin_rule: Security admin rule object. - :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule - :param security_user_rule: Security user rule object. - :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule +class ActiveBaseSecurityAdminRule(msrest.serialization.Model): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ActiveSecurityAdminRule, ActiveDefaultSecurityAdminRule. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Custom': 'ActiveSecurityAdminRule', 'Default': 'ActiveDefaultSecurityAdminRule'} + } + + def __init__( + self, + **kwargs + ): + super(ActiveBaseSecurityAdminRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.commit_time = kwargs.get('commit_time', None) + self.region = kwargs.get('region', None) + self.configuration_display_name = kwargs.get('configuration_display_name', None) + self.configuration_description = kwargs.get('configuration_description', None) + self.rule_collection_display_name = kwargs.get('rule_collection_display_name', None) + self.rule_collection_description = kwargs.get('rule_collection_description', None) + self.rule_collection_applies_to_groups = kwargs.get('rule_collection_applies_to_groups', None) + self.rule_groups = kwargs.get('rule_groups', None) + self.kind = None # type: Optional[str] + + +class ActiveBaseSecurityUserRule(msrest.serialization.Model): + """Network base rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ActiveSecurityUserRule, ActiveDefaultSecurityUserRule. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security user configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security user configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Custom': 'ActiveSecurityUserRule', 'Default': 'ActiveDefaultSecurityUserRule'} + } + + def __init__( + self, + **kwargs + ): + super(ActiveBaseSecurityUserRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.commit_time = kwargs.get('commit_time', None) + self.region = kwargs.get('region', None) + self.configuration_display_name = kwargs.get('configuration_display_name', None) + self.configuration_description = kwargs.get('configuration_description', None) + self.rule_collection_display_name = kwargs.get('rule_collection_display_name', None) + self.rule_collection_description = kwargs.get('rule_collection_description', None) + self.rule_collection_applies_to_groups = kwargs.get('rule_collection_applies_to_groups', None) + self.rule_groups = kwargs.get('rule_groups', None) + self.kind = None # type: Optional[str] + + +class ActiveConfigurationParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. + + :param regions: List of regions. + :type regions: list[str] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'regions': {'key': 'regions', 'type': '[str]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveConfigurationParameter, self).__init__(**kwargs) + self.regions = kwargs.get('regions', None) + self.skip_token = kwargs.get('skip_token', None) + + +class EffectiveConnectivityConfiguration(msrest.serialization.Model): + """The network manager effective connectivity configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str :param configuration_groups: Effective configuration groups. - :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :type configuration_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param display_name: A friendly name for the resource. + :type display_name: str + :param description: A description of the connectivity configuration. + :type description: str + :param connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology + :param hub_id: The hub vnet Id. + :type hub_id: str + :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :type delete_existing_peering: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'config_type': {'key': 'configType', 'type': 'str'}, - 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, - 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, - 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, - 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[ConfigurationGroup]'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, + 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, } def __init__( self, **kwargs ): - super(EffectiveConfiguration, self).__init__(**kwargs) - self.config_type = kwargs.get('config_type', None) - self.connectivity_configuration = kwargs.get('connectivity_configuration', None) - self.security_admin_rule = kwargs.get('security_admin_rule', None) - self.security_user_rule = kwargs.get('security_user_rule', None) + super(EffectiveConnectivityConfiguration, self).__init__(**kwargs) + self.id = kwargs.get('id', None) self.configuration_groups = kwargs.get('configuration_groups', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.connectivity_topology = kwargs.get('connectivity_topology', None) + self.hub_id = kwargs.get('hub_id', None) + self.is_global = kwargs.get('is_global', None) + self.applies_to_groups = kwargs.get('applies_to_groups', None) + self.provisioning_state = None + self.delete_existing_peering = kwargs.get('delete_existing_peering', None) + +class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): + """Active connectivity configuration. -class ActiveConfiguration(EffectiveConfiguration): - """Active Configuration. + Variables are only populated by the server, and will be ignored when sending a request. - :param config_type: Effective configuration. Possible values include: "AdminPolicy", - "UserPolicy", "Connectivity". - :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType - :param connectivity_configuration: Connectivity configuration object. - :type connectivity_configuration: - ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration - :param security_admin_rule: Security admin rule object. - :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule - :param security_user_rule: Security user rule object. - :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param id: Resource ID. + :type id: str :param configuration_groups: Effective configuration groups. - :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :type configuration_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param display_name: A friendly name for the resource. + :type display_name: str + :param description: A description of the connectivity configuration. + :type description: str + :param connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology + :param hub_id: The hub vnet Id. + :type hub_id: str + :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :type delete_existing_peering: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering :param commit_time: Deployment time string. :type commit_time: ~datetime.datetime :param region: Deployment region. :type region: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'config_type': {'key': 'configType', 'type': 'str'}, - 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, - 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, - 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, - 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[ConfigurationGroup]'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, + 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, 'region': {'key': 'region', 'type': 'str'}, } @@ -81,32 +304,529 @@ def __init__( self, **kwargs ): - super(ActiveConfiguration, self).__init__(**kwargs) + super(ActiveConnectivityConfiguration, self).__init__(**kwargs) self.commit_time = kwargs.get('commit_time', None) self.region = kwargs.get('region', None) -class ActiveConfigurationListResult(msrest.serialization.Model): - """Result of the request to list active configurations. It contains a list of active configurations and a URL link to get the next set of results. +class ActiveConnectivityConfigurationsListResult(msrest.serialization.Model): + """Result of the request to list active connectivity configurations. It contains a list of active connectivity configurations and a skiptoken to get the next set of results. - :param value: Gets a page of active configurations. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.ActiveConfiguration] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :param value: Gets a page of active connectivity configurations. + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfiguration] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ActiveConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ActiveConnectivityConfiguration]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ActiveConfigurationListResult, self).__init__(**kwargs) + super(ActiveConnectivityConfigurationsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + self.skip_token = kwargs.get('skip_token', None) + + +class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): + """Network default admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :vartype access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'access': {'readonly': True}, + 'priority': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveDefaultSecurityAdminRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = kwargs.get('flag', None) + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None + + +class ActiveDefaultSecurityUserRule(ActiveBaseSecurityUserRule): + """Network security default user rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security user configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security user configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveDefaultSecurityUserRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = kwargs.get('flag', None) + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.direction = None + self.provisioning_state = None + + +class ActiveSecurityAdminRule(ActiveBaseSecurityAdminRule): + """Network admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. Restricted to 140 chars. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :type access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :type priority: int + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'priority': {'maximum': 4096, 'minimum': 1}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveSecurityAdminRule, self).__init__(**kwargs) + self.kind = 'Custom' # type: str + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.protocol = kwargs.get('protocol', None) + self.sources = kwargs.get('sources', None) + self.destinations = kwargs.get('destinations', None) + self.source_port_ranges = kwargs.get('source_port_ranges', None) + self.destination_port_ranges = kwargs.get('destination_port_ranges', None) + self.access = kwargs.get('access', None) + self.priority = kwargs.get('priority', None) + self.direction = kwargs.get('direction', None) + self.provisioning_state = None + + +class ActiveSecurityAdminRulesListResult(msrest.serialization.Model): + """Result of the request to list active security admin rules. It contains a list of active security admin rules and a skiptoken to get the next set of results. + + :param value: Gets a page of active security admin rules. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityAdminRule] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActiveBaseSecurityAdminRule]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveSecurityAdminRulesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.skip_token = kwargs.get('skip_token', None) + + +class ActiveSecurityUserRule(ActiveBaseSecurityUserRule): + """Network security user rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security user configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security user configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveSecurityUserRule, self).__init__(**kwargs) + self.kind = 'Custom' # type: str + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.protocol = kwargs.get('protocol', None) + self.sources = kwargs.get('sources', None) + self.destinations = kwargs.get('destinations', None) + self.source_port_ranges = kwargs.get('source_port_ranges', None) + self.destination_port_ranges = kwargs.get('destination_port_ranges', None) + self.direction = kwargs.get('direction', None) + self.provisioning_state = None + + +class ActiveSecurityUserRulesListResult(msrest.serialization.Model): + """Result of the request to list active security user rules. It contains a list of active security user rules and a skiptoken to get the next set of results. + + :param value: Gets a page of active security user rules. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityUserRule] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActiveBaseSecurityUserRule]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveSecurityUserRulesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.skip_token = kwargs.get('skip_token', None) class AddressPrefixItem(msrest.serialization.Model): @@ -116,7 +836,8 @@ class AddressPrefixItem(msrest.serialization.Model): :type address_prefix: str :param address_prefix_type: Address prefix type. Possible values include: "IPPrefix", "ServiceTag". - :type address_prefix_type: str or ~azure.mgmt.network.v2021_02_preview.models.AddressPrefixType + :type address_prefix_type: str or + ~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixType """ _attribute_map = { @@ -173,11 +894,69 @@ def __init__( self.etag = None -class AdminRule(ProxyResource): +class BaseAdminRule(ProxyResource): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AdminRule, DefaultAdminRule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + _subtype_map = { + 'kind': {'Custom': 'AdminRule', 'Default': 'DefaultAdminRule'} + } + + def __init__( + self, + **kwargs + ): + super(BaseAdminRule, self).__init__(**kwargs) + self.kind = 'BaseAdminRule' # type: str + self.system_data = None + + +class AdminRule(BaseAdminRule): """Network admin rule. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Resource ID. :vartype id: str :ivar name: Resource name. @@ -186,20 +965,23 @@ class AdminRule(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the rule. :type display_name: str - :param description: A description for this rule. + :param description: A description for this rule. Restricted to 140 chars. :type description: str :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :type protocol: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol - :param source: The CIDR or source IP ranges. - :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] - :param destination: The destination address prefixes. CIDR or destination IP ranges. - :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] :param source_port_ranges: The source port ranges. :type source_port_ranges: list[str] :param destination_port_ranges: The destination port ranges. @@ -207,7 +989,7 @@ class AdminRule(ProxyResource): :param access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". :type access: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleAccess + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess :param priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. @@ -215,14 +997,11 @@ class AdminRule(ProxyResource): :param direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :type direction: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security Configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -230,7 +1009,9 @@ class AdminRule(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'kind': {'required': True}, 'system_data': {'readonly': True}, + 'priority': {'maximum': 4096, 'minimum': 1}, 'provisioning_state': {'readonly': True}, } @@ -239,19 +1020,19 @@ class AdminRule(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, - 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, 'access': {'key': 'properties.access', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'direction': {'key': 'properties.direction', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, } def __init__( @@ -259,32 +1040,31 @@ def __init__( **kwargs ): super(AdminRule, self).__init__(**kwargs) - self.system_data = None + self.kind = 'Custom' # type: str self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) self.protocol = kwargs.get('protocol', None) - self.source = kwargs.get('source', None) - self.destination = kwargs.get('destination', None) + self.sources = kwargs.get('sources', None) + self.destinations = kwargs.get('destinations', None) self.source_port_ranges = kwargs.get('source_port_ranges', None) self.destination_port_ranges = kwargs.get('destination_port_ranges', None) self.access = kwargs.get('access', None) self.priority = kwargs.get('priority', None) self.direction = kwargs.get('direction', None) self.provisioning_state = None - self.applies_to_groups = kwargs.get('applies_to_groups', None) class AdminRuleListResult(msrest.serialization.Model): - """Security configuration admin rule list result. + """security configuration admin rule list result. :param value: A list of admin rules. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.AdminRule] - :param next_link: Gets the URL to get the next set of results. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule] + :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[AdminRule]'}, + 'value': {'key': 'value', 'type': '[BaseAdminRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -297,28 +1077,60 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class AzureAsyncOperationResult(msrest.serialization.Model): - """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. +class BaseUserRule(ProxyResource): + """Network base rule. - :param status: Status of the Azure async operation. Possible values include: "InProgress", - "Succeeded", "Failed". - :type status: str or ~azure.mgmt.network.v2021_02_preview.models.NetworkOperationStatus - :param error: Details of the error occurred during specified asynchronous operation. - :type error: ~azure.mgmt.network.v2021_02_preview.models.Error + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: UserRule, DefaultUserRule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + } + _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + _subtype_map = { + 'kind': {'Custom': 'UserRule', 'Default': 'DefaultUserRule'} } def __init__( self, **kwargs ): - super(AzureAsyncOperationResult, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.error = kwargs.get('error', None) + super(BaseUserRule, self).__init__(**kwargs) + self.kind = 'BaseUserRule' # type: str + self.system_data = None class CloudErrorBody(msrest.serialization.Model): @@ -334,7 +1146,7 @@ class CloudErrorBody(msrest.serialization.Model): error. :type target: str :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.network.v2021_02_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.network.v2021_02_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -355,34 +1167,55 @@ def __init__( self.details = kwargs.get('details', None) -class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): - """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. +class ConfigurationGroup(msrest.serialization.Model): + """The network configuration group resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str + :param id: Resource ID. + :type id: str + :param display_name: A friendly name for the network group. + :type display_name: str + :param description: A description of the network group. + :type description: str + :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". + :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType + :param group_members: Group members of network group. + :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] + :param conditional_membership: Network group conditional filter. + :type conditional_membership: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'member_type': {'key': 'properties.memberType', 'type': 'str'}, + 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, + 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None + super(ConfigurationGroup, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.member_type = kwargs.get('member_type', None) + self.group_members = kwargs.get('group_members', None) + self.conditional_membership = kwargs.get('conditional_membership', None) + self.provisioning_state = None class ConnectivityConfiguration(ProxyResource): @@ -399,28 +1232,30 @@ class ConnectivityConfiguration(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the resource. :type display_name: str :param description: A description of the connectivity configuration. :type description: str :param connectivity_topology: Connectivity topology type. Possible values include: - "HubAndSpokeTopology", "MeshTopology". + "HubAndSpoke", "Mesh". :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_preview.models.ConnectivityTopology + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology :param hub_id: The hub vnet Id. :type hub_id: str - :param is_global: Flag if global mesh is supported. - :type is_global: bool + :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityGroupItem] + list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] :ivar provisioning_state: The provisioning state of the connectivity configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. - :type delete_existing_peering: bool + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :type delete_existing_peering: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering """ _validation = { @@ -442,10 +1277,10 @@ class ConnectivityConfiguration(ProxyResource): 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, - 'is_global': {'key': 'properties.isGlobal', 'type': 'bool'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'bool'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, } def __init__( @@ -468,7 +1303,7 @@ class ConnectivityConfigurationListResult(msrest.serialization.Model): """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. :param value: Gets a page of Connectivity Configurations. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration] + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration] :param next_link: Gets the URL to get the next page of results. :type next_link: str """ @@ -492,19 +1327,21 @@ class ConnectivityGroupItem(msrest.serialization.Model): :param network_group_id: Network group Id. :type network_group_id: str - :param use_hub_gateway: Flag if need to use hub gateway. - :type use_hub_gateway: bool - :param is_global: Flag if global is supported. - :type is_global: bool + :param use_hub_gateway: Flag if need to use hub gateway. Possible values include: "False", + "True". + :type use_hub_gateway: str or ~azure.mgmt.network.v2021_02_01_preview.models.UseHubGateway + :param is_global: Flag if global is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param group_connectivity: Group connectivity type. Possible values include: "None", "DirectlyConnected". - :type group_connectivity: str or ~azure.mgmt.network.v2021_02_preview.models.GroupConnectivity + :type group_connectivity: str or + ~azure.mgmt.network.v2021_02_01_preview.models.GroupConnectivity """ _attribute_map = { 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, - 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'bool'}, - 'is_global': {'key': 'isGlobal', 'type': 'bool'}, + 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'str'}, + 'is_global': {'key': 'isGlobal', 'type': 'str'}, 'group_connectivity': {'key': 'groupConnectivity', 'type': 'str'}, } @@ -519,265 +1356,609 @@ def __init__( self.group_connectivity = kwargs.get('group_connectivity', None) -class EffectiveVirtualNetwork(msrest.serialization.Model): - """Effective Virtual Network. +class DefaultAdminRule(BaseAdminRule): + """Network default admin rule. - :param id: Effective vnet Id. - :type id: str - :param location: Location of vnet. - :type location: str - :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". - :type membership_type: str or ~azure.mgmt.network.v2021_02_preview.models.MembershipType + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :vartype access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'access': {'readonly': True}, + 'priority': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'membership_type': {'key': 'membershipType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(EffectiveVirtualNetwork, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.location = kwargs.get('location', None) - self.membership_type = kwargs.get('membership_type', None) + super(DefaultAdminRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = kwargs.get('flag', None) + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None -class EffectiveVirtualNetworksListResult(msrest.serialization.Model): - """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. +class DefaultUserRule(BaseUserRule): + """Network security default user rule. - :param value: Gets a page of EffectiveVirtualNetwork. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetwork] - :param total_records: Total Records. - :type total_records: int - :param first_index: First Index. - :type first_index: int - :param page_size: Page Size. - :type page_size: int - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, - 'total_records': {'key': 'totalRecords', 'type': 'int'}, - 'first_index': {'key': 'firstIndex', 'type': 'int'}, - 'page_size': {'key': 'pageSize', 'type': 'int'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.total_records = kwargs.get('total_records', None) - self.first_index = kwargs.get('first_index', None) - self.page_size = kwargs.get('page_size', None) - self.next_link = kwargs.get('next_link', None) + super(DefaultUserRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = kwargs.get('flag', None) + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.direction = None + self.provisioning_state = None -class EffectiveVirtualNetworksParameter(msrest.serialization.Model): - """Effective Virtual Networks Parameter. +class EffectiveBaseSecurityAdminRule(msrest.serialization.Model): + """Network base admin rule. - :param conditional_members: Conditional Members. - :type conditional_members: str + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: EffectiveSecurityAdminRule, EffectiveDefaultSecurityAdminRule. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind """ + _validation = { + 'kind': {'required': True}, + } + _attribute_map = { - 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Custom': 'EffectiveSecurityAdminRule', 'Default': 'EffectiveDefaultSecurityAdminRule'} } def __init__( self, **kwargs ): - super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) - self.conditional_members = kwargs.get('conditional_members', None) + super(EffectiveBaseSecurityAdminRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.configuration_display_name = kwargs.get('configuration_display_name', None) + self.configuration_description = kwargs.get('configuration_description', None) + self.rule_collection_display_name = kwargs.get('rule_collection_display_name', None) + self.rule_collection_description = kwargs.get('rule_collection_description', None) + self.rule_collection_applies_to_groups = kwargs.get('rule_collection_applies_to_groups', None) + self.rule_groups = kwargs.get('rule_groups', None) + self.kind = None # type: Optional[str] -class Error(msrest.serialization.Model): - """Common error representation. +class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """Network default admin rule. - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param target: Error target. - :type target: str - :param details: Error details. - :type details: list[~azure.mgmt.network.v2021_02_preview.models.ErrorDetails] - :param inner_error: Inner error message. - :type inner_error: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :vartype access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'kind': {'required': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'access': {'readonly': True}, + 'priority': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, - 'inner_error': {'key': 'innerError', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(Error, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - self.inner_error = kwargs.get('inner_error', None) + super(EffectiveDefaultSecurityAdminRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = kwargs.get('flag', None) + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None -class ErrorDetails(msrest.serialization.Model): - """Common error details representation. +class EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """Network admin rule. - :param code: Error code. - :type code: str - :param target: Error target. - :type target: str - :param message: Error message. - :type message: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. Restricted to 140 chars. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :type access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :type priority: int + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'kind': {'required': True}, + 'priority': {'maximum': 4096, 'minimum': 1}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ErrorDetails, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - + super(EffectiveSecurityAdminRule, self).__init__(**kwargs) + self.kind = 'Custom' # type: str + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.protocol = kwargs.get('protocol', None) + self.sources = kwargs.get('sources', None) + self.destinations = kwargs.get('destinations', None) + self.source_port_ranges = kwargs.get('source_port_ranges', None) + self.destination_port_ranges = kwargs.get('destination_port_ranges', None) + self.access = kwargs.get('access', None) + self.priority = kwargs.get('priority', None) + self.direction = kwargs.get('direction', None) + self.provisioning_state = None -class ExtendedLocation(msrest.serialization.Model): - """ExtendedLocation complex type. - All required parameters must be populated in order to send to Azure. +class EffectiveVirtualNetwork(msrest.serialization.Model): + """Effective Virtual Network. - :param name: Required. The name of the extended location. - :type name: str - :param type: Required. The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ExtendedLocationTypes + :param id: Effective vnet Id. + :type id: str + :param location: Location of vnet. + :type location: str + :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". + :type membership_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MembershipType """ - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'membership_type': {'key': 'membershipType', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] + super(EffectiveVirtualNetwork, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.location = kwargs.get('location', None) + self.membership_type = kwargs.get('membership_type', None) -class FailedImport(msrest.serialization.Model): - """Failed imports object. +class EffectiveVirtualNetworksListResult(msrest.serialization.Model): + """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. - :param failure_code: Failure code. - :type failure_code: str - :param failure_reason: Failure reason. - :type failure_reason: str + :param value: Gets a page of EffectiveVirtualNetwork. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetwork] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'failure_code': {'key': 'failureCode', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, **kwargs ): - super(FailedImport, self).__init__(**kwargs) - self.failure_code = kwargs.get('failure_code', None) - self.failure_reason = kwargs.get('failure_reason', None) + super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.skip_token = kwargs.get('skip_token', None) -class GroupMembersItem(msrest.serialization.Model): - """GroupMembers Item. +class EffectiveVirtualNetworksParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. - :param resource_id: Resource Id. - :type resource_id: str + :param conditional_members: Conditional Members. + :type conditional_members: str + :param skip_token: Continuation token for pagination, capturing the next page size and offset, + as well as the context of the query. + :type skip_token: str """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, **kwargs ): - super(GroupMembersItem, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - + super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) + self.conditional_members = kwargs.get('conditional_members', None) + self.skip_token = kwargs.get('skip_token', None) -class ManagedServiceIdentity(msrest.serialization.Model): - """Identity for the resource. - Variables are only populated by the server, and will be ignored when sending a request. +class GroupMembersItem(msrest.serialization.Model): + """GroupMembers Item. - :ivar principal_id: The principal id of the system assigned identity. This property will only - be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :param type: The type of identity used for the resource. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of user assigned - identities. The type 'None' will remove any identities from the virtual machine. Possible - values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with resource. The user - identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.network.v2021_02_preview.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + :param vnet_id: Vnet Id. + :type vnet_id: str + :param subnet_id: Subnet Id. + :type subnet_id: str """ - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + 'vnet_id': {'key': 'vnetId', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + super(GroupMembersItem, self).__init__(**kwargs) + self.vnet_id = kwargs.get('vnet_id', None) + self.subnet_id = kwargs.get('subnet_id', None) class NetworkGroup(ProxyResource): @@ -794,21 +1975,21 @@ class NetworkGroup(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the network group. :type display_name: str :param description: A description of the network group. :type description: str :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". - :type member_type: str or ~azure.mgmt.network.v2021_02_preview.models.MemberType + :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType :param group_members: Group members of network group. - :type group_members: list[~azure.mgmt.network.v2021_02_preview.models.GroupMembersItem] + :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] :param conditional_membership: Network group conditional filter. :type conditional_membership: str :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -852,7 +2033,7 @@ class NetworkGroupListResult(msrest.serialization.Model): """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. :param value: Gets a page of NetworkGroup. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup] :param next_link: Gets the URL to get the next set of results. :type next_link: str """ @@ -931,21 +2112,21 @@ class NetworkManager(Resource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the network manager. :type display_name: str :param description: A description of the network manager. :type description: str :param network_manager_scopes: Scope of Network Manager. :type network_manager_scopes: - ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerPropertiesNetworkManagerScopes + ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes :param network_manager_scope_accesses: Scope Access. :type network_manager_scope_accesses: list[str or - ~azure.mgmt.network.v2021_02_preview.models.ScopeAccesses] + ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -988,16 +2169,25 @@ def __init__( class NetworkManagerCommit(msrest.serialization.Model): """Network Manager Commit. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar commit_id: Commit Id. + :vartype commit_id: str :param target_locations: List of target locations. :type target_locations: list[str] :param configuration_ids: List of configuration ids. :type configuration_ids: list[str] - :param commit_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy", - "Routing", "Connectivity". - :type commit_type: str or ~azure.mgmt.network.v2021_02_preview.models.CommitType + :param commit_type: Commit Type. Possible values include: "SecurityAdmin", "SecurityUser", + "Connectivity". + :type commit_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType """ + _validation = { + 'commit_id': {'readonly': True}, + } + _attribute_map = { + 'commit_id': {'key': 'commitId', 'type': 'str'}, 'target_locations': {'key': 'targetLocations', 'type': '[str]'}, 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, 'commit_type': {'key': 'commitType', 'type': 'str'}, @@ -1008,6 +2198,7 @@ def __init__( **kwargs ): super(NetworkManagerCommit, self).__init__(**kwargs) + self.commit_id = None self.target_locations = kwargs.get('target_locations', None) self.configuration_ids = kwargs.get('configuration_ids', None) self.commit_type = kwargs.get('commit_type', None) @@ -1022,12 +2213,12 @@ class NetworkManagerDeploymentStatus(msrest.serialization.Model): :type region: str :param deployment_status: Deployment Status. Possible values include: "NotStarted", "Deploying", "Deployed", "Failed". - :type deployment_status: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentStatus + :type deployment_status: str or ~azure.mgmt.network.v2021_02_01_preview.models.DeploymentStatus :param configuration_ids: List of configuration ids. :type configuration_ids: list[str] - :param deployment_type: Configuration Deployment Type. Possible values include: "AdminPolicy", - "UserPolicy", "Routing", "Connectivity". - :type deployment_type: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType + :param deployment_type: Configuration Deployment Type. Possible values include: + "SecurityAdmin", "SecurityUser", "Connectivity". + :type deployment_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType :param error_message: Error Message. :type error_message: str """ @@ -1058,14 +2249,16 @@ class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): """A list of Network Manager Deployment Status. :param value: Gets a page of Network Manager Deployment Status. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatus] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatus] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( @@ -1074,7 +2267,7 @@ def __init__( ): super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + self.skip_token = kwargs.get('skip_token', None) class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): @@ -1082,13 +2275,18 @@ class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): :param regions: List of locations. :type regions: list[str] - :param deployment_types: List of configurations' deployment types. - :type deployment_types: list[str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType] + :param deployment_types: List of deployment types. + :type deployment_types: list[str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] + :param skip_token: Continuation token for pagination, capturing the next page size and offset, + as well as the context of the query. + :type skip_token: str """ _attribute_map = { 'regions': {'key': 'regions', 'type': '[str]'}, 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( @@ -1098,36 +2296,64 @@ def __init__( super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) self.regions = kwargs.get('regions', None) self.deployment_types = kwargs.get('deployment_types', None) + self.skip_token = kwargs.get('skip_token', None) -class NetworkManagerEffectiveConfigurationListResult(msrest.serialization.Model): - """Result of the request to list networkManagerEffectiveConfiguration. It contains a list of groups and a URL link to get the next set of results. +class NetworkManagerEffectiveConnectivityConfigurationListResult(msrest.serialization.Model): + """Result of the request to list networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken to get the next set of results. - :param value: Gets a page of NetworkManagerEffectiveConfiguration. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveConfiguration] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :param value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveConnectivityConfiguration] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[EffectiveConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, **kwargs ): - super(NetworkManagerEffectiveConfigurationListResult, self).__init__(**kwargs) + super(NetworkManagerEffectiveConnectivityConfigurationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + self.skip_token = kwargs.get('skip_token', None) + + +class NetworkManagerEffectiveSecurityAdminRulesListResult(msrest.serialization.Model): + """Result of the request to list networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to get the next set of results. + + :param value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveBaseSecurityAdminRule] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EffectiveBaseSecurityAdminRule]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerEffectiveSecurityAdminRulesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.skip_token = kwargs.get('skip_token', None) class NetworkManagerListResult(msrest.serialization.Model): """Result of the request to list NetworkManager. It contains a list of network managers and a URL link to get the next set of results. :param value: Gets a page of NetworkManager. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManager] + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager] :param next_link: Gets the URL to get the next page of results. :type next_link: str """ @@ -1169,52 +2395,6 @@ def __init__( self.subscriptions = kwargs.get('subscriptions', None) -class NetworkManagerSecurityConfigurationImport(msrest.serialization.Model): - """Network manager security configuration import parameters. - - :param network_security_group_imports: List of nsg uris. - :type network_security_group_imports: - list[~azure.mgmt.network.v2021_02_preview.models.NetworkSecurityGroupImport] - :param import_deny_rules_as_admin_rules: Flag if import deny rules as admin rules. - :type import_deny_rules_as_admin_rules: bool - :param admin_security_configuration_uri: Admin security configuration Uri. - :type admin_security_configuration_uri: str - :param remove_allow_vnet_inbound_rule: Flag if need to remove allow vnet inbound rule. - :type remove_allow_vnet_inbound_rule: bool - :param remove_allow_azure_load_balancer_inbound_rule: Flag if need to remove allow azure load - balancer inbound rule. - :type remove_allow_azure_load_balancer_inbound_rule: bool - :param remove_allow_vnet_outbound_rule: Flag if need to remove allow vnet outbound rule. - :type remove_allow_vnet_outbound_rule: bool - :param remove_allow_internet_outbound_rule: Flag if need to remove allow Internet outbound - rule. - :type remove_allow_internet_outbound_rule: bool - """ - - _attribute_map = { - 'network_security_group_imports': {'key': 'networkSecurityGroupImports', 'type': '[NetworkSecurityGroupImport]'}, - 'import_deny_rules_as_admin_rules': {'key': 'importDenyRulesAsAdminRules', 'type': 'bool'}, - 'admin_security_configuration_uri': {'key': 'adminSecurityConfigurationUri', 'type': 'str'}, - 'remove_allow_vnet_inbound_rule': {'key': 'removeAllowVnetInboundRule', 'type': 'bool'}, - 'remove_allow_azure_load_balancer_inbound_rule': {'key': 'removeAllowAzureLoadBalancerInboundRule', 'type': 'bool'}, - 'remove_allow_vnet_outbound_rule': {'key': 'removeAllowVnetOutboundRule', 'type': 'bool'}, - 'remove_allow_internet_outbound_rule': {'key': 'removeAllowInternetOutboundRule', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerSecurityConfigurationImport, self).__init__(**kwargs) - self.network_security_group_imports = kwargs.get('network_security_group_imports', None) - self.import_deny_rules_as_admin_rules = kwargs.get('import_deny_rules_as_admin_rules', None) - self.admin_security_configuration_uri = kwargs.get('admin_security_configuration_uri', None) - self.remove_allow_vnet_inbound_rule = kwargs.get('remove_allow_vnet_inbound_rule', None) - self.remove_allow_azure_load_balancer_inbound_rule = kwargs.get('remove_allow_azure_load_balancer_inbound_rule', None) - self.remove_allow_vnet_outbound_rule = kwargs.get('remove_allow_vnet_outbound_rule', None) - self.remove_allow_internet_outbound_rule = kwargs.get('remove_allow_internet_outbound_rule', None) - - class NetworkManagerSecurityGroupItem(msrest.serialization.Model): """Network manager security group item. @@ -1234,63 +2414,37 @@ def __init__( self.network_group_id = kwargs.get('network_group_id', None) -class NetworkSecurityGroupImport(msrest.serialization.Model): - """Network Security Group Import. - - :param network_security_group_uri: Network Security Group Uri. - :type network_security_group_uri: str - """ - - _attribute_map = { - 'network_security_group_uri': {'key': 'networkSecurityGroupUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSecurityGroupImport, self).__init__(**kwargs) - self.network_security_group_uri = kwargs.get('network_security_group_uri', None) - - -class SecurityConfiguration(ProxyResource): - """Defines the security Configuration. +class NetworkSecurityPerimeter(Resource): + """The Network Security Perimeter resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. - :vartype id: str + :param id: Resource ID. + :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData - :param display_name: A display name of the security Configuration. + :param display_name: A friendly name for the network security perimeter. :type display_name: str - :param description: A description of the security Configuration. + :param description: A description of the network security perimeter. :type description: str - :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". - :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType - :param delete_existing_ns_gs: Flag if need to delete existing network security groups. - :type delete_existing_ns_gs: bool - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { - 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -1298,13 +2452,11 @@ class SecurityConfiguration(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'security_type': {'key': 'properties.securityType', 'type': 'str'}, - 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'bool'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -1312,54 +2464,99 @@ def __init__( self, **kwargs ): - super(SecurityConfiguration, self).__init__(**kwargs) - self.system_data = None + super(NetworkSecurityPerimeter, self).__init__(**kwargs) + self.etag = None self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) - self.security_type = kwargs.get('security_type', None) - self.delete_existing_ns_gs = kwargs.get('delete_existing_ns_gs', None) - self.applies_to_groups = kwargs.get('applies_to_groups', None) self.provisioning_state = None -class SecurityConfigurationImportResult(msrest.serialization.Model): - """Security configuration import Result. +class NetworkSecurityPerimeterListResult(msrest.serialization.Model): + """Result of the request to list NetworkSecurityPerimeter. It contains a list of network security perimeters and a URL link to get the next set of results. - :param user_security_configuration: User security configuration Id. - :type user_security_configuration: str - :param admin_security_configuration: Admin security configuration Id. - :type admin_security_configuration: str - :param failed_import: failed imports code and reason. - :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + :param value: Gets a page of NetworkSecurityPerimeter. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str """ _attribute_map = { - 'user_security_configuration': {'key': 'userSecurityConfiguration', 'type': 'str'}, - 'admin_security_configuration': {'key': 'adminSecurityConfiguration', 'type': 'str'}, - 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + 'value': {'key': 'value', 'type': '[NetworkSecurityPerimeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(SecurityConfigurationImportResult, self).__init__(**kwargs) - self.user_security_configuration = kwargs.get('user_security_configuration', None) - self.admin_security_configuration = kwargs.get('admin_security_configuration', None) - self.failed_import = kwargs.get('failed_import', None) + super(NetworkSecurityPerimeterListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class SecurityConfigurationListResult(msrest.serialization.Model): - """A list of managed network security configurations. +class PerimeterAssociableResource(Resource): + """Resource that is onboarded to use network security perimeter. Also referred as perimeter associable resource. - :param value: Gets a page of security configurations. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration] + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar display_name: A friendly name for the properties of perimeter associable resources. + :vartype display_name: str + :ivar resource_type: Resource type/provider name. + :vartype resource_type: str + :ivar public_dns_zones: Public DNS zone names of the resources. + :vartype public_dns_zones: list[str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'public_dns_zones': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'public_dns_zones': {'key': 'properties.publicDnsZones', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PerimeterAssociableResource, self).__init__(**kwargs) + self.display_name = None + self.resource_type = None + self.public_dns_zones = None + + +class PerimeterAssociableResourcesListResult(msrest.serialization.Model): + """Paged list of perimeter associable resources. + + :param value: Gets paged list of perimeter associable resources. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResource] :param next_link: Gets the URL to get the next page of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'value': {'key': 'value', 'type': '[PerimeterAssociableResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -1367,52 +2564,103 @@ def __init__( self, **kwargs ): - super(SecurityConfigurationListResult, self).__init__(**kwargs) + super(PerimeterAssociableResourcesListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) -class SecurityConfigurationRule(msrest.serialization.Model): - """General security configuration Rule. +class QueryRequestOptions(msrest.serialization.Model): + """Query Request Options. - :param security_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy". - :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType - :param security_admin_rule: Security admin rule. - :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule - :param security_user_rule: Security user rule. - :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'security_type': {'key': 'securityType', 'type': 'str'}, - 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, - 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, **kwargs ): - super(SecurityConfigurationRule, self).__init__(**kwargs) - self.security_type = kwargs.get('security_type', None) - self.security_admin_rule = kwargs.get('security_admin_rule', None) - self.security_user_rule = kwargs.get('security_user_rule', None) + super(QueryRequestOptions, self).__init__(**kwargs) + self.skip_token = kwargs.get('skip_token', None) + + +class RuleCollection(ProxyResource): + """Defines the rule collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :param display_name: A display name of the rule collection. + :type display_name: str + :param description: A description of the rule collection. + :type description: str + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleCollection, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.applies_to_groups = kwargs.get('applies_to_groups', None) + self.provisioning_state = None -class SecurityConfigurationRuleListResult(msrest.serialization.Model): - """Security configuration rule list result. +class RuleCollectionListResult(msrest.serialization.Model): + """Security configuration rule collection list result. - :param value: A list of network manager security configuration rules. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRule] - :param failed_import: Failed Imports. - :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + :param value: A list of network manager security configuration rule collections. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection] :param next_link: Gets the URL to get the next set of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityConfigurationRule]'}, - 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + 'value': {'key': 'value', 'type': '[RuleCollection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -1420,29 +2668,98 @@ def __init__( self, **kwargs ): - super(SecurityConfigurationRuleListResult, self).__init__(**kwargs) + super(RuleCollectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) - self.failed_import = kwargs.get('failed_import', None) self.next_link = kwargs.get('next_link', None) -class SubResource(msrest.serialization.Model): - """Reference to another subresource. +class SecurityConfiguration(ProxyResource): + """Defines the security configuration. - :param id: Resource ID. - :type id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :param display_name: A display name of the security configuration. + :type display_name: str + :param description: A description of the security configuration. + :type description: str + :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". + :type security_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.SecurityType + :param delete_existing_ns_gs: Flag if need to delete existing network security groups. Possible + values include: "False", "True". + :type delete_existing_ns_gs: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingNSGs + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'security_type': {'key': 'properties.securityType', 'type': 'str'}, + 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(SubResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + super(SecurityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.security_type = kwargs.get('security_type', None) + self.delete_existing_ns_gs = kwargs.get('delete_existing_ns_gs', None) + self.provisioning_state = None + + +class SecurityConfigurationListResult(msrest.serialization.Model): + """A list of network manager security configurations. + + :param value: Gets a page of security configurations. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) class SystemData(msrest.serialization.Model): @@ -1452,14 +2769,15 @@ class SystemData(msrest.serialization.Model): :type created_by: str :param created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :type created_by_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType :param created_at: The timestamp of resource creation (UTC). :type created_at: ~datetime.datetime :param last_modified_by: The identity that last modified the resource. :type last_modified_by: str :param last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :type last_modified_by_type: str or + ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType :param last_modified_at: The type of identity that last modified the resource. :type last_modified_at: ~datetime.datetime """ @@ -1505,11 +2823,13 @@ def __init__( self.tags = kwargs.get('tags', None) -class UserRule(ProxyResource): - """Network security admin rule. +class UserRule(BaseUserRule): + """Network security user rule. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Resource ID. :vartype id: str :ivar name: Resource name. @@ -1518,20 +2838,23 @@ class UserRule(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the rule. :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. + :param description: A description for this rule. :type description: str :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :type protocol: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol - :param source: The CIDR or source IP ranges. - :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] - :param destination: The destination address prefixes. CIDR or destination IP ranges. - :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] :param source_port_ranges: The source port ranges. :type source_port_ranges: list[str] :param destination_port_ranges: The destination port ranges. @@ -1539,11 +2862,11 @@ class UserRule(ProxyResource): :param direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :type direction: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security Configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -1551,6 +2874,7 @@ class UserRule(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'kind': {'required': True}, 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -1560,12 +2884,13 @@ class UserRule(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, - 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, 'direction': {'key': 'properties.direction', 'type': 'str'}, @@ -1577,12 +2902,12 @@ def __init__( **kwargs ): super(UserRule, self).__init__(**kwargs) - self.system_data = None + self.kind = 'Custom' # type: str self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) self.protocol = kwargs.get('protocol', None) - self.source = kwargs.get('source', None) - self.destination = kwargs.get('destination', None) + self.sources = kwargs.get('sources', None) + self.destinations = kwargs.get('destinations', None) self.source_port_ranges = kwargs.get('source_port_ranges', None) self.destination_port_ranges = kwargs.get('destination_port_ranges', None) self.direction = kwargs.get('direction', None) @@ -1590,16 +2915,16 @@ def __init__( class UserRuleListResult(msrest.serialization.Model): - """Security configuration user rule list result. + """security user rule list result. :param value: A list of user rules. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.UserRule] - :param next_link: Gets the URL to get the next set of results. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule] + :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[UserRule]'}, + 'value': {'key': 'value', 'type': '[BaseUserRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py index 29b7cac92f1..bcd93163660 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py @@ -14,76 +14,326 @@ from ._network_management_client_enums import * -class EffectiveConfiguration(msrest.serialization.Model): - """The network manager effective configuration. - - :param config_type: Effective configuration. Possible values include: "AdminPolicy", - "UserPolicy", "Connectivity". - :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType - :param connectivity_configuration: Connectivity configuration object. - :type connectivity_configuration: - ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration - :param security_admin_rule: Security admin rule object. - :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule - :param security_user_rule: Security user rule object. - :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule +class ActiveBaseSecurityAdminRule(msrest.serialization.Model): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ActiveSecurityAdminRule, ActiveDefaultSecurityAdminRule. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Custom': 'ActiveSecurityAdminRule', 'Default': 'ActiveDefaultSecurityAdminRule'} + } + + def __init__( + self, + *, + id: Optional[str] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + **kwargs + ): + super(ActiveBaseSecurityAdminRule, self).__init__(**kwargs) + self.id = id + self.commit_time = commit_time + self.region = region + self.configuration_display_name = configuration_display_name + self.configuration_description = configuration_description + self.rule_collection_display_name = rule_collection_display_name + self.rule_collection_description = rule_collection_description + self.rule_collection_applies_to_groups = rule_collection_applies_to_groups + self.rule_groups = rule_groups + self.kind = None # type: Optional[str] + + +class ActiveBaseSecurityUserRule(msrest.serialization.Model): + """Network base rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ActiveSecurityUserRule, ActiveDefaultSecurityUserRule. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security user configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security user configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Custom': 'ActiveSecurityUserRule', 'Default': 'ActiveDefaultSecurityUserRule'} + } + + def __init__( + self, + *, + id: Optional[str] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + **kwargs + ): + super(ActiveBaseSecurityUserRule, self).__init__(**kwargs) + self.id = id + self.commit_time = commit_time + self.region = region + self.configuration_display_name = configuration_display_name + self.configuration_description = configuration_description + self.rule_collection_display_name = rule_collection_display_name + self.rule_collection_description = rule_collection_description + self.rule_collection_applies_to_groups = rule_collection_applies_to_groups + self.rule_groups = rule_groups + self.kind = None # type: Optional[str] + + +class ActiveConfigurationParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. + + :param regions: List of regions. + :type regions: list[str] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'regions': {'key': 'regions', 'type': '[str]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + regions: Optional[List[str]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(ActiveConfigurationParameter, self).__init__(**kwargs) + self.regions = regions + self.skip_token = skip_token + + +class EffectiveConnectivityConfiguration(msrest.serialization.Model): + """The network manager effective connectivity configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str :param configuration_groups: Effective configuration groups. - :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :type configuration_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param display_name: A friendly name for the resource. + :type display_name: str + :param description: A description of the connectivity configuration. + :type description: str + :param connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology + :param hub_id: The hub vnet Id. + :type hub_id: str + :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :type delete_existing_peering: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'config_type': {'key': 'configType', 'type': 'str'}, - 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, - 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, - 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, - 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[ConfigurationGroup]'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, + 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, } def __init__( self, *, - config_type: Optional[Union[str, "ConfigType"]] = None, - connectivity_configuration: Optional["ConnectivityConfiguration"] = None, - security_admin_rule: Optional["AdminRule"] = None, - security_user_rule: Optional["UserRule"] = None, - configuration_groups: Optional[List["NetworkGroup"]] = None, + id: Optional[str] = None, + configuration_groups: Optional[List["ConfigurationGroup"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, + hub_id: Optional[str] = None, + is_global: Optional[Union[str, "IsGlobal"]] = None, + applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, + delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, **kwargs ): - super(EffectiveConfiguration, self).__init__(**kwargs) - self.config_type = config_type - self.connectivity_configuration = connectivity_configuration - self.security_admin_rule = security_admin_rule - self.security_user_rule = security_user_rule + super(EffectiveConnectivityConfiguration, self).__init__(**kwargs) + self.id = id self.configuration_groups = configuration_groups + self.display_name = display_name + self.description = description + self.connectivity_topology = connectivity_topology + self.hub_id = hub_id + self.is_global = is_global + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + self.delete_existing_peering = delete_existing_peering -class ActiveConfiguration(EffectiveConfiguration): - """Active Configuration. +class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): + """Active connectivity configuration. + + Variables are only populated by the server, and will be ignored when sending a request. - :param config_type: Effective configuration. Possible values include: "AdminPolicy", - "UserPolicy", "Connectivity". - :type config_type: str or ~azure.mgmt.network.v2021_02_preview.models.ConfigType - :param connectivity_configuration: Connectivity configuration object. - :type connectivity_configuration: - ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration - :param security_admin_rule: Security admin rule object. - :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule - :param security_user_rule: Security user rule object. - :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param id: Resource ID. + :type id: str :param configuration_groups: Effective configuration groups. - :type configuration_groups: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :type configuration_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param display_name: A friendly name for the resource. + :type display_name: str + :param description: A description of the connectivity configuration. + :type description: str + :param connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology + :param hub_id: The hub vnet Id. + :type hub_id: str + :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :type delete_existing_peering: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering :param commit_time: Deployment time string. :type commit_time: ~datetime.datetime :param region: Deployment region. :type region: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'config_type': {'key': 'configType', 'type': 'str'}, - 'connectivity_configuration': {'key': 'connectivityConfiguration', 'type': 'ConnectivityConfiguration'}, - 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, - 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, - 'configuration_groups': {'key': 'configurationGroups', 'type': '[NetworkGroup]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_groups': {'key': 'configurationGroups', 'type': '[ConfigurationGroup]'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, + 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, 'region': {'key': 'region', 'type': 'str'}, } @@ -91,44 +341,611 @@ class ActiveConfiguration(EffectiveConfiguration): def __init__( self, *, - config_type: Optional[Union[str, "ConfigType"]] = None, - connectivity_configuration: Optional["ConnectivityConfiguration"] = None, - security_admin_rule: Optional["AdminRule"] = None, - security_user_rule: Optional["UserRule"] = None, - configuration_groups: Optional[List["NetworkGroup"]] = None, + id: Optional[str] = None, + configuration_groups: Optional[List["ConfigurationGroup"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, + hub_id: Optional[str] = None, + is_global: Optional[Union[str, "IsGlobal"]] = None, + applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, + delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, commit_time: Optional[datetime.datetime] = None, region: Optional[str] = None, **kwargs ): - super(ActiveConfiguration, self).__init__(config_type=config_type, connectivity_configuration=connectivity_configuration, security_admin_rule=security_admin_rule, security_user_rule=security_user_rule, configuration_groups=configuration_groups, **kwargs) + super(ActiveConnectivityConfiguration, self).__init__(id=id, configuration_groups=configuration_groups, display_name=display_name, description=description, connectivity_topology=connectivity_topology, hub_id=hub_id, is_global=is_global, applies_to_groups=applies_to_groups, delete_existing_peering=delete_existing_peering, **kwargs) self.commit_time = commit_time self.region = region -class ActiveConfigurationListResult(msrest.serialization.Model): - """Result of the request to list active configurations. It contains a list of active configurations and a URL link to get the next set of results. +class ActiveConnectivityConfigurationsListResult(msrest.serialization.Model): + """Result of the request to list active connectivity configurations. It contains a list of active connectivity configurations and a skiptoken to get the next set of results. - :param value: Gets a page of active configurations. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.ActiveConfiguration] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :param value: Gets a page of active connectivity configurations. + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfiguration] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ActiveConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ActiveConnectivityConfiguration]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["ActiveConfiguration"]] = None, - next_link: Optional[str] = None, + value: Optional[List["ActiveConnectivityConfiguration"]] = None, + skip_token: Optional[str] = None, **kwargs ): - super(ActiveConfigurationListResult, self).__init__(**kwargs) + super(ActiveConnectivityConfigurationsListResult, self).__init__(**kwargs) self.value = value - self.next_link = next_link + self.skip_token = skip_token + + +class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): + """Network default admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :vartype access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'access': {'readonly': True}, + 'priority': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + flag: Optional[str] = None, + **kwargs + ): + super(ActiveDefaultSecurityAdminRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None + + +class ActiveDefaultSecurityUserRule(ActiveBaseSecurityUserRule): + """Network security default user rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security user configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security user configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + flag: Optional[str] = None, + **kwargs + ): + super(ActiveDefaultSecurityUserRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.direction = None + self.provisioning_state = None + + +class ActiveSecurityAdminRule(ActiveBaseSecurityAdminRule): + """Network admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. Restricted to 140 chars. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :type access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :type priority: int + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'priority': {'maximum': 4096, 'minimum': 1}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, + sources: Optional[List["AddressPrefixItem"]] = None, + destinations: Optional[List["AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "SecurityConfigurationRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, + **kwargs + ): + super(ActiveSecurityAdminRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) + self.kind = 'Custom' # type: str + self.display_name = display_name + self.description = description + self.protocol = protocol + self.sources = sources + self.destinations = destinations + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None + + +class ActiveSecurityAdminRulesListResult(msrest.serialization.Model): + """Result of the request to list active security admin rules. It contains a list of active security admin rules and a skiptoken to get the next set of results. + + :param value: Gets a page of active security admin rules. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityAdminRule] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActiveBaseSecurityAdminRule]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ActiveBaseSecurityAdminRule"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(ActiveSecurityAdminRulesListResult, self).__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class ActiveSecurityUserRule(ActiveBaseSecurityUserRule): + """Network security user rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param commit_time: Deployment time string. + :type commit_time: ~datetime.datetime + :param region: Deployment region. + :type region: str + :param configuration_display_name: A display name of the security user configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security user configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, + sources: Optional[List["AddressPrefixItem"]] = None, + destinations: Optional[List["AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, + **kwargs + ): + super(ActiveSecurityUserRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) + self.kind = 'Custom' # type: str + self.display_name = display_name + self.description = description + self.protocol = protocol + self.sources = sources + self.destinations = destinations + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.direction = direction + self.provisioning_state = None + + +class ActiveSecurityUserRulesListResult(msrest.serialization.Model): + """Result of the request to list active security user rules. It contains a list of active security user rules and a skiptoken to get the next set of results. + + :param value: Gets a page of active security user rules. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityUserRule] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActiveBaseSecurityUserRule]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ActiveBaseSecurityUserRule"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(ActiveSecurityUserRulesListResult, self).__init__(**kwargs) + self.value = value + self.skip_token = skip_token class AddressPrefixItem(msrest.serialization.Model): @@ -138,7 +955,8 @@ class AddressPrefixItem(msrest.serialization.Model): :type address_prefix: str :param address_prefix_type: Address prefix type. Possible values include: "IPPrefix", "ServiceTag". - :type address_prefix_type: str or ~azure.mgmt.network.v2021_02_preview.models.AddressPrefixType + :type address_prefix_type: str or + ~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixType """ _attribute_map = { @@ -198,11 +1016,69 @@ def __init__( self.etag = None -class AdminRule(ProxyResource): +class BaseAdminRule(ProxyResource): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AdminRule, DefaultAdminRule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + _subtype_map = { + 'kind': {'Custom': 'AdminRule', 'Default': 'DefaultAdminRule'} + } + + def __init__( + self, + **kwargs + ): + super(BaseAdminRule, self).__init__(**kwargs) + self.kind = 'BaseAdminRule' # type: str + self.system_data = None + + +class AdminRule(BaseAdminRule): """Network admin rule. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Resource ID. :vartype id: str :ivar name: Resource name. @@ -211,20 +1087,23 @@ class AdminRule(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the rule. :type display_name: str - :param description: A description for this rule. + :param description: A description for this rule. Restricted to 140 chars. :type description: str :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :type protocol: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol - :param source: The CIDR or source IP ranges. - :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] - :param destination: The destination address prefixes. CIDR or destination IP ranges. - :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] :param source_port_ranges: The source port ranges. :type source_port_ranges: list[str] :param destination_port_ranges: The destination port ranges. @@ -232,7 +1111,7 @@ class AdminRule(ProxyResource): :param access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". :type access: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleAccess + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess :param priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. @@ -240,14 +1119,11 @@ class AdminRule(ProxyResource): :param direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :type direction: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security Configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -255,7 +1131,9 @@ class AdminRule(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'kind': {'required': True}, 'system_data': {'readonly': True}, + 'priority': {'maximum': 4096, 'minimum': 1}, 'provisioning_state': {'readonly': True}, } @@ -264,19 +1142,19 @@ class AdminRule(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, - 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, 'access': {'key': 'properties.access', 'type': 'str'}, 'priority': {'key': 'properties.priority', 'type': 'int'}, 'direction': {'key': 'properties.direction', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, } def __init__( @@ -285,50 +1163,48 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, - source: Optional[List["AddressPrefixItem"]] = None, - destination: Optional[List["AddressPrefixItem"]] = None, + sources: Optional[List["AddressPrefixItem"]] = None, + destinations: Optional[List["AddressPrefixItem"]] = None, source_port_ranges: Optional[List[str]] = None, destination_port_ranges: Optional[List[str]] = None, access: Optional[Union[str, "SecurityConfigurationRuleAccess"]] = None, priority: Optional[int] = None, direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, - applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, **kwargs ): super(AdminRule, self).__init__(**kwargs) - self.system_data = None + self.kind = 'Custom' # type: str self.display_name = display_name self.description = description self.protocol = protocol - self.source = source - self.destination = destination + self.sources = sources + self.destinations = destinations self.source_port_ranges = source_port_ranges self.destination_port_ranges = destination_port_ranges self.access = access self.priority = priority self.direction = direction self.provisioning_state = None - self.applies_to_groups = applies_to_groups class AdminRuleListResult(msrest.serialization.Model): - """Security configuration admin rule list result. + """security configuration admin rule list result. :param value: A list of admin rules. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.AdminRule] - :param next_link: Gets the URL to get the next set of results. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule] + :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[AdminRule]'}, + 'value': {'key': 'value', 'type': '[BaseAdminRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["AdminRule"]] = None, + value: Optional[List["BaseAdminRule"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -337,31 +1213,60 @@ def __init__( self.next_link = next_link -class AzureAsyncOperationResult(msrest.serialization.Model): - """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. +class BaseUserRule(ProxyResource): + """Network base rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: UserRule, DefaultUserRule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. - :param status: Status of the Azure async operation. Possible values include: "InProgress", - "Succeeded", "Failed". - :type status: str or ~azure.mgmt.network.v2021_02_preview.models.NetworkOperationStatus - :param error: Details of the error occurred during specified asynchronous operation. - :type error: ~azure.mgmt.network.v2021_02_preview.models.Error + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + } + _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + _subtype_map = { + 'kind': {'Custom': 'UserRule', 'Default': 'DefaultUserRule'} } def __init__( self, - *, - status: Optional[Union[str, "NetworkOperationStatus"]] = None, - error: Optional["Error"] = None, **kwargs ): - super(AzureAsyncOperationResult, self).__init__(**kwargs) - self.status = status - self.error = error + super(BaseUserRule, self).__init__(**kwargs) + self.kind = 'BaseUserRule' # type: str + self.system_data = None class CloudErrorBody(msrest.serialization.Model): @@ -377,7 +1282,7 @@ class CloudErrorBody(msrest.serialization.Model): error. :type target: str :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.network.v2021_02_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.network.v2021_02_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -403,34 +1308,62 @@ def __init__( self.details = details -class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): - """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. +class ConfigurationGroup(msrest.serialization.Model): + """The network configuration group resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str + :param id: Resource ID. + :type id: str + :param display_name: A friendly name for the network group. + :type display_name: str + :param description: A description of the network group. + :type description: str + :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". + :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType + :param group_members: Group members of network group. + :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] + :param conditional_membership: Network group conditional filter. + :type conditional_membership: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible + values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'member_type': {'key': 'properties.memberType', 'type': 'str'}, + 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, + 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, + *, + id: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + member_type: Optional[Union[str, "MemberType"]] = None, + group_members: Optional[List["GroupMembersItem"]] = None, + conditional_membership: Optional[str] = None, **kwargs ): - super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None + super(ConfigurationGroup, self).__init__(**kwargs) + self.id = id + self.display_name = display_name + self.description = description + self.member_type = member_type + self.group_members = group_members + self.conditional_membership = conditional_membership + self.provisioning_state = None class ConnectivityConfiguration(ProxyResource): @@ -447,28 +1380,30 @@ class ConnectivityConfiguration(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the resource. :type display_name: str :param description: A description of the connectivity configuration. :type description: str :param connectivity_topology: Connectivity topology type. Possible values include: - "HubAndSpokeTopology", "MeshTopology". + "HubAndSpoke", "Mesh". :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_preview.models.ConnectivityTopology + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology :param hub_id: The hub vnet Id. :type hub_id: str - :param is_global: Flag if global mesh is supported. - :type is_global: bool + :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityGroupItem] + list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] :ivar provisioning_state: The provisioning state of the connectivity configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. - :type delete_existing_peering: bool + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :type delete_existing_peering: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering """ _validation = { @@ -490,10 +1425,10 @@ class ConnectivityConfiguration(ProxyResource): 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, - 'is_global': {'key': 'properties.isGlobal', 'type': 'bool'}, + 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'bool'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, } def __init__( @@ -503,9 +1438,9 @@ def __init__( description: Optional[str] = None, connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, hub_id: Optional[str] = None, - is_global: Optional[bool] = None, + is_global: Optional[Union[str, "IsGlobal"]] = None, applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, - delete_existing_peering: Optional[bool] = None, + delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, **kwargs ): super(ConnectivityConfiguration, self).__init__(**kwargs) @@ -520,67 +1455,615 @@ def __init__( self.delete_existing_peering = delete_existing_peering -class ConnectivityConfigurationListResult(msrest.serialization.Model): - """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. +class ConnectivityConfigurationListResult(msrest.serialization.Model): + """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. + + :param value: Gets a page of Connectivity Configurations. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectivityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConnectivityConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ConnectivityConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConnectivityGroupItem(msrest.serialization.Model): + """ConnectivityGroupItem. + + :param network_group_id: Network group Id. + :type network_group_id: str + :param use_hub_gateway: Flag if need to use hub gateway. Possible values include: "False", + "True". + :type use_hub_gateway: str or ~azure.mgmt.network.v2021_02_01_preview.models.UseHubGateway + :param is_global: Flag if global is supported. Possible values include: "False", "True". + :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal + :param group_connectivity: Group connectivity type. Possible values include: "None", + "DirectlyConnected". + :type group_connectivity: str or + ~azure.mgmt.network.v2021_02_01_preview.models.GroupConnectivity + """ + + _attribute_map = { + 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, + 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'str'}, + 'is_global': {'key': 'isGlobal', 'type': 'str'}, + 'group_connectivity': {'key': 'groupConnectivity', 'type': 'str'}, + } + + def __init__( + self, + *, + network_group_id: Optional[str] = None, + use_hub_gateway: Optional[Union[str, "UseHubGateway"]] = None, + is_global: Optional[Union[str, "IsGlobal"]] = None, + group_connectivity: Optional[Union[str, "GroupConnectivity"]] = None, + **kwargs + ): + super(ConnectivityGroupItem, self).__init__(**kwargs) + self.network_group_id = network_group_id + self.use_hub_gateway = use_hub_gateway + self.is_global = is_global + self.group_connectivity = group_connectivity + + +class DefaultAdminRule(BaseAdminRule): + """Network default admin rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :vartype access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'access': {'readonly': True}, + 'priority': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + flag: Optional[str] = None, + **kwargs + ): + super(DefaultAdminRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None + + +class DefaultUserRule(BaseUserRule): + """Network security default user rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + flag: Optional[str] = None, + **kwargs + ): + super(DefaultUserRule, self).__init__(**kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.direction = None + self.provisioning_state = None + + +class EffectiveBaseSecurityAdminRule(msrest.serialization.Model): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: EffectiveSecurityAdminRule, EffectiveDefaultSecurityAdminRule. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Custom': 'EffectiveSecurityAdminRule', 'Default': 'EffectiveDefaultSecurityAdminRule'} + } + + def __init__( + self, + *, + id: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + **kwargs + ): + super(EffectiveBaseSecurityAdminRule, self).__init__(**kwargs) + self.id = id + self.configuration_display_name = configuration_display_name + self.configuration_description = configuration_description + self.rule_collection_display_name = rule_collection_display_name + self.rule_collection_description = rule_collection_description + self.rule_collection_applies_to_groups = rule_collection_applies_to_groups + self.rule_groups = rule_groups + self.kind = None # type: Optional[str] + + +class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """Network default admin rule. - :param value: Gets a page of Connectivity Configurations. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :param flag: Default rule flag. + :type flag: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :vartype access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'kind': {'required': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'protocol': {'readonly': True}, + 'sources': {'readonly': True}, + 'destinations': {'readonly': True}, + 'source_port_ranges': {'readonly': True}, + 'destination_port_ranges': {'readonly': True}, + 'access': {'readonly': True}, + 'priority': {'readonly': True}, + 'direction': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[ConnectivityConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'flag': {'key': 'properties.flag', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["ConnectivityConfiguration"]] = None, - next_link: Optional[str] = None, + id: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + flag: Optional[str] = None, **kwargs ): - super(ConnectivityConfigurationListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(EffectiveDefaultSecurityAdminRule, self).__init__(id=id, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) + self.kind = 'Default' # type: str + self.display_name = None + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None -class ConnectivityGroupItem(msrest.serialization.Model): - """ConnectivityGroupItem. +class EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """Network admin rule. - :param network_group_id: Network group Id. - :type network_group_id: str - :param use_hub_gateway: Flag if need to use hub gateway. - :type use_hub_gateway: bool - :param is_global: Flag if global is supported. - :type is_global: bool - :param group_connectivity: Group connectivity type. Possible values include: "None", - "DirectlyConnected". - :type group_connectivity: str or ~azure.mgmt.network.v2021_02_preview.models.GroupConnectivity + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource ID. + :type id: str + :param configuration_display_name: A display name of the security admin configuration. + :type configuration_display_name: str + :param configuration_description: A description of the security admin configuration. + :type configuration_description: str + :param rule_collection_display_name: A display name of the rule collection. + :type rule_collection_display_name: str + :param rule_collection_description: A description of the rule collection. + :type rule_collection_description: str + :param rule_collection_applies_to_groups: Groups for rule collection. + :type rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :param rule_groups: Effective configuration groups. + :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :param display_name: A friendly name for the rule. + :type display_name: str + :param description: A description for this rule. Restricted to 140 chars. + :type description: str + :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + "Icmp", "Esp", "Any", "Ah". + :type protocol: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Indicates the access allowed for this particular rule. Possible values include: + "Allow", "Deny", "AlwaysAllow". + :type access: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :type priority: int + :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :type direction: str or + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'kind': {'required': True}, + 'priority': {'maximum': 4096, 'minimum': 1}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, - 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'bool'}, - 'is_global': {'key': 'isGlobal', 'type': 'bool'}, - 'group_connectivity': {'key': 'groupConnectivity', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, + 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, + 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, + 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, + 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, + 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'properties.access', 'type': 'str'}, + 'priority': {'key': 'properties.priority', 'type': 'int'}, + 'direction': {'key': 'properties.direction', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - network_group_id: Optional[str] = None, - use_hub_gateway: Optional[bool] = None, - is_global: Optional[bool] = None, - group_connectivity: Optional[Union[str, "GroupConnectivity"]] = None, + id: Optional[str] = None, + configuration_display_name: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_display_name: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["ConfigurationGroup"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, + sources: Optional[List["AddressPrefixItem"]] = None, + destinations: Optional[List["AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "SecurityConfigurationRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): - super(ConnectivityGroupItem, self).__init__(**kwargs) - self.network_group_id = network_group_id - self.use_hub_gateway = use_hub_gateway - self.is_global = is_global - self.group_connectivity = group_connectivity + super(EffectiveSecurityAdminRule, self).__init__(id=id, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) + self.kind = 'Custom' # type: str + self.display_name = display_name + self.description = description + self.protocol = protocol + self.sources = sources + self.destinations = destinations + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None class EffectiveVirtualNetwork(msrest.serialization.Model): @@ -591,7 +2074,7 @@ class EffectiveVirtualNetwork(msrest.serialization.Model): :param location: Location of vnet. :type location: str :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". - :type membership_type: str or ~azure.mgmt.network.v2021_02_preview.models.MembershipType + :type membership_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MembershipType """ _attribute_map = { @@ -618,41 +2101,27 @@ class EffectiveVirtualNetworksListResult(msrest.serialization.Model): """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. :param value: Gets a page of EffectiveVirtualNetwork. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetwork] - :param total_records: Total Records. - :type total_records: int - :param first_index: First Index. - :type first_index: int - :param page_size: Page Size. - :type page_size: int - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetwork] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, - 'total_records': {'key': 'totalRecords', 'type': 'int'}, - 'first_index': {'key': 'firstIndex', 'type': 'int'}, - 'page_size': {'key': 'pageSize', 'type': 'int'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, value: Optional[List["EffectiveVirtualNetwork"]] = None, - total_records: Optional[int] = None, - first_index: Optional[int] = None, - page_size: Optional[int] = None, - next_link: Optional[str] = None, + skip_token: Optional[str] = None, **kwargs ): super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) self.value = value - self.total_records = total_records - self.first_index = first_index - self.page_size = page_size - self.next_link = next_link + self.skip_token = skip_token class EffectiveVirtualNetworksParameter(msrest.serialization.Model): @@ -660,221 +2129,52 @@ class EffectiveVirtualNetworksParameter(msrest.serialization.Model): :param conditional_members: Conditional Members. :type conditional_members: str + :param skip_token: Continuation token for pagination, capturing the next page size and offset, + as well as the context of the query. + :type skip_token: str """ _attribute_map = { 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, conditional_members: Optional[str] = None, + skip_token: Optional[str] = None, **kwargs ): super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) self.conditional_members = conditional_members - - -class Error(msrest.serialization.Model): - """Common error representation. - - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param target: Error target. - :type target: str - :param details: Error details. - :type details: list[~azure.mgmt.network.v2021_02_preview.models.ErrorDetails] - :param inner_error: Inner error message. - :type inner_error: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, - 'inner_error': {'key': 'innerError', 'type': 'str'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["ErrorDetails"]] = None, - inner_error: Optional[str] = None, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - self.inner_error = inner_error - - -class ErrorDetails(msrest.serialization.Model): - """Common error details representation. - - :param code: Error code. - :type code: str - :param target: Error target. - :type target: str - :param message: Error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - target: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - super(ErrorDetails, self).__init__(**kwargs) - self.code = code - self.target = target - self.message = message - - -class ExtendedLocation(msrest.serialization.Model): - """ExtendedLocation complex type. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the extended location. - :type name: str - :param type: Required. The type of the extended location. Possible values include: "EdgeZone". - :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ExtendedLocationTypes - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - type: Union[str, "ExtendedLocationTypes"], - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = name - self.type = type - - -class FailedImport(msrest.serialization.Model): - """Failed imports object. - - :param failure_code: Failure code. - :type failure_code: str - :param failure_reason: Failure reason. - :type failure_reason: str - """ - - _attribute_map = { - 'failure_code': {'key': 'failureCode', 'type': 'str'}, - 'failure_reason': {'key': 'failureReason', 'type': 'str'}, - } - - def __init__( - self, - *, - failure_code: Optional[str] = None, - failure_reason: Optional[str] = None, - **kwargs - ): - super(FailedImport, self).__init__(**kwargs) - self.failure_code = failure_code - self.failure_reason = failure_reason + self.skip_token = skip_token class GroupMembersItem(msrest.serialization.Model): """GroupMembers Item. - :param resource_id: Resource Id. - :type resource_id: str + :param vnet_id: Vnet Id. + :type vnet_id: str + :param subnet_id: Subnet Id. + :type subnet_id: str """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'vnet_id': {'key': 'vnetId', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, } def __init__( self, *, - resource_id: Optional[str] = None, + vnet_id: Optional[str] = None, + subnet_id: Optional[str] = None, **kwargs ): super(GroupMembersItem, self).__init__(**kwargs) - self.resource_id = resource_id - - -class ManagedServiceIdentity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity. This property will only - be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :param type: The type of identity used for the resource. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of user assigned - identities. The type 'None' will remove any identities from the virtual machine. Possible - values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.network.v2021_02_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with resource. The user - identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.network.v2021_02_preview.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, - **kwargs - ): - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.vnet_id = vnet_id + self.subnet_id = subnet_id class NetworkGroup(ProxyResource): @@ -891,21 +2191,21 @@ class NetworkGroup(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the network group. :type display_name: str :param description: A description of the network group. :type description: str :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". - :type member_type: str or ~azure.mgmt.network.v2021_02_preview.models.MemberType + :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType :param group_members: Group members of network group. - :type group_members: list[~azure.mgmt.network.v2021_02_preview.models.GroupMembersItem] + :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] :param conditional_membership: Network group conditional filter. :type conditional_membership: str :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -955,7 +2255,7 @@ class NetworkGroupListResult(msrest.serialization.Model): """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. :param value: Gets a page of NetworkGroup. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkGroup] + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup] :param next_link: Gets the URL to get the next set of results. :type next_link: str """ @@ -1041,21 +2341,21 @@ class NetworkManager(Resource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the network manager. :type display_name: str :param description: A description of the network manager. :type description: str :param network_manager_scopes: Scope of Network Manager. :type network_manager_scopes: - ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerPropertiesNetworkManagerScopes + ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes :param network_manager_scope_accesses: Scope Access. :type network_manager_scope_accesses: list[str or - ~azure.mgmt.network.v2021_02_preview.models.ScopeAccesses] + ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -1090,7 +2390,7 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, network_manager_scopes: Optional["NetworkManagerPropertiesNetworkManagerScopes"] = None, - network_manager_scope_accesses: Optional[List[Union[str, "ScopeAccesses"]]] = None, + network_manager_scope_accesses: Optional[List[Union[str, "ConfigurationType"]]] = None, **kwargs ): super(NetworkManager, self).__init__(id=id, location=location, tags=tags, **kwargs) @@ -1106,16 +2406,25 @@ def __init__( class NetworkManagerCommit(msrest.serialization.Model): """Network Manager Commit. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar commit_id: Commit Id. + :vartype commit_id: str :param target_locations: List of target locations. :type target_locations: list[str] :param configuration_ids: List of configuration ids. :type configuration_ids: list[str] - :param commit_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy", - "Routing", "Connectivity". - :type commit_type: str or ~azure.mgmt.network.v2021_02_preview.models.CommitType + :param commit_type: Commit Type. Possible values include: "SecurityAdmin", "SecurityUser", + "Connectivity". + :type commit_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType """ + _validation = { + 'commit_id': {'readonly': True}, + } + _attribute_map = { + 'commit_id': {'key': 'commitId', 'type': 'str'}, 'target_locations': {'key': 'targetLocations', 'type': '[str]'}, 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, 'commit_type': {'key': 'commitType', 'type': 'str'}, @@ -1126,10 +2435,11 @@ def __init__( *, target_locations: Optional[List[str]] = None, configuration_ids: Optional[List[str]] = None, - commit_type: Optional[Union[str, "CommitType"]] = None, + commit_type: Optional[Union[str, "ConfigurationType"]] = None, **kwargs ): super(NetworkManagerCommit, self).__init__(**kwargs) + self.commit_id = None self.target_locations = target_locations self.configuration_ids = configuration_ids self.commit_type = commit_type @@ -1144,12 +2454,12 @@ class NetworkManagerDeploymentStatus(msrest.serialization.Model): :type region: str :param deployment_status: Deployment Status. Possible values include: "NotStarted", "Deploying", "Deployed", "Failed". - :type deployment_status: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentStatus + :type deployment_status: str or ~azure.mgmt.network.v2021_02_01_preview.models.DeploymentStatus :param configuration_ids: List of configuration ids. :type configuration_ids: list[str] - :param deployment_type: Configuration Deployment Type. Possible values include: "AdminPolicy", - "UserPolicy", "Routing", "Connectivity". - :type deployment_type: str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType + :param deployment_type: Configuration Deployment Type. Possible values include: + "SecurityAdmin", "SecurityUser", "Connectivity". + :type deployment_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType :param error_message: Error Message. :type error_message: str """ @@ -1170,7 +2480,7 @@ def __init__( region: Optional[str] = None, deployment_status: Optional[Union[str, "DeploymentStatus"]] = None, configuration_ids: Optional[List[str]] = None, - deployment_type: Optional[Union[str, "DeploymentType"]] = None, + deployment_type: Optional[Union[str, "ConfigurationType"]] = None, error_message: Optional[str] = None, **kwargs ): @@ -1187,85 +2497,124 @@ class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): """A list of Network Manager Deployment Status. :param value: Gets a page of Network Manager Deployment Status. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatus] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatus] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, value: Optional[List["NetworkManagerDeploymentStatus"]] = None, - next_link: Optional[str] = None, + skip_token: Optional[str] = None, **kwargs ): super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) self.value = value - self.next_link = next_link + self.skip_token = skip_token class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): """Network Manager Deployment Status Parameter. - :param regions: List of locations. - :type regions: list[str] - :param deployment_types: List of configurations' deployment types. - :type deployment_types: list[str or ~azure.mgmt.network.v2021_02_preview.models.DeploymentType] + :param regions: List of locations. + :type regions: list[str] + :param deployment_types: List of deployment types. + :type deployment_types: list[str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] + :param skip_token: Continuation token for pagination, capturing the next page size and offset, + as well as the context of the query. + :type skip_token: str + """ + + _attribute_map = { + 'regions': {'key': 'regions', 'type': '[str]'}, + 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + regions: Optional[List[str]] = None, + deployment_types: Optional[List[Union[str, "ConfigurationType"]]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) + self.regions = regions + self.deployment_types = deployment_types + self.skip_token = skip_token + + +class NetworkManagerEffectiveConnectivityConfigurationListResult(msrest.serialization.Model): + """Result of the request to list networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken to get the next set of results. + + :param value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveConnectivityConfiguration] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'regions': {'key': 'regions', 'type': '[str]'}, - 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, - regions: Optional[List[str]] = None, - deployment_types: Optional[List[Union[str, "DeploymentType"]]] = None, + value: Optional[List["EffectiveConnectivityConfiguration"]] = None, + skip_token: Optional[str] = None, **kwargs ): - super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) - self.regions = regions - self.deployment_types = deployment_types + super(NetworkManagerEffectiveConnectivityConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.skip_token = skip_token -class NetworkManagerEffectiveConfigurationListResult(msrest.serialization.Model): - """Result of the request to list networkManagerEffectiveConfiguration. It contains a list of groups and a URL link to get the next set of results. +class NetworkManagerEffectiveSecurityAdminRulesListResult(msrest.serialization.Model): + """Result of the request to list networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to get the next set of results. - :param value: Gets a page of NetworkManagerEffectiveConfiguration. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.EffectiveConfiguration] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :param value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. + :type value: + list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveBaseSecurityAdminRule] + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[EffectiveConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EffectiveBaseSecurityAdminRule]'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["EffectiveConfiguration"]] = None, - next_link: Optional[str] = None, + value: Optional[List["EffectiveBaseSecurityAdminRule"]] = None, + skip_token: Optional[str] = None, **kwargs ): - super(NetworkManagerEffectiveConfigurationListResult, self).__init__(**kwargs) + super(NetworkManagerEffectiveSecurityAdminRulesListResult, self).__init__(**kwargs) self.value = value - self.next_link = next_link + self.skip_token = skip_token class NetworkManagerListResult(msrest.serialization.Model): """Result of the request to list NetworkManager. It contains a list of network managers and a URL link to get the next set of results. :param value: Gets a page of NetworkManager. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.NetworkManager] + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager] :param next_link: Gets the URL to get the next page of results. :type next_link: str """ @@ -1313,60 +2662,6 @@ def __init__( self.subscriptions = subscriptions -class NetworkManagerSecurityConfigurationImport(msrest.serialization.Model): - """Network manager security configuration import parameters. - - :param network_security_group_imports: List of nsg uris. - :type network_security_group_imports: - list[~azure.mgmt.network.v2021_02_preview.models.NetworkSecurityGroupImport] - :param import_deny_rules_as_admin_rules: Flag if import deny rules as admin rules. - :type import_deny_rules_as_admin_rules: bool - :param admin_security_configuration_uri: Admin security configuration Uri. - :type admin_security_configuration_uri: str - :param remove_allow_vnet_inbound_rule: Flag if need to remove allow vnet inbound rule. - :type remove_allow_vnet_inbound_rule: bool - :param remove_allow_azure_load_balancer_inbound_rule: Flag if need to remove allow azure load - balancer inbound rule. - :type remove_allow_azure_load_balancer_inbound_rule: bool - :param remove_allow_vnet_outbound_rule: Flag if need to remove allow vnet outbound rule. - :type remove_allow_vnet_outbound_rule: bool - :param remove_allow_internet_outbound_rule: Flag if need to remove allow Internet outbound - rule. - :type remove_allow_internet_outbound_rule: bool - """ - - _attribute_map = { - 'network_security_group_imports': {'key': 'networkSecurityGroupImports', 'type': '[NetworkSecurityGroupImport]'}, - 'import_deny_rules_as_admin_rules': {'key': 'importDenyRulesAsAdminRules', 'type': 'bool'}, - 'admin_security_configuration_uri': {'key': 'adminSecurityConfigurationUri', 'type': 'str'}, - 'remove_allow_vnet_inbound_rule': {'key': 'removeAllowVnetInboundRule', 'type': 'bool'}, - 'remove_allow_azure_load_balancer_inbound_rule': {'key': 'removeAllowAzureLoadBalancerInboundRule', 'type': 'bool'}, - 'remove_allow_vnet_outbound_rule': {'key': 'removeAllowVnetOutboundRule', 'type': 'bool'}, - 'remove_allow_internet_outbound_rule': {'key': 'removeAllowInternetOutboundRule', 'type': 'bool'}, - } - - def __init__( - self, - *, - network_security_group_imports: Optional[List["NetworkSecurityGroupImport"]] = None, - import_deny_rules_as_admin_rules: Optional[bool] = None, - admin_security_configuration_uri: Optional[str] = None, - remove_allow_vnet_inbound_rule: Optional[bool] = None, - remove_allow_azure_load_balancer_inbound_rule: Optional[bool] = None, - remove_allow_vnet_outbound_rule: Optional[bool] = None, - remove_allow_internet_outbound_rule: Optional[bool] = None, - **kwargs - ): - super(NetworkManagerSecurityConfigurationImport, self).__init__(**kwargs) - self.network_security_group_imports = network_security_group_imports - self.import_deny_rules_as_admin_rules = import_deny_rules_as_admin_rules - self.admin_security_configuration_uri = admin_security_configuration_uri - self.remove_allow_vnet_inbound_rule = remove_allow_vnet_inbound_rule - self.remove_allow_azure_load_balancer_inbound_rule = remove_allow_azure_load_balancer_inbound_rule - self.remove_allow_vnet_outbound_rule = remove_allow_vnet_outbound_rule - self.remove_allow_internet_outbound_rule = remove_allow_internet_outbound_rule - - class NetworkManagerSecurityGroupItem(msrest.serialization.Model): """Network manager security group item. @@ -1388,65 +2683,37 @@ def __init__( self.network_group_id = network_group_id -class NetworkSecurityGroupImport(msrest.serialization.Model): - """Network Security Group Import. - - :param network_security_group_uri: Network Security Group Uri. - :type network_security_group_uri: str - """ - - _attribute_map = { - 'network_security_group_uri': {'key': 'networkSecurityGroupUri', 'type': 'str'}, - } - - def __init__( - self, - *, - network_security_group_uri: Optional[str] = None, - **kwargs - ): - super(NetworkSecurityGroupImport, self).__init__(**kwargs) - self.network_security_group_uri = network_security_group_uri - - -class SecurityConfiguration(ProxyResource): - """Defines the security Configuration. +class NetworkSecurityPerimeter(Resource): + """The Network Security Perimeter resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. - :vartype id: str + :param id: Resource ID. + :type id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData - :param display_name: A display name of the security Configuration. + :param display_name: A friendly name for the network security perimeter. :type display_name: str - :param description: A description of the security Configuration. + :param description: A description of the network security perimeter. :type description: str - :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". - :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType - :param delete_existing_ns_gs: Flag if need to delete existing network security groups. - :type delete_existing_ns_gs: bool - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityGroupItem] :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { - 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -1454,174 +2721,347 @@ class SecurityConfiguration(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'security_type': {'key': 'properties.securityType', 'type': 'str'}, - 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'bool'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, + id: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, display_name: Optional[str] = None, description: Optional[str] = None, - security_type: Optional[Union[str, "SecurityType"]] = None, - delete_existing_ns_gs: Optional[bool] = None, - applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, **kwargs ): - super(SecurityConfiguration, self).__init__(**kwargs) - self.system_data = None + super(NetworkSecurityPerimeter, self).__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None self.display_name = display_name self.description = description - self.security_type = security_type - self.delete_existing_ns_gs = delete_existing_ns_gs - self.applies_to_groups = applies_to_groups self.provisioning_state = None -class SecurityConfigurationImportResult(msrest.serialization.Model): - """Security configuration import Result. +class NetworkSecurityPerimeterListResult(msrest.serialization.Model): + """Result of the request to list NetworkSecurityPerimeter. It contains a list of network security perimeters and a URL link to get the next set of results. - :param user_security_configuration: User security configuration Id. - :type user_security_configuration: str - :param admin_security_configuration: Admin security configuration Id. - :type admin_security_configuration: str - :param failed_import: failed imports code and reason. - :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + :param value: Gets a page of NetworkSecurityPerimeter. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str """ _attribute_map = { - 'user_security_configuration': {'key': 'userSecurityConfiguration', 'type': 'str'}, - 'admin_security_configuration': {'key': 'adminSecurityConfiguration', 'type': 'str'}, - 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + 'value': {'key': 'value', 'type': '[NetworkSecurityPerimeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - user_security_configuration: Optional[str] = None, - admin_security_configuration: Optional[str] = None, - failed_import: Optional["FailedImport"] = None, + value: Optional[List["NetworkSecurityPerimeter"]] = None, + next_link: Optional[str] = None, **kwargs ): - super(SecurityConfigurationImportResult, self).__init__(**kwargs) - self.user_security_configuration = user_security_configuration - self.admin_security_configuration = admin_security_configuration - self.failed_import = failed_import + super(NetworkSecurityPerimeterListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class SecurityConfigurationListResult(msrest.serialization.Model): - """A list of managed network security configurations. +class PerimeterAssociableResource(Resource): + """Resource that is onboarded to use network security perimeter. Also referred as perimeter associable resource. - :param value: Gets a page of security configurations. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration] + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar display_name: A friendly name for the properties of perimeter associable resources. + :vartype display_name: str + :ivar resource_type: Resource type/provider name. + :vartype resource_type: str + :ivar public_dns_zones: Public DNS zone names of the resources. + :vartype public_dns_zones: list[str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'public_dns_zones': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'public_dns_zones': {'key': 'properties.publicDnsZones', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(PerimeterAssociableResource, self).__init__(id=id, location=location, tags=tags, **kwargs) + self.display_name = None + self.resource_type = None + self.public_dns_zones = None + + +class PerimeterAssociableResourcesListResult(msrest.serialization.Model): + """Paged list of perimeter associable resources. + + :param value: Gets paged list of perimeter associable resources. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResource] :param next_link: Gets the URL to get the next page of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'value': {'key': 'value', 'type': '[PerimeterAssociableResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["SecurityConfiguration"]] = None, + value: Optional[List["PerimeterAssociableResource"]] = None, next_link: Optional[str] = None, **kwargs ): - super(SecurityConfigurationListResult, self).__init__(**kwargs) + super(PerimeterAssociableResourcesListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class SecurityConfigurationRule(msrest.serialization.Model): - """General security configuration Rule. +class QueryRequestOptions(msrest.serialization.Model): + """Query Request Options. - :param security_type: Commit Type. Possible values include: "AdminPolicy", "UserPolicy". - :type security_type: str or ~azure.mgmt.network.v2021_02_preview.models.SecurityType - :param security_admin_rule: Security admin rule. - :type security_admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule - :param security_user_rule: Security user rule. - :type security_user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :param skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :type skip_token: str """ _attribute_map = { - 'security_type': {'key': 'securityType', 'type': 'str'}, - 'security_admin_rule': {'key': 'securityAdminRule', 'type': 'AdminRule'}, - 'security_user_rule': {'key': 'securityUserRule', 'type': 'UserRule'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, } def __init__( self, *, - security_type: Optional[Union[str, "SecurityType"]] = None, - security_admin_rule: Optional["AdminRule"] = None, - security_user_rule: Optional["UserRule"] = None, + skip_token: Optional[str] = None, **kwargs ): - super(SecurityConfigurationRule, self).__init__(**kwargs) - self.security_type = security_type - self.security_admin_rule = security_admin_rule - self.security_user_rule = security_user_rule + super(QueryRequestOptions, self).__init__(**kwargs) + self.skip_token = skip_token + + +class RuleCollection(ProxyResource): + """Defines the rule collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :param display_name: A display name of the rule collection. + :type display_name: str + :param description: A description of the rule collection. + :type description: str + :param applies_to_groups: Groups for configuration. + :type applies_to_groups: + list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + **kwargs + ): + super(RuleCollection, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.applies_to_groups = applies_to_groups + self.provisioning_state = None -class SecurityConfigurationRuleListResult(msrest.serialization.Model): - """Security configuration rule list result. +class RuleCollectionListResult(msrest.serialization.Model): + """Security configuration rule collection list result. - :param value: A list of network manager security configuration rules. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRule] - :param failed_import: Failed Imports. - :type failed_import: ~azure.mgmt.network.v2021_02_preview.models.FailedImport + :param value: A list of network manager security configuration rule collections. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection] :param next_link: Gets the URL to get the next set of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityConfigurationRule]'}, - 'failed_import': {'key': 'failedImport', 'type': 'FailedImport'}, + 'value': {'key': 'value', 'type': '[RuleCollection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["SecurityConfigurationRule"]] = None, - failed_import: Optional["FailedImport"] = None, + value: Optional[List["RuleCollection"]] = None, next_link: Optional[str] = None, **kwargs ): - super(SecurityConfigurationRuleListResult, self).__init__(**kwargs) + super(RuleCollectionListResult, self).__init__(**kwargs) self.value = value - self.failed_import = failed_import self.next_link = next_link -class SubResource(msrest.serialization.Model): - """Reference to another subresource. +class SecurityConfiguration(ProxyResource): + """Defines the security configuration. - :param id: Resource ID. - :type id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :param display_name: A display name of the security configuration. + :type display_name: str + :param description: A description of the security configuration. + :type description: str + :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". + :type security_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.SecurityType + :param delete_existing_ns_gs: Flag if need to delete existing network security groups. Possible + values include: "False", "True". + :type delete_existing_ns_gs: str or + ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingNSGs + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'security_type': {'key': 'properties.securityType', 'type': 'str'}, + 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - id: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + security_type: Optional[Union[str, "SecurityType"]] = None, + delete_existing_ns_gs: Optional[Union[str, "DeleteExistingNSGs"]] = None, **kwargs ): - super(SubResource, self).__init__(**kwargs) - self.id = id + super(SecurityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.security_type = security_type + self.delete_existing_ns_gs = delete_existing_ns_gs + self.provisioning_state = None + + +class SecurityConfigurationListResult(msrest.serialization.Model): + """A list of network manager security configurations. + + :param value: Gets a page of security configurations. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration] + :param next_link: Gets the URL to get the next page of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SecurityConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SecurityConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link class SystemData(msrest.serialization.Model): @@ -1631,14 +3071,15 @@ class SystemData(msrest.serialization.Model): :type created_by: str :param created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :type created_by_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType :param created_at: The timestamp of resource creation (UTC). :type created_at: ~datetime.datetime :param last_modified_by: The identity that last modified the resource. :type last_modified_by: str :param last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.network.v2021_02_preview.models.CreatedByType + :type last_modified_by_type: str or + ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType :param last_modified_at: The type of identity that last modified the resource. :type last_modified_at: ~datetime.datetime """ @@ -1693,11 +3134,13 @@ def __init__( self.tags = tags -class UserRule(ProxyResource): - """Network security admin rule. +class UserRule(BaseUserRule): + """Network security user rule. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Resource ID. :vartype id: str :ivar name: Resource name. @@ -1706,20 +3149,23 @@ class UserRule(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str + :param kind: Required. Whether the rule is custom or default.Constant filled by server. + Possible values include: "Custom", "Default". + :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData :param display_name: A friendly name for the rule. :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. + :param description: A description for this rule. :type description: str :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :type protocol: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleProtocol - :param source: The CIDR or source IP ranges. - :type source: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] - :param destination: The destination address prefixes. CIDR or destination IP ranges. - :type destination: list[~azure.mgmt.network.v2021_02_preview.models.AddressPrefixItem] + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + :param sources: The CIDR or source IP ranges. + :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :param destinations: The destination address prefixes. CIDR or destination IP ranges. + :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] :param source_port_ranges: The source port ranges. :type source_port_ranges: list[str] :param destination_port_ranges: The destination port ranges. @@ -1727,11 +3173,11 @@ class UserRule(ProxyResource): :param direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :type direction: str or - ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security Configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". + ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the security configuration user rule + resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState """ _validation = { @@ -1739,6 +3185,7 @@ class UserRule(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'kind': {'required': True}, 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -1748,12 +3195,13 @@ class UserRule(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': '[AddressPrefixItem]'}, - 'destination': {'key': 'properties.destination', 'type': '[AddressPrefixItem]'}, + 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, + 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, 'direction': {'key': 'properties.direction', 'type': 'str'}, @@ -1766,20 +3214,20 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, protocol: Optional[Union[str, "SecurityConfigurationRuleProtocol"]] = None, - source: Optional[List["AddressPrefixItem"]] = None, - destination: Optional[List["AddressPrefixItem"]] = None, + sources: Optional[List["AddressPrefixItem"]] = None, + destinations: Optional[List["AddressPrefixItem"]] = None, source_port_ranges: Optional[List[str]] = None, destination_port_ranges: Optional[List[str]] = None, direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): super(UserRule, self).__init__(**kwargs) - self.system_data = None + self.kind = 'Custom' # type: str self.display_name = display_name self.description = description self.protocol = protocol - self.source = source - self.destination = destination + self.sources = sources + self.destinations = destinations self.source_port_ranges = source_port_ranges self.destination_port_ranges = destination_port_ranges self.direction = direction @@ -1787,23 +3235,23 @@ def __init__( class UserRuleListResult(msrest.serialization.Model): - """Security configuration user rule list result. + """security user rule list result. :param value: A list of user rules. - :type value: list[~azure.mgmt.network.v2021_02_preview.models.UserRule] - :param next_link: Gets the URL to get the next set of results. + :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule] + :param next_link: The URL to get the next set of results. :type next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[UserRule]'}, + 'value': {'key': 'value', 'type': '[BaseUserRule]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["UserRule"]] = None, + value: Optional[List["BaseUserRule"]] = None, next_link: Optional[str] = None, **kwargs ): diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py index 04097bd3132..b0424372439 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py @@ -26,13 +26,6 @@ def __getattr__(cls, name): raise AttributeError(name) -class Access(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Access to be allowed or denied. - """ - - ALLOW = "Allow" - DENY = "Deny" - class AddressPrefixType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Address prefix type. """ @@ -40,36 +33,27 @@ class AddressPrefixType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IP_PREFIX = "IPPrefix" SERVICE_TAG = "ServiceTag" -class AuthenticationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """VPN client authentication method. - """ - - EAPTLS = "EAPTLS" - EAPMSCHA_PV2 = "EAPMSCHAPv2" - -class CommitType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Commit Type. +class AdminRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. """ - ADMIN_POLICY = "AdminPolicy" - USER_POLICY = "UserPolicy" - ROUTING = "Routing" - CONNECTIVITY = "Connectivity" + CUSTOM = "Custom" + DEFAULT = "Default" -class ConfigType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Effective configuration. +class ConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Configuration Deployment Type. """ - ADMIN_POLICY = "AdminPolicy" - USER_POLICY = "UserPolicy" + SECURITY_ADMIN = "SecurityAdmin" + SECURITY_USER = "SecurityUser" CONNECTIVITY = "Connectivity" class ConnectivityTopology(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Connectivity topology type. """ - HUB_AND_SPOKE_TOPOLOGY = "HubAndSpokeTopology" - MESH_TOPOLOGY = "MeshTopology" + HUB_AND_SPOKE = "HubAndSpoke" + MESH = "Mesh" class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. @@ -80,6 +64,20 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" +class DeleteExistingNSGs(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag if need to delete existing network security groups. + """ + + FALSE = "False" + TRUE = "True" + +class DeleteExistingPeering(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag if need to remove current existing peerings. + """ + + FALSE = "False" + TRUE = "True" + class DeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Deployment Status. """ @@ -89,21 +87,19 @@ class DeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEPLOYED = "Deployed" FAILED = "Failed" -class DeploymentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Configuration Deployment Type. +class EffectiveAdminRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. """ - ADMIN_POLICY = "AdminPolicy" - USER_POLICY = "UserPolicy" - ROUTING = "Routing" - CONNECTIVITY = "Connectivity" + CUSTOM = "Custom" + DEFAULT = "Default" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network - resources. +class EffectiveUserRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. """ - EDGE_ZONE = "EdgeZone" + CUSTOM = "Custom" + DEFAULT = "Default" class GroupConnectivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Group connectivity type. @@ -112,19 +108,12 @@ class GroupConnectivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" DIRECTLY_CONNECTED = "DirectlyConnected" -class IPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """IP address allocation method. +class IsGlobal(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag if global mesh is supported. """ - STATIC = "Static" - DYNAMIC = "Dynamic" - -class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """IP address version. - """ - - I_PV4 = "IPv4" - I_PV6 = "IPv6" + FALSE = "False" + TRUE = "True" class MembershipType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Membership Type. @@ -140,14 +129,6 @@ class MemberType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_NETWORK = "VirtualNetwork" SUBNET = "Subnet" -class NetworkOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Status of the Azure async operation. - """ - - IN_PROGRESS = "InProgress" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -157,23 +138,6 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes - both an implicitly created identity and a set of user assigned identities. The type 'None' will - remove any identities from the virtual machine. - """ - - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - NONE = "None" - -class ScopeAccesses(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - SECURITY = "Security" - ROUTING = "Routing" - CONNECTIVITY = "Connectivity" - class SecurityConfigurationRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Whether network traffic is allowed or denied. """ @@ -207,3 +171,17 @@ class SecurityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ADMIN_POLICY = "AdminPolicy" USER_POLICY = "UserPolicy" + +class UseHubGateway(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag if need to use hub gateway. + """ + + FALSE = "False" + TRUE = "True" + +class UserRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. + """ + + CUSTOM = "Custom" + DEFAULT = "Default" diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py index ad5afd67132..e3ab4d13aca 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py @@ -10,24 +10,40 @@ from ._network_manager_commits_operations import NetworkManagerCommitsOperations from ._network_manager_deployment_status_operations import NetworkManagerDeploymentStatusOperations from ._effective_virtual_networks_operations import EffectiveVirtualNetworksOperations -from ._active_configurations_operations import ActiveConfigurationsOperations +from ._active_connectivity_configurations_operations import ActiveConnectivityConfigurationsOperations +from ._active_security_admin_rules_operations import ActiveSecurityAdminRulesOperations +from ._active_security_user_rules_operations import ActiveSecurityUserRulesOperations from ._connectivity_configurations_operations import ConnectivityConfigurationsOperations -from ._effective_configurations_operations import EffectiveConfigurationsOperations +from ._effective_connectivity_configurations_operations import EffectiveConnectivityConfigurationsOperations +from ._network_manager_effective_security_admin_rules_operations import NetworkManagerEffectiveSecurityAdminRulesOperations from ._network_groups_operations import NetworkGroupsOperations -from ._security_configurations_operations import SecurityConfigurationsOperations -from ._admin_rules_operations import AdminRulesOperations +from ._security_user_configurations_operations import SecurityUserConfigurationsOperations +from ._user_rule_collections_operations import UserRuleCollectionsOperations from ._user_rules_operations import UserRulesOperations +from ._security_admin_configurations_operations import SecurityAdminConfigurationsOperations +from ._admin_rule_collections_operations import AdminRuleCollectionsOperations +from ._admin_rules_operations import AdminRulesOperations +from ._network_security_perimeters_operations import NetworkSecurityPerimetersOperations +from ._perimeter_associable_resource_types_operations import PerimeterAssociableResourceTypesOperations __all__ = [ 'NetworkManagersOperations', 'NetworkManagerCommitsOperations', 'NetworkManagerDeploymentStatusOperations', 'EffectiveVirtualNetworksOperations', - 'ActiveConfigurationsOperations', + 'ActiveConnectivityConfigurationsOperations', + 'ActiveSecurityAdminRulesOperations', + 'ActiveSecurityUserRulesOperations', 'ConnectivityConfigurationsOperations', - 'EffectiveConfigurationsOperations', + 'EffectiveConnectivityConfigurationsOperations', + 'NetworkManagerEffectiveSecurityAdminRulesOperations', 'NetworkGroupsOperations', - 'SecurityConfigurationsOperations', - 'AdminRulesOperations', + 'SecurityUserConfigurationsOperations', + 'UserRuleCollectionsOperations', 'UserRulesOperations', + 'SecurityAdminConfigurationsOperations', + 'AdminRuleCollectionsOperations', + 'AdminRulesOperations', + 'NetworkSecurityPerimetersOperations', + 'PerimeterAssociableResourceTypesOperations', ] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py deleted file mode 100644 index 46cdf86c0b9..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_configurations_operations.py +++ /dev/null @@ -1,139 +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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ActiveConfigurationsOperations(object): - """ActiveConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - network_manager_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - region=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ActiveConfigurationListResult"] - """Lists active configurations in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str - :param region: Location name. - :type region: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ActiveConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.ActiveConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConfigurationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if region is not None: - query_parameters['region'] = self._serialize.query("region", region, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ActiveConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/activeConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py new file mode 100644 index 00000000000..b3cccd8ae21 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActiveConnectivityConfigurationsOperations(object): + """ActiveConnectivityConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.ActiveConfigurationParameter" + **kwargs # type: Any + ): + # type: (...) -> "_models.ActiveConnectivityConfigurationsListResult" + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveConnectivityConfigurationsListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfigurationsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConnectivityConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveConnectivityConfigurationsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py new file mode 100644 index 00000000000..cfc78b9b64f --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActiveSecurityAdminRulesOperations(object): + """ActiveSecurityAdminRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.ActiveConfigurationParameter" + **kwargs # type: Any + ): + # type: (...) -> "_models.ActiveSecurityAdminRulesListResult" + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py new file mode 100644 index 00000000000..c50c995dd9f --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActiveSecurityUserRulesOperations(object): + """ActiveSecurityUserRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.ActiveConfigurationParameter" + **kwargs # type: Any + ): + # type: (...) -> "_models.ActiveSecurityUserRulesListResult" + """Lists Active Security User Rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityUserRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityUserRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityUserRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityUserRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py new file mode 100644 index 00000000000..752c53b39f4 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py @@ -0,0 +1,351 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AdminRuleCollectionsOperations(object): + """AdminRuleCollectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RuleCollectionListResult"] + """Lists all the rule collections in a security admin configuration, in a paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RuleCollection" + """Gets a network manager security admin configuration rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_collection_name, # type: str + rule_collection, # type: "_models.RuleCollection" + **kwargs # type: Any + ): + # type: (...) -> "_models.RuleCollection" + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. + :type rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(rule_collection, 'RuleCollection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an admin rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py index f8dd3a34a1b..a0d26b49613 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py @@ -30,7 +30,7 @@ class AdminRulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,12 +50,13 @@ def list( resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str top=None, # type: Optional[int] skip_token=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> Iterable["_models.AdminRuleListResult"] - """Retrieves a network manager security configuration admin rule. + """List all network manager security configuration admin rules. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -63,6 +64,9 @@ def list( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -72,7 +76,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AdminRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.AdminRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRuleListResult"] @@ -96,6 +100,7 @@ def prepare_request(next_link=None): 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -135,18 +140,19 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore def get( self, resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.AdminRule" - """Gets a network manager security configuration admin rule in a subscription. + # type: (...) -> "_models.BaseAdminRule" + """Gets a network manager security configuration admin rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -154,14 +160,17 @@ def get( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :return: BaseAdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,6 +185,7 @@ def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -196,24 +206,25 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AdminRule', pipeline_response) + deserialized = self._deserialize('BaseAdminRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore def create_or_update( self, resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str rule_name, # type: str - admin_rule, # type: "_models.AdminRule" + admin_rule, # type: "_models.BaseAdminRule" **kwargs # type: Any ): - # type: (...) -> "_models.AdminRule" + # type: (...) -> "_models.BaseAdminRule" """Creates or updates an admin rule. :param resource_group_name: The name of the resource group. @@ -222,16 +233,19 @@ def create_or_update( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :param admin_rule: The admin rule to create or update. - :type admin_rule: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :type admin_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule :keyword callable cls: A custom type or function that will be passed the direct response - :return: AdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.AdminRule + :return: BaseAdminRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -247,6 +261,7 @@ def create_or_update( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -261,7 +276,7 @@ def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(admin_rule, 'AdminRule') + body_content = self._serialize.body(admin_rule, 'BaseAdminRule') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -272,22 +287,23 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AdminRule', pipeline_response) + deserialized = self._deserialize('BaseAdminRule', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AdminRule', pipeline_response) + deserialized = self._deserialize('BaseAdminRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore def delete( self, resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str rule_name, # type: str **kwargs # type: Any ): @@ -300,6 +316,9 @@ def delete( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -322,6 +341,7 @@ def delete( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -345,4 +365,4 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/adminRules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py index 259820953c1..64f3fec527a 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py @@ -30,7 +30,7 @@ class ConnectivityConfigurationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -128,10 +128,10 @@ def create_or_update( :type configuration_name: str :param connectivity_configuration: Parameters supplied to create/update a network manager connectivity configuration. - :type connectivity_configuration: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :type connectivity_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -270,7 +270,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectivityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.ConnectivityConfigurationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfigurationListResult"] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py deleted file mode 100644 index 41a7e375552..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_configurations_operations.py +++ /dev/null @@ -1,134 +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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class EffectiveConfigurationsOperations(object): - """EffectiveConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - virtual_network_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkManagerEffectiveConfigurationListResult"] - """List all configurations in a virtual network. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerEffectiveConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerEffectiveConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConfigurationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerEffectiveConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/networkManagerEffectiveConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py new file mode 100644 index 00000000000..df94773153e --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EffectiveConnectivityConfigurationsOperations(object): + """EffectiveConnectivityConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + virtual_network_name, # type: str + parameters, # type: "_models.QueryRequestOptions" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkManagerEffectiveConnectivityConfigurationListResult" + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveConnectivityConfigurationListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConnectivityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueryRequestOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveConnectivityConfigurationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py index 23455cde92f..be99eef8926 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py @@ -9,7 +9,6 @@ import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -30,7 +29,7 @@ class EffectiveVirtualNetworksOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +53,7 @@ def list_by_network_manager( parameters=None, # type: Optional["_models.EffectiveVirtualNetworksParameter"] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.EffectiveVirtualNetworksListResult"] + # type: (...) -> "_models.EffectiveVirtualNetworksListResult" """List effective virtual networks in a network manager. :param resource_group_name: The name of the resource group. @@ -69,10 +68,10 @@ def list_by_network_manager( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :param parameters: Effective Virtual Networks Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksParameter + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :return: EffectiveVirtualNetworksListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] @@ -81,73 +80,51 @@ def list_by_network_manager( } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = "application/json" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_network_manager.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) + # Construct URL + url = self.list_by_network_manager.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore def list_by_network_group( @@ -155,11 +132,10 @@ def list_by_network_group( resource_group_name, # type: str network_manager_name, # type: str network_group_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] + parameters, # type: "_models.QueryRequestOptions" **kwargs # type: Any ): - # type: (...) -> Iterable["_models.EffectiveVirtualNetworksListResult"] + # type: (...) -> "_models.EffectiveVirtualNetworksListResult" """Lists all effective virtual networks by specified network group. :param resource_group_name: The name of the resource group. @@ -168,16 +144,11 @@ def list_by_network_group( :type network_manager_name: str :param network_group_name: The name of the network group to get. :type network_group_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EffectiveVirtualNetworksListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.EffectiveVirtualNetworksListResult] + :return: EffectiveVirtualNetworksListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] @@ -186,58 +157,43 @@ def list_by_network_group( } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_network_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) + # Construct URL + url = self.list_by_network_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueryRequestOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized list_by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py index 05714e4b2e6..7a079d7d3a6 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py @@ -30,7 +30,7 @@ class NetworkGroupsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,7 +63,7 @@ def get( :type network_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -127,14 +127,14 @@ def create_or_update( :param network_group_name: The name of the network group to get. :type network_group_name: str :param parameters: Parameters supplied to the specify which network group need to create. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup :param if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -277,7 +277,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NetworkGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkGroupListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroupListResult"] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py index 6e3219b74bb..1c68982adfe 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py @@ -29,7 +29,7 @@ class NetworkManagerCommitsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -51,7 +51,7 @@ def post( parameters, # type: "_models.NetworkManagerCommit" **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> "_models.NetworkManagerCommit" """Post a Network Manager Commit. :param resource_group_name: The name of the resource group. @@ -59,13 +59,13 @@ def post( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network commit is. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerCommit + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: NetworkManagerCommit, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerCommit"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,11 +99,14 @@ def post( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize('NetworkManagerCommit', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py index 094b4e7243b..76556a8b989 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py @@ -9,7 +9,6 @@ import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -30,7 +29,7 @@ class NetworkManagerDeploymentStatusOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,29 +49,20 @@ def list( resource_group_name, # type: str network_manager_name, # type: str parameters, # type: "_models.NetworkManagerDeploymentStatusParameter" - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.NetworkManagerDeploymentStatusListResult"] - """Post List of Network Manager Deployment Status. + # type: (...) -> "_models.NetworkManagerDeploymentStatusListResult" + """Post to List of Network Manager Deployment Status. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network deployment status is. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusParameter - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusParameter :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerDeploymentStatusListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerDeploymentStatusListResult] + :return: NetworkManagerDeploymentStatusListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerDeploymentStatusListResult"] @@ -81,65 +71,42 @@ def list( } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = "application/json" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerDeploymentStatusListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerDeploymentStatusListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py new file mode 100644 index 00000000000..4305b69c894 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagerEffectiveSecurityAdminRulesOperations(object): + """NetworkManagerEffectiveSecurityAdminRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + virtual_network_name, # type: str + parameters, # type: "_models.QueryRequestOptions" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkManagerEffectiveSecurityAdminRulesListResult" + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueryRequestOptions') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py index d57668b4630..0174d552e5f 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py @@ -30,7 +30,7 @@ class NetworkManagersOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,7 +60,7 @@ def get( :type network_manager_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -119,10 +119,10 @@ def create_or_update( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which network manager is. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -246,10 +246,10 @@ def patch_tags( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to update network manager tags. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.TagsObject + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -316,7 +316,7 @@ def list_by_subscription( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] @@ -399,7 +399,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.NetworkManagerListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py similarity index 59% rename from src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py rename to src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py index e6c9b3fc5f0..5a3be1c8dea 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py @@ -23,14 +23,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class SecurityConfigurationsOperations(object): - """SecurityConfigurationsOperations operations. +class NetworkSecurityPerimetersOperations(object): + """NetworkSecurityPerimetersOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,35 +45,25 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def list( + def get( self, resource_group_name, # type: str - network_manager_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] + network_security_perimeter_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["_models.SecurityConfigurationListResult"] - """Lists all the network manager security configurations in a network manager, in a paginated - format. + # type: (...) -> "_models.NetworkSecurityPerimeter" + """Gets the specified network security perimeter by the name. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: 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. - :type skip_token: str + :param network_security_perimeter_name: The name of the network security perimeter. + :type network_security_perimeter_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationListResult] + :return: NetworkSecurityPerimeter, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -81,84 +71,61 @@ def list( api_version = "2021-02-01-preview" accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - def get_next(next_link=None): - request = prepare_request(next_link) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations'} # type: ignore + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - def import_method( + def create_or_update( self, resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - parameters, # type: "_models.NetworkManagerSecurityConfigurationImport" + network_security_perimeter_name, # type: str + parameters, # type: "_models.NetworkSecurityPerimeter" **kwargs # type: Any ): - # type: (...) -> "_models.SecurityConfigurationImportResult" - """Imports network security rules to network manager security rules. + # type: (...) -> "_models.NetworkSecurityPerimeter" + """Creates or updates a Network Security Perimeter. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :param parameters: Import Security configuration parameter. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :param network_security_perimeter_name: The name of the network security perimeter. + :type network_security_perimeter_name: str + :param parameters: Parameter supplied to create or update the network security perimeter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityConfigurationImportResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationImportResult + :return: NetworkSecurityPerimeter, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationImportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -168,12 +135,11 @@ def import_method( accept = "application/json" # Construct URL - url = self.import_method.metadata['url'] # type: ignore + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -187,45 +153,93 @@ def import_method( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') + body_content = self._serialize.body(parameters, 'NetworkSecurityPerimeter') body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityConfigurationImportResult', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/import'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - def evaluate_import( + def delete( self, resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - parameters, # type: "_models.NetworkManagerSecurityConfigurationImport" - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] + network_security_perimeter_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["_models.SecurityConfigurationRuleListResult"] - """The operation to evaluate import NSG to security configurations. + # type: (...) -> None + """Deletes a network security perimeter. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :param parameters: Import security configuration parameter. - :type parameters: ~azure.mgmt.network.v2021_02_preview.models.NetworkManagerSecurityConfigurationImport + :param network_security_perimeter_name: The name of the network security perimeter. + :type network_security_perimeter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore + + def list_by_subscription( + self, + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkSecurityPerimeterListResult"] + """List all network security perimeters in a subscription. + :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -234,33 +248,28 @@ def evaluate_import( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.SecurityConfigurationRuleListResult] + :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationRuleListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = "application/json" accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL - url = self.evaluate_import.metadata['url'] # type: ignore + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -271,21 +280,15 @@ def prepare_request(next_link=None): if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerSecurityConfigurationImport') - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationRuleListResult', pipeline_response) + deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -306,202 +309,88 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - evaluate_import.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/evaluateImport'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore - def get( - self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityConfiguration" - """Retrieves a network manager security Configuration. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SecurityConfiguration', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore - - def create_or_update( + def list( self, resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - security_configuration, # type: "_models.SecurityConfiguration" + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "_models.SecurityConfiguration" - """Creates or updates a network manager security Configuration. + # type: (...) -> Iterable["_models.NetworkSecurityPerimeterListResult"] + """List network security perimeters in a resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :param security_configuration: The security configuration to create or update. - :type security_configuration: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.SecurityConfiguration + :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") accept = "application/json" - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_configuration, 'SecurityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('SecurityConfiguration', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('SecurityConfiguration', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Deletes a network manager security Configuration. + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. - :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + def get_next(next_link=None): + request = prepare_request(next_link) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + return pipeline_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}'} # type: ignore + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py new file mode 100644 index 00000000000..80c30a1f635 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py @@ -0,0 +1,101 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PerimeterAssociableResourceTypesOperations(object): + """PerimeterAssociableResourceTypesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PerimeterAssociableResourcesListResult" + """Gets the list of resources that are onboarded with NSP. These resources can be associated with + a network security perimeter. + + :param location: The location of the where the association is present. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PerimeterAssociableResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PerimeterAssociableResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PerimeterAssociableResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/perimeterAssociableResourceTypes'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py new file mode 100644 index 00000000000..ba11d9a55e7 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py @@ -0,0 +1,333 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SecurityAdminConfigurationsOperations(object): + """SecurityAdminConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SecurityConfigurationListResult"] + """Lists all the network manager security admin configurations in a network manager, in a + paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfiguration" + """Retrieves a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + security_admin_configuration, # type: "_models.SecurityConfiguration" + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfiguration" + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. + :type security_admin_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(security_admin_configuration, 'SecurityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py new file mode 100644 index 00000000000..b3befcb62c6 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py @@ -0,0 +1,333 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SecurityUserConfigurationsOperations(object): + """SecurityUserConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SecurityConfigurationListResult"] + """Lists all the network manager security user configurations in a network manager, in a paginated + format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfiguration" + """Retrieves a network manager security user configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + security_user_configuration, # type: "_models.SecurityConfiguration" + **kwargs # type: Any + ): + # type: (...) -> "_models.SecurityConfiguration" + """Creates or updates a network manager security user configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param security_user_configuration: The security user configuration to create or update. + :type security_user_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(security_user_configuration, 'SecurityConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network manager security user configuration. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py new file mode 100644 index 00000000000..a0b0d83a485 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py @@ -0,0 +1,351 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class UserRuleCollectionsOperations(object): + """UserRuleCollectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RuleCollectionListResult"] + """Lists all the user rule collections in a security configuration, in a paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: 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. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RuleCollection" + """Gets a network manager security user configuration rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_collection_name, # type: str + user_rule_collection, # type: "_models.RuleCollection" + **kwargs # type: Any + ): + # type: (...) -> "_models.RuleCollection" + """Creates or updates a user rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :param user_rule_collection: The User Rule Collection to create or update. + :type user_rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleCollection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(user_rule_collection, 'RuleCollection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RuleCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_manager_name, # type: str + configuration_name, # type: str + rule_collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a user rule collection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param configuration_name: The name of the network manager security Configuration. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py index 4e0b2665654..8d787a37c8e 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py @@ -30,7 +30,7 @@ class UserRulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_preview.models + :type models: ~azure.mgmt.network.v2021_02_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,12 +50,13 @@ def list( resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str top=None, # type: Optional[int] skip_token=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> Iterable["_models.UserRuleListResult"] - """Lists all user rules in a security configuration. + """Lists all user rules in a rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -63,6 +64,9 @@ def list( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -72,7 +76,7 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_preview.models.UserRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.UserRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRuleListResult"] @@ -96,6 +100,7 @@ def prepare_request(next_link=None): 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -135,17 +140,18 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore def get( self, resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.UserRule" + # type: (...) -> "_models.BaseUserRule" """Gets a user rule. :param resource_group_name: The name of the resource group. @@ -154,14 +160,17 @@ def get( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: UserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :return: BaseUserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,6 +185,7 @@ def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -196,24 +206,25 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('UserRule', pipeline_response) + deserialized = self._deserialize('BaseUserRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore def create_or_update( self, resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str rule_name, # type: str - user_rule, # type: "_models.UserRule" + user_rule, # type: "_models.BaseUserRule" **kwargs # type: Any ): - # type: (...) -> "_models.UserRule" + # type: (...) -> "_models.BaseUserRule" """Creates or updates a user rule. :param resource_group_name: The name of the resource group. @@ -222,16 +233,19 @@ def create_or_update( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :param user_rule: The user rule to create or update. - :type user_rule: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :type user_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule :keyword callable cls: A custom type or function that will be passed the direct response - :return: UserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_preview.models.UserRule + :return: BaseUserRule, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -247,6 +261,7 @@ def create_or_update( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -261,7 +276,7 @@ def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user_rule, 'UserRule') + body_content = self._serialize.body(user_rule, 'BaseUserRule') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -272,22 +287,23 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('UserRule', pipeline_response) + deserialized = self._deserialize('BaseUserRule', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('UserRule', pipeline_response) + deserialized = self._deserialize('BaseUserRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore def delete( self, resource_group_name, # type: str network_manager_name, # type: str configuration_name, # type: str + rule_collection_name, # type: str rule_name, # type: str **kwargs # type: Any ): @@ -300,6 +316,9 @@ def delete( :type network_manager_name: str :param configuration_name: The name of the network manager security Configuration. :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. + :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -322,6 +341,7 @@ def delete( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -345,4 +365,4 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityConfigurations/{configurationName}/userRules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore From 4bde1785bdb672ecb29449c18f0da101b6f7951f Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 30 Aug 2021 17:07:19 +0800 Subject: [PATCH 07/28] add test for group, adminconfig, userconfig --- .../azext_network_manager/_client_factory.py | 8 +- .../azext_network_manager/_help.py | 139 +++---- .../azext_network_manager/_params.py | 108 +++--- .../azext_network_manager/action.py | 8 +- .../azext_network_manager/commands.py | 34 +- .../azext_network_manager/custom.py | 186 ++++----- .../test_network_manager_group_crud.yaml | 355 ++++++++++++++++++ ...rk_manager_security_admin_config_crud.yaml | 349 +++++++++++++++++ ...ork_manager_security_user_config_crud.yaml | 349 +++++++++++++++++ .../tests/latest/test_network_scenario.py | 86 ++++- 10 files changed, 1381 insertions(+), 241 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml diff --git a/src/network-manager/azext_network_manager/_client_factory.py b/src/network-manager/azext_network_manager/_client_factory.py index acf2c427cd7..fd92d329eb3 100644 --- a/src/network-manager/azext_network_manager/_client_factory.py +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -47,8 +47,12 @@ def cf_networkgroup(cli_ctx, *_): return cf_network_cl(cli_ctx).network_groups -def cf_securityconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).security_configurations +def cf_securityuserconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).security_user_configurations + + +def cf_securityadminconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).security_admin_configurations def cf_adminrule(cli_ctx, *_): diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index f007667847b..88aa5ffb218 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -286,7 +286,7 @@ text: |- az network manager group create --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ --description "A sample group" --conditional-membership "" --display-name "My Network Group" --group-members \ -resource-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" \ +vnet-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" subnet-id="" \ --member-type "VirtualNetwork" --resource-group "rg1" """ @@ -314,123 +314,108 @@ --resource-group "rg1" """ -helps['network manager security-config'] = """ +helps['network manager security-user-config'] = """ type: group - short-summary: Manage securityconfiguration with network + short-summary: Manage securityuserconfiguration with network """ -helps['network manager security-config list'] = """ +helps['network manager security-user-config list'] = """ type: command - short-summary: "Lists all the network manager security configurations in a network manager, in a paginated \ + short-summary: "Lists all the network manager security user configurations in a network manager, in a paginated \ format." examples: - - name: List security configurations in a network manager + - name: List security user configurations in a network manager text: |- - az network manager security-config list --network-manager-name "testNetworkManager" --resource-group \ + az network manager security-user-config list --network-manager-name "testNetworkManager" --resource-group \ "rg1" """ -helps['network manager security-config show'] = """ +helps['network manager security-user-config show'] = """ type: command - short-summary: "Retrieves a network manager security Configuration." + short-summary: "Retrieves a network manager security user Configuration." examples: - - name: Get security configurations + - name: Get security user configurations text: |- - az network manager security-config show --configuration-name "myTestSecurityConfig" \ + az network manager security-user-config show --configuration-name "myTestSecurityConfig" \ --network-manager-name "testNetworkManager" --resource-group "rg1" """ -helps['network manager security-config create'] = """ +helps['network manager security-user-config create'] = """ type: command - short-summary: "Create a network manager security Configuration." - parameters: - - name: --applies-to-groups - short-summary: "Groups for configuration" - long-summary: | - Usage: --applies-to-groups network-group-id=XX - - network-group-id: Network manager group Id. - - Multiple actions can be specified by using more than one --applies-to-groups argument. + short-summary: "Create a network manager security user Configuration." examples: - - name: Create network manager security Configuration + - name: Create network manager security user Configuration text: |- - az network manager security-config create --configuration-name "myTestSecurityConfig" \ ---network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" --applies-to-groups \ -network-group-id="/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManage\ -r/networkGroups/testGroup" --delete-existing-ns-gs true --security-type "UserPolicy" + az network manager security-user-config create --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" \ +--delete-existing-ns-gs true --security-type "UserPolicy" """ -helps['network manager security-config update'] = """ +helps['network manager security-user-config update'] = """ type: command - short-summary: "Update a network manager security Configuration." - parameters: - - name: --applies-to-groups - short-summary: "Groups for configuration" - long-summary: | - Usage: --applies-to-groups network-group-id=XX - - network-group-id: Network manager group Id. - - Multiple actions can be specified by using more than one --applies-to-groups argument. + short-summary: "Update a network manager security user Configuration." """ -helps['network manager security-config delete'] = """ +helps['network manager security-user-config delete'] = """ type: command - short-summary: "Deletes a network manager security Configuration." + short-summary: "Deletes a network manager security user Configuration." examples: - - name: Delete network manager security Configuration + - name: Delete network manager security user Configuration text: |- - az network manager security-config delete --configuration-name "myTestSecurityConfig" \ + az network manager security-user-config delete --configuration-name "myTestSecurityConfig" \ --network-manager-name "testNetworkManager" --resource-group "rg1" """ -helps['network manager security-config evaluate-import'] = """ - type: command - short-summary: "The operation to evaluate import NSG to security configurations." - parameters: - - name: --network-security-group-imports - short-summary: "List of nsg uris." - long-summary: | - Usage: --network-security-group-imports network-security-group-uri=XX +helps['network manager security-admin-config'] = """ + type: group + short-summary: Manage securityadminconfiguration with network +""" - network-security-group-uri: Network Security Group Uri. +helps['network manager security-admin-config list'] = """ + type: command + short-summary: "Lists all the network manager security admin configurations in a network manager, in a paginated \ +format." + examples: + - name: List security admin configurations in a network manager + text: |- + az network manager security-admin-config list --network-manager-name "testNetworkManager" --resource-group \ +"rg1" +""" - Multiple actions can be specified by using more than one --network-security-group-imports argument. +helps['network manager security-admin-config show'] = """ + type: command + short-summary: "Retrieves a network manager security admin Configuration." examples: - - name: Evaluate import NSG Rules + - name: Get security admin configurations text: |- - az network manager security-config evaluate-import --configuration-name "myTestConfig" \ ---network-manager-name "testNetworkManager" --admin-security-configuration-uri "/subscriptions/subId/resourceGroups/rg1\ -/providers/Microsoft.Network/networkManagers/testNetworkManager/securityConfigurations/adminConfig" \ ---import-deny-rules-as-admin-rules true --network-security-group-imports network-security-group-uri="/subscriptions/sub\ -id/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1" \ ---remove-allow-azure-load-balancer-inbound-rule true --remove-allow-internet-outbound-rule true \ ---remove-allow-vnet-inbound-rule true --remove-allow-vnet-outbound-rule true --resource-group "rg1" + az network manager security-admin-config show --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" """ -helps['network manager security-config import'] = """ +helps['network manager security-admin-config create'] = """ type: command - short-summary: "Imports network security rules to network manager security rules." - parameters: - - name: --network-security-group-imports - short-summary: "List of nsg uris." - long-summary: | - Usage: --network-security-group-imports network-security-group-uri=XX + short-summary: "Create a network manager security admin Configuration." + examples: + - name: Create network manager security admin Configuration + text: |- + az network manager security-admin-config create --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" \ +--delete-existing-ns-gs true --security-type "AdminPolicy" +""" - network-security-group-uri: Network Security Group Uri. +helps['network manager security-admin-config update'] = """ + type: command + short-summary: "Update a network manager security admin Configuration." +""" - Multiple actions can be specified by using more than one --network-security-group-imports argument. +helps['network manager security-admin-config delete'] = """ + type: command + short-summary: "Deletes a network manager security admin Configuration." examples: - - name: Import NSG Rules + - name: Delete network manager security admin Configuration text: |- - az network manager security-config import --configuration-name "myTestConfig" --network-manager-name \ -"testNetworkManager" --admin-security-configuration-uri "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Ne\ -twork/networkManagers/testNetworkManager/securityConfigurations/adminConfig" --import-deny-rules-as-admin-rules true \ ---network-security-group-imports network-security-group-uri="/subscriptions/subid/resourceGroups/rg1/providers/Microsof\ -t.Network/networkSecurityGroups/testnsg/securityRules/rule1" --remove-allow-azure-load-balancer-inbound-rule true \ ---remove-allow-internet-outbound-rule true --remove-allow-vnet-inbound-rule true --remove-allow-vnet-outbound-rule \ -true --resource-group "rg1" + az network manager security-admin-config delete --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" """ helps['network manager admin-rule'] = """ diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 23a10156a05..6c16f488d08 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -28,8 +28,6 @@ AddDestination ) -from azext_network_manager.vendored_sdks.models import ScopeAccesses - def load_arguments(self, _): @@ -60,7 +58,8 @@ def load_arguments(self, _): c.argument('description', type=str, help='A description of the network manager.') c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network ' 'Manager.') - c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access.', arg_type=get_enum_type(ScopeAccesses)) + c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access. Available value: SecurityAdmin, ' + 'SecurityUser, Connectivity.') with self.argument_context('network manager update') as c: c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str, @@ -72,7 +71,8 @@ def load_arguments(self, _): c.argument('description', type=str, help='A description of the network manager.') c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network ' 'Manager.') - c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access.') + c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access. Available value: SecurityAdmin, ' + 'SecurityUser, Connectivity.') c.ignore('parameters') with self.argument_context('network manager delete') as c: @@ -194,7 +194,7 @@ def load_arguments(self, _): with self.argument_context('network manager group list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -203,13 +203,13 @@ def load_arguments(self, _): with self.argument_context('network manager group show') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.', id_part='name') c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' 'name of the network group to get.', id_part='child_name_1') with self.argument_context('network manager group create') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.') c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' 'name of the network group to get.') c.argument('if_match', type=str, help='The ETag of the transformation. Omit this value to always overwrite the ' @@ -223,7 +223,7 @@ def load_arguments(self, _): with self.argument_context('network manager group update') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.', id_part='name') c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' 'name of the network group to get.', id_part='child_name_1') c.argument('if_match', type=str, help='The ETag of the transformation. Omit this value to always overwrite the ' @@ -238,11 +238,11 @@ def load_arguments(self, _): with self.argument_context('network manager group delete') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.', id_part='name') c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' 'name of the network group to get.', id_part='child_name_1') - with self.argument_context('network manager security-config list') as c: + with self.argument_context('network manager security-user-config list') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' @@ -251,13 +251,13 @@ def load_arguments(self, _): '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('network manager security-config show') as c: + with self.argument_context('network manager security-user-config show') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') - with self.argument_context('network manager security-config create') as c: + with self.argument_context('network manager security-user-config create') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') @@ -266,10 +266,8 @@ def load_arguments(self, _): c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.') c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing ' 'network security groups.') - c.argument('applies_to_groups', action=AddSecurityconfigurationsAppliesToGroups, nargs='+', help='Groups for ' - 'configuration') - with self.argument_context('network manager security-config update') as c: + with self.argument_context('network manager security-user-config update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', @@ -279,69 +277,67 @@ def load_arguments(self, _): c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.') c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing ' 'network security groups.') - c.argument('applies_to_groups', action=AddSecurityconfigurationsAppliesToGroups, nargs='+', help='Groups for ' - 'configuration') c.ignore('security_configuration') - with self.argument_context('network manager security-config delete') as c: + with self.argument_context('network manager security-user-config delete') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') - with self.argument_context('network manager security-config evaluate-import') as c: + with self.argument_context('network manager admin-rule list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', - id_part='child_name_1') + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, 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.') - c.argument('network_security_group_imports', action=AddNetworkSecurityGroupImports, nargs='+', help='List of ' - 'nsg uris.') - c.argument('import_deny_rules_as_admin_rules', arg_type=get_three_state_flag(), help='Flag if import deny ' - 'rules as admin rules.') - c.argument('admin_security_configuration_uri', type=str, help='Admin security configuration Uri.') - c.argument('remove_allow_vnet_inbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' - 'allow vnet inbound rule.') - c.argument('remove_allow_azure_load_balancer_inbound_rule', arg_type=get_three_state_flag(), help='Flag if ' - 'need to remove allow azure load balancer inbound rule.') - c.argument('remove_allow_vnet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' - 'allow vnet outbound rule.') - c.argument('remove_allow_internet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to ' - 'remove allow Internet outbound rule.') - - with self.argument_context('network manager security-config import') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', - id_part='child_name_1') - c.argument('network_security_group_imports', action=AddNetworkSecurityGroupImports, nargs='+', help='List of ' - 'nsg uris.') - c.argument('import_deny_rules_as_admin_rules', arg_type=get_three_state_flag(), help='Flag if import deny ' - 'rules as admin rules.') - c.argument('admin_security_configuration_uri', type=str, help='Admin security configuration Uri.') - c.argument('remove_allow_vnet_inbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' - 'allow vnet inbound rule.') - c.argument('remove_allow_azure_load_balancer_inbound_rule', arg_type=get_three_state_flag(), help='Flag if ' - 'need to remove allow azure load balancer inbound rule.') - c.argument('remove_allow_vnet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to remove ' - 'allow vnet outbound rule.') - c.argument('remove_allow_internet_outbound_rule', arg_type=get_three_state_flag(), help='Flag if need to ' - 'remove allow Internet outbound rule.') - with self.argument_context('network manager admin-rule list') as c: + with self.argument_context('network manager security-admin-config list') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, 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('network manager security-admin-config show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + + with self.argument_context('network manager security-admin-config create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') + c.argument('display_name', type=str, help='A display name of the security Configuration.') + c.argument('description', type=str, help='A description of the security Configuration.') + c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.') + c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing ' + 'network security groups.') + + with self.argument_context('network manager security-admin-config update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('display_name', type=str, help='A display name of the security Configuration.') + c.argument('description', type=str, help='A description of the security Configuration.') + c.argument('security_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy']), help='Security Type.') + c.argument('delete_existing_ns_gs', arg_type=get_three_state_flag(), help='Flag if need to delete existing ' + 'network security groups.') + c.ignore('security_configuration') + + with self.argument_context('network manager security-admin-config delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + with self.argument_context('network manager admin-rule show') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') diff --git a/src/network-manager/azext_network_manager/action.py b/src/network-manager/azext_network_manager/action.py index e0c9776a16f..b372311523f 100644 --- a/src/network-manager/azext_network_manager/action.py +++ b/src/network-manager/azext_network_manager/action.py @@ -89,11 +89,13 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'resource-id': - d['resource_id'] = v[0] + if kl == 'vnet-id': + d['vnet_id'] = v[0] + elif kl == 'subnet-id': + d['subnet_id'] = v[0] else: raise CLIError('Unsupported Key {} is provided for parameter group_members. All possible keys are: ' - 'resource-id'.format(k)) + 'resource-id, subnet-id'.format(k)) return d diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index f5a0cddeb57..9306a60579a 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -14,7 +14,7 @@ from azext_network_manager._client_factory import ( cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, cf_effectivevirtualnetwork, cf_activeconfiguration, cf_connectivityconfiguration, cf_effectiveconfiguration, cf_networkgroup, cf_userrule, - cf_adminrule, cf_securityconfiguration) + cf_adminrule, cf_securityadminconfiguration, cf_securityuserconfiguration) def load_command_table(self, _): @@ -57,9 +57,14 @@ def load_command_table(self, _): client_factory=cf_networkgroup ) - network_securityconfiguration = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._security_configurations_operations#SecurityConfigurationsOperations.{}', - client_factory=cf_securityconfiguration + network_securityuserconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._security_user_configurations_operations#SecurityUserConfigurationsOperations.{}', + client_factory=cf_securityuserconfiguration + ) + + network_securityadminconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._security_admin_configurations_operations#SecurityAdminConfigurationsOperations.{}', + client_factory=cf_securityadminconfiguration ) network_adminrule = CliCommandType( @@ -110,14 +115,19 @@ def load_command_table(self, _): g.generic_update_command('update', custom_func_name='network_manager_group_update') g.custom_command('delete', 'network_manager_group_delete', confirmation=True) - with self.command_group('network manager security-config', network_securityconfiguration, client_factory=cf_securityconfiguration) as g: - g.custom_command('list', 'network_manager_security_config_list') - g.custom_show_command('show', 'network_manager_security_config_show') - g.custom_command('create', 'network_manager_security_config_create') - g.generic_update_command('update', setter_arg_name='security_configuration', custom_func_name='network_manager_security_config_update') - g.custom_command('delete', 'network_manager_security_config_delete', confirmation=True) - g.custom_command('evaluate-import', 'network_manager_security_config_evaluate_import') - g.custom_command('import', 'network_manager_security_config_import') + with self.command_group('network manager security-user-config', network_securityuserconfiguration, client_factory=cf_securityuserconfiguration) as g: + g.custom_command('list', 'network_manager_security_user_config_list') + g.custom_show_command('show', 'network_manager_security_user_config_show') + g.custom_command('create', 'network_manager_security_user_config_create') + g.generic_update_command('update', setter_arg_name='security_user_configuration', custom_func_name='network_manager_security_user_config_update') + g.custom_command('delete', 'network_manager_security_user_config_delete', confirmation=True) + + with self.command_group('network manager security-admin-config', network_securityadminconfiguration, client_factory=cf_securityadminconfiguration) as g: + g.custom_command('list', 'network_manager_security_admin_config_list') + g.custom_show_command('show', 'network_manager_security_admin_config_show') + g.custom_command('create', 'network_manager_security_admin_config_create') + g.generic_update_command('update', setter_arg_name='security_admin_configuration', custom_func_name='network_manager_security_admin_config_update') + g.custom_command('delete', 'network_manager_security_admin_config_delete', confirmation=True) with self.command_group('network manager admin-rule', network_adminrule, client_factory=cf_adminrule) as g: g.custom_command('list', 'network_manager_admin_rule_list') diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index b99b0899cff..d4920ac6f5c 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -325,56 +325,53 @@ def network_manager_group_delete(client, network_group_name=network_group_name) -def network_manager_security_config_list(client, - resource_group_name, - network_manager_name, - top=None, - skip_token=None): +def network_manager_security_user_config_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, top=top, skip_token=skip_token) -def network_manager_security_config_show(client, - resource_group_name, - network_manager_name, - configuration_name): +def network_manager_security_user_config_show(client, + resource_group_name, + network_manager_name, + configuration_name): return client.get(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name) -def network_manager_security_config_create(client, - resource_group_name, - network_manager_name, - configuration_name, - display_name=None, - description=None, - security_type=None, - delete_existing_ns_gs=None, - applies_to_groups=None): +def network_manager_security_user_config_create(client, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + security_type=None, + delete_existing_ns_gs=None): security_configuration = {} security_configuration['display_name'] = display_name security_configuration['description'] = description security_configuration['security_type'] = security_type security_configuration['delete_existing_ns_gs'] = delete_existing_ns_gs - security_configuration['applies_to_groups'] = applies_to_groups return client.create_or_update(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, - security_configuration=security_configuration) - - -def network_manager_security_config_update(instance, - resource_group_name, - network_manager_name, - configuration_name, - display_name=None, - description=None, - security_type=None, - delete_existing_ns_gs=None, - applies_to_groups=None): + security_user_configuration=security_configuration) + + +def network_manager_security_user_config_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + security_type=None, + delete_existing_ns_gs=None): if display_name is not None: instance.display_name = display_name if description is not None: @@ -383,72 +380,83 @@ def network_manager_security_config_update(instance, instance.security_type = security_type if delete_existing_ns_gs is not None: instance.delete_existing_ns_gs = delete_existing_ns_gs - if applies_to_groups is not None: - instance.applies_to_groups = applies_to_groups return instance -def network_manager_security_config_delete(client, - resource_group_name, - network_manager_name, - configuration_name): +def network_manager_security_user_config_delete(client, + resource_group_name, + network_manager_name, + configuration_name): return client.delete(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name) -def network_manager_security_config_evaluate_import(client, - resource_group_name, - network_manager_name, - configuration_name, - top=None, - skip_token=None, - network_security_group_imports=None, - import_deny_rules_as_admin_rules=None, - admin_security_configuration_uri=None, - remove_allow_vnet_inbound_rule=None, - remove_allow_azure_load_balancer_inbound_rule=None, - remove_allow_vnet_outbound_rule=None, - remove_allow_internet_outbound_rule=None): - parameters = {} - parameters['network_security_group_imports'] = network_security_group_imports - parameters['import_deny_rules_as_admin_rules'] = import_deny_rules_as_admin_rules - parameters['admin_security_configuration_uri'] = admin_security_configuration_uri - parameters['remove_allow_vnet_inbound_rule'] = remove_allow_vnet_inbound_rule - parameters['remove_allow_azure_load_balancer_inbound_rule'] = remove_allow_azure_load_balancer_inbound_rule - parameters['remove_allow_vnet_outbound_rule'] = remove_allow_vnet_outbound_rule - parameters['remove_allow_internet_outbound_rule'] = remove_allow_internet_outbound_rule - return client.evaluate_import(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - configuration_name=configuration_name, - top=top, - skip_token=skip_token, - parameters=parameters) - - -def network_manager_security_config_import(client, - resource_group_name, - network_manager_name, - configuration_name, - network_security_group_imports=None, - import_deny_rules_as_admin_rules=None, - admin_security_configuration_uri=None, - remove_allow_vnet_inbound_rule=None, - remove_allow_azure_load_balancer_inbound_rule=None, - remove_allow_vnet_outbound_rule=None, - remove_allow_internet_outbound_rule=None): - parameters = {} - parameters['network_security_group_imports'] = network_security_group_imports - parameters['import_deny_rules_as_admin_rules'] = import_deny_rules_as_admin_rules - parameters['admin_security_configuration_uri'] = admin_security_configuration_uri - parameters['remove_allow_vnet_inbound_rule'] = remove_allow_vnet_inbound_rule - parameters['remove_allow_azure_load_balancer_inbound_rule'] = remove_allow_azure_load_balancer_inbound_rule - parameters['remove_allow_vnet_outbound_rule'] = remove_allow_vnet_outbound_rule - parameters['remove_allow_internet_outbound_rule'] = remove_allow_internet_outbound_rule - return client.import_method(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - configuration_name=configuration_name, - parameters=parameters) +def network_manager_security_admin_config_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token) + + +def network_manager_security_admin_config_show(client, + resource_group_name, + network_manager_name, + configuration_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name) + + +def network_manager_security_admin_config_create(client, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + security_type=None, + delete_existing_ns_gs=None): + security_configuration = {} + security_configuration['display_name'] = display_name + security_configuration['description'] = description + security_configuration['security_type'] = security_type + security_configuration['delete_existing_ns_gs'] = delete_existing_ns_gs + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + security_admin_configuration=security_configuration) + + +def network_manager_security_admin_config_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + display_name=None, + description=None, + security_type=None, + delete_existing_ns_gs=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if security_type is not None: + instance.security_type = security_type + if delete_existing_ns_gs is not None: + instance.delete_existing_ns_gs = delete_existing_ns_gs + return instance + + +def network_manager_security_admin_config_delete(client, + resource_group_name, + network_manager_name, + configuration_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name) def network_manager_admin_rule_list(client, diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml new file mode 100644 index 00000000000..2b32a8a5e01 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml @@ -0,0 +1,355 @@ +interactions: +- request: + body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["Routing", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '283' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"75c61c09-243e-4319-a166-d041ea316bdf"}}' + headers: + cache-control: + - no-cache + content-length: + - '683' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 03:01:37 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyNetworkGroup", "description": "A sample + group", "memberType": "VirtualNetwork", "groupMembers": [{"vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002", + "subnetId": ""}], "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '404' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"A + sample group","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + headers: + cache-control: + - no-cache + content-length: + - '770' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 03:01:40 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group update + Connection: + - keep-alive + ParameterSetName: + - -g --name --network-manager-name --description + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"04002901-0000-4e00-0000-612c4a140000\"","properties":{"displayName":"MyNetworkGroup","description":"A + sample group","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + headers: + cache-control: + - no-cache + content-length: + - '810' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 03:01:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyNetworkGroup", "description": "Desc changed.", + "groupMembers": [{"vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group update + Connection: + - keep-alive + Content-Length: + - '355' + Content-Type: + - application/json + ParameterSetName: + - -g --name --network-manager-name --description + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"Desc + changed.","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + headers: + cache-control: + - no-cache + content-length: + - '769' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 03:01:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group show + Connection: + - keep-alive + ParameterSetName: + - -g --name --network-manager-name + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"04003001-0000-4e00-0000-612c4a190000\"","properties":{"displayName":"MyNetworkGroup","description":"Desc + changed.","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + headers: + cache-control: + - no-cache + content-length: + - '809' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 03:01:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group list + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"Desc + changed.","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '795' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 03:01:50 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --yes + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 30 Aug 2021 03:01:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml new file mode 100644 index 00000000000..4e4252264bd --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml @@ -0,0 +1,349 @@ +interactions: +- request: + body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityAdmin", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '289' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"3f5dc528-047c-4e7d-b9fe-229ff6428393"}}' + headers: + cache-control: + - no-cache + content-length: + - '689' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:57:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample + policy", "securityType": "AdminPolicy", "deleteExistingNSGs": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config create + Connection: + - keep-alive + Content-Length: + - '142' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs + --security-type --display-name + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + headers: + cache-control: + - no-cache + content-length: + - '536' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:58:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config update + Connection: + - keep-alive + ParameterSetName: + - --configuration-name --network-manager-name -g --description + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0400a030-0000-4e00-0000-612c9d9b0000\"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + headers: + cache-control: + - no-cache + content-length: + - '576' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:58:06 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "test_description"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config update + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + headers: + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:58:08 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config list + Connection: + - keep-alive + ParameterSetName: + - --network-manager-name -g + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0400a130-0000-4e00-0000-612c9da00000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '603' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:58:10 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config show + Connection: + - keep-alive + ParameterSetName: + - --configuration-name --network-manager-name -g + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0400a130-0000-4e00-0000-612c9da00000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + headers: + cache-control: + - no-cache + content-length: + - '577' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:58:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --configuration-name --network-manager-name -g --yes + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 30 Aug 2021 08:58:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml new file mode 100644 index 00000000000..ccc6fdfcdae --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml @@ -0,0 +1,349 @@ +interactions: +- request: + body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityUser", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '288' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityUser","Connectivity"],"resourceGuid":"cd0574ac-49b7-44c4-8f17-994755f972f1"}}' + headers: + cache-control: + - no-cache + content-length: + - '688' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:53:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample + policy", "securityType": "UserPolicy", "deleteExistingNSGs": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config create + Connection: + - keep-alive + Content-Length: + - '141' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs + --security-type --display-name + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + headers: + cache-control: + - no-cache + content-length: + - '534' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:53:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config update + Connection: + - keep-alive + ParameterSetName: + - --configuration-name --network-manager-name -g --description + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"04000430-0000-4e00-0000-612c9ca60000\"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + headers: + cache-control: + - no-cache + content-length: + - '574' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:54:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "test_description"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config update + Connection: + - keep-alive + Content-Length: + - '82' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + headers: + cache-control: + - no-cache + content-length: + - '535' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:54:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config list + Connection: + - keep-alive + ParameterSetName: + - --network-manager-name -g + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"04000a30-0000-4e00-0000-612c9cab0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '601' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:54:05 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config show + Connection: + - keep-alive + ParameterSetName: + - --configuration-name --network-manager-name -g + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"04000a30-0000-4e00-0000-612c9cab0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + headers: + cache-control: + - no-cache + content-length: + - '575' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Aug 2021 08:54:07 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --configuration-name --network-manager-name -g --yes + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 30 Aug 2021 08:54:11 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 7f567d18297..e697d78e447 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -10,6 +10,7 @@ # pylint: disable=line-too-long import os +import unittest from azure.cli.testsdk import ScenarioTest from azure.cli.testsdk import ResourceGroupPreparer @@ -32,14 +33,12 @@ def test_network_manager_crud(self, resource_group): 'name': 'TestNetworkManager', 'description': '"My Test Network Manager"', 'display_name': 'TestNetworkManager', - 'mg': '/providers/Microsoft.Management/managementGroups/azure-cli-management-groupxk66tmjjbhwp72', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()) }) self.cmd('network manager create --name {name} --description {description} --display-name {display_name} ' '--network-manager-scope-accesses "Routing" "Connectivity" ' '--network-manager-scopes ' - # 'management-groups={mg} ' ' subscriptions={sub} ' '-l jioindiawest ' '--resource-group {rg}') @@ -51,3 +50,86 @@ def test_network_manager_crud(self, resource_group): self.cmd('network manager delete --resource-group {rg} --name {name} --yes') + @ResourceGroupPreparer(name_prefix='test_network_manager_group', location='jioindiawest') + @VirtualNetworkPreparer() + def test_network_manager_group_crud(self, virtual_network, resource_group): + + self.kwargs.update({ + 'name': 'TestNetworkGroup', + 'manager_name': 'TestNetworkManager', + 'description': '"A sample group"', + 'display_name': 'MyNetworkGroup', + 'member_type': 'VirtualNetwork', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "Routing" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l jioindiawest ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name {display_name} --member-type {member_type} -g {rg} ' + '--group-members vnet-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ' + 'subnet-id=""') + + self.cmd('network manager group update -g {rg} --name {name} --network-manager-name {manager_name} --description "Desc changed."') + self.cmd('network manager group show -g {rg} --name {name} --network-manager-name {manager_name}') + self.cmd('network manager group list -g {rg} --network-manager-name {manager_name}') + self.cmd('network manager group delete -g {rg} --name {name} --network-manager-name {manager_name} --yes') + + @ResourceGroupPreparer(name_prefix='test_network_manager_security_user_config', location='jioindiawest') + def test_network_manager_security_user_config_crud(self, resource_group): + + self.kwargs.update({ + 'name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l jioindiawest ' + '--resource-group {rg}') + + self.cmd('network manager security-user-config create --configuration-name {name} --network-manager-name {manager_name} -g {rg} ' + '--description {description} --delete-existing-ns-gs true --security-type "UserPolicy" --display-name MyTestConfig') + + self.cmd('network manager security-user-config update --configuration-name {name} --network-manager-name {manager_name} -g {rg} ' + '--description "test_description"') + self.cmd('network manager security-user-config list --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager security-user-config show --configuration-name {name} --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager security-user-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') + + @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_config', location='jioindiawest') + def test_network_manager_security_admin_config_crud(self, resource_group): + + self.kwargs.update({ + 'name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l jioindiawest ' + '--resource-group {rg}') + + self.cmd('network manager security-admin-config create --configuration-name {name} --network-manager-name {manager_name} -g {rg} ' + '--description {description} --delete-existing-ns-gs true --security-type "AdminPolicy" --display-name MyTestConfig') + + self.cmd('network manager security-admin-config update --configuration-name {name} --network-manager-name {manager_name} -g {rg} ' + '--description "test_description"') + self.cmd('network manager security-admin-config list --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager security-admin-config show --configuration-name {name} --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') + From fdfaafe67aefafcd1b1a6fe8da7941328bc45823 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Fri, 3 Sep 2021 10:39:51 +0800 Subject: [PATCH 08/28] complete command set --- .../azext_network_manager/_client_factory.py | 35 +- .../azext_network_manager/_help.py | 4 +- .../azext_network_manager/_params.py | 49 +- .../azext_network_manager/commands.py | 91 +++- .../azext_network_manager/custom.py | 420 ++++++++++++++++-- ...r_security_admin_rule_collection_crud.yaml | 57 +++ .../tests/latest/test_network_scenario.py | 38 ++ 7 files changed, 656 insertions(+), 38 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml diff --git a/src/network-manager/azext_network_manager/_client_factory.py b/src/network-manager/azext_network_manager/_client_factory.py index fd92d329eb3..d420562cf93 100644 --- a/src/network-manager/azext_network_manager/_client_factory.py +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -31,8 +31,24 @@ def cf_effectivevirtualnetwork(cli_ctx, *_): return cf_network_cl(cli_ctx).effective_virtual_networks -def cf_activeconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).active_configurations +def cf_activeconnectivityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_connectivity_configurations + + +def cf_effectiveconnectivityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).effective_connectivity_configurations + + +def cf_effectivesecurityadminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_effective_security_admin_rules + + +def cf_activesecurityadminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_security_admin_rules + + +def cf_activesecurityuserrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_security_user_rules def cf_connectivityconfiguration(cli_ctx, *_): @@ -47,6 +63,14 @@ def cf_networkgroup(cli_ctx, *_): return cf_network_cl(cli_ctx).network_groups +def cf_securityperimeter(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_security_perimeters + + +def cf_perimeterassociableresourcetype(cli_ctx, *_): + return cf_network_cl(cli_ctx).perimeter_associable_resource_types + + def cf_securityuserconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).security_user_configurations @@ -59,5 +83,12 @@ def cf_adminrule(cli_ctx, *_): return cf_network_cl(cli_ctx).admin_rules +def cf_adminrulecollection(cli_ctx, *_): + return cf_network_cl(cli_ctx).admin_rule_collections + + def cf_userrule(cli_ctx, *_): return cf_network_cl(cli_ctx).user_rules + +def cf_userrulecollection(cli_ctx, *_): + return cf_network_cl(cli_ctx).user_rule_collections diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 88aa5ffb218..c65e8daa37a 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -88,9 +88,9 @@ examples: - name: Post Azure Virtual Network Manager Commit text: |- - az network manager commit post --network-manager-name "testNetworkManager" --commit-type "AdminPolicy" \ + az network manager commit post --network-manager-name "testNetworkManager" --commit-type "SecurityAdmin" \ --configuration-ids "/subscriptions/subscriptionC/resourceGroups/resoureGroupSample/providers/Microsoft.Network/network\ -Managers/testNetworkManager/securityConfigurations/SampleSecurityConfig" --target-locations "usest" --resource-group \ +Managers/testNetworkManager/securityConfigurations/SampleSecurityConfig" --target-locations "eastus" --resource-group \ "resoureGroupSample" """ diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 6c16f488d08..3f38ba29f54 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -86,7 +86,7 @@ def load_arguments(self, _): c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('target_locations', nargs='+', help='List of target locations.') c.argument('configuration_ids', nargs='+', help='List of configuration ids.') - c.argument('commit_type', arg_type=get_enum_type(['AdminPolicy', 'UserPolicy', 'Routing', 'Connectivity']), + c.argument('commit_type', arg_type=get_enum_type(['SecurityAdmin', 'SecurityUser', 'Connectivity']), help='Commit Type.') with self.argument_context('network manager deploy-status list') as c: @@ -338,6 +338,53 @@ def load_arguments(self, _): c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') + with self.argument_context('network manager admin-rule collection create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('collection_name', type=str, help='The name of the admin rule collection.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' + 'for configuration') + + with self.argument_context('network manager admin-rule collection update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('collection_name', type=str, help='The name of the admin rule collection.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' + 'for configuration') + + with self.argument_context('network manager admin-rule collection list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager admin-rule collection show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('collection_name', type=str, help='The name of the admin rule collection.') + + with self.argument_context('network manager admin-rule collection delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('collection_name', type=str, help='The name of the admin rule collection.') + with self.argument_context('network manager admin-rule show') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 9306a60579a..58d7deed437 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -13,8 +13,10 @@ from azure.cli.core.commands import CliCommandType from azext_network_manager._client_factory import ( cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, cf_effectivevirtualnetwork, - cf_activeconfiguration, cf_connectivityconfiguration, cf_effectiveconfiguration, cf_networkgroup, cf_userrule, - cf_adminrule, cf_securityadminconfiguration, cf_securityuserconfiguration) + cf_activeconnectivityconfiguration, cf_connectivityconfiguration, cf_effectiveconfiguration, cf_networkgroup, cf_userrule, + cf_userrulecollection, cf_adminrule, cf_adminrulecollection, cf_securityadminconfiguration, cf_securityuserconfiguration, + cf_activesecurityadminrule, cf_activesecurityuserrule, cf_effectiveconnectivityconfiguration, cf_effectivesecurityadminrule, + cf_securityperimeter, cf_perimeterassociableresourcetype) def load_command_table(self, _): @@ -37,9 +39,29 @@ def load_command_table(self, _): operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_virtual_networks_operations#EffectiveVirtualNetworksOperations.{}', client_factory=cf_effectivevirtualnetwork) - network_activeconfiguration = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._active_configurations_operations#ActiveConfigurationsOperations.{}', - client_factory=cf_activeconfiguration + network_activeconnectivityconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._active_connectivity_configurations_operations#ActiveConnetivityConfigurationsOperations.{}', + client_factory=cf_activeconnectivityconfiguration + ) + + network_effectiveconnectivityconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_connectivity_configurations_operations#EffectiveConnetivityConfigurationsOperations.{}', + client_factory=cf_effectiveconnectivityconfiguration + ) + + network_effectivesecurityadminrule = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_security_admin_rules_operations#EffectiveSecurityAdminRulesOperations.{}', + client_factory=cf_effectivesecurityadminrule + ) + + network_activesecurityadminrule = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._active_security_admin_rules_operations#ActiveSecurityAdminRulesOperations.{}', + client_factory=cf_activesecurityadminrule + ) + + network_activesecurityuserrule = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._active_security_user_rules_operations#ActiveSecurityUserRulesOperations.{}', + client_factory=cf_activesecurityuserrule ) network_connectivityconfiguration = CliCommandType( @@ -72,11 +94,31 @@ def load_command_table(self, _): client_factory=cf_adminrule ) + network_adminrulecollection = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._admin_rule_collections_operations#AdminRuleCollectionsOperations.{}', + client_factory=cf_adminrulecollection + ) + network_userrule = CliCommandType( operations_tmpl='azext_network_manager.vendored_sdks.operations._user_rules_operations#UserRulesOperations.{}', client_factory=cf_userrule ) + network_userrulecollection = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._user_rule_collection_operations#UserRuleCollectionsOperations.{}', + client_factory=cf_userrulecollection + ) + + network_securityperimeter = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._network_security_perimeters_operations#NetworkSecurityPerimetersOperations.{}', + client_factory=cf_securityperimeter + ) + + network_perimeterassociableresourcetype = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._perimeter_associable_resource_types_operations#PerimeterAssociableResourceTypesOperations.{}', + client_factory=cf_perimeterassociableresourcetype + ) + with self.command_group('network manager', network_networkmanager, client_factory=cf_networkmanager) as g: g.custom_command('create', 'network_manager_create') g.custom_command('list', 'network_manager_list') @@ -94,9 +136,31 @@ def load_command_table(self, _): g.custom_command('list-by-network-group', 'network_manager_effect_vnet_list_by_network_group') g.custom_command('list-by-network-manager', 'network_manager_effect_vnet_list_by_network_manager') - with self.command_group('network manager active-config', network_activeconfiguration, client_factory=cf_activeconfiguration) as g: + with self.command_group('network manager active-config', network_activeconnectivityconfiguration, client_factory=cf_activeconnectivityconfiguration) as g: g.custom_command('list', 'network_manager_active_config_list') + with self.command_group('network manager effective-config', network_effectiveconnectivityconfiguration, client_factory=cf_effectiveconnectivityconfiguration) as g: + g.custom_command('list', 'network_manager_effective_config_list') + + with self.command_group('network manager active-security-admin-rule', network_activesecurityadminrule, client_factory=cf_activesecurityadminrule) as g: + g.custom_command('list', 'network_manager_active_security_admin_rule_list') + + with self.command_group('network manager active-security-user-rule', network_activesecurityuserrule, client_factory=cf_activesecurityuserrule) as g: + g.custom_command('list', 'network_manager_active_security_user_rule_list') + + with self.command_group('network manager effective-security-admin-rule', network_effectivesecurityadminrule, client_factory=cf_effectivesecurityadminrule) as g: + g.custom_command('list', 'network_manager_effective_security_admin_rule_list') + + with self.command_group('network manager vnet-security-perimeter', network_securityperimeter, client_factory=cf_securityperimeter) as g: + g.custom_command('list', 'network_manager_vnet_security_perimeter_list') + g.custom_show_command('show', 'network_manager_vnet_security_perimeter_show') + g.custom_command('create', 'network_manager_vnet_security_perimeter_create') + g.generic_update_command('update', custom_func_name='network_manager_vnet_security_perimeter_update') + g.custom_command('delete', 'network_manager_vnet_security_perimeter_delete', confirmation=True) + + with self.command_group('network manager perimeter-associable-resource-types', network_perimeterassociableresourcetype, client_factory=cf_perimeterassociableresourcetype) as g: + g.custom_command('list', 'network_manager_perimeter_associable_resource_type_list') + with self.command_group('network manager connect-config', network_connectivityconfiguration, client_factory=cf_connectivityconfiguration) as g: g.custom_command('list', 'network_manager_connect_config_list') g.custom_show_command('show', 'network_manager_connect_config_show') @@ -130,10 +194,19 @@ def load_command_table(self, _): g.custom_command('delete', 'network_manager_security_admin_config_delete', confirmation=True) with self.command_group('network manager admin-rule', network_adminrule, client_factory=cf_adminrule) as g: + g.custom_command('create', 'network_manager_admin_rule_create') + g.generic_update_command('update', setter_arg_name='admin_rule', custom_func_name='network_manager_admin_update') g.custom_command('list', 'network_manager_admin_rule_list') g.custom_show_command('show', 'network_manager_admin_rule_show') g.custom_command('delete', 'network_manager_admin_rule_delete', confirmation=True) + with self.command_group('network manager admin-rule collection', network_adminrulecollection, client_factory=cf_adminrulecollection) as g: + g.custom_command('create', 'network_manager_admin_rule_collection_create') + g.generic_update_command('update', setter_arg_name='admin_rule_collection', custom_func_name='network_manager_admin_rule_collection_update') + g.custom_command('list', 'network_manager_admin_rule_collection_list') + g.custom_show_command('show', 'network_manager_admin_rule_collection_show') + g.custom_command('delete', 'network_manager_admin_rule_collection_delete', confirmation=True) + with self.command_group('network manager user-rule', network_userrule, client_factory=cf_userrule) as g: g.custom_command('list', 'network_manager_user_rule_list') g.custom_show_command('show', 'network_manager_user_rule_show') @@ -141,3 +214,9 @@ def load_command_table(self, _): g.generic_update_command('update', setter_arg_name='user_rule', custom_func_name='network_manager_user_rule_update') g.custom_command('delete', 'network_manager_user_rule_delete', confirmation=True) + with self.command_group('network manager user-rule collection', network_userrulecollection, client_factory=cf_userrulecollection) as g: + g.custom_command('create', 'network_manager_user_rule_collection_create') + g.generic_update_command('update', setter_arg_name='user_rule_collection', custom_func_name='network_manager_user_rule_collection_update') + g.custom_command('list', 'network_manager_user_rule_collection_list') + g.custom_show_command('show', 'network_manager_user_rule_collection_show') + g.custom_command('delete', 'network_manager_user_rule_collection_delete', confirmation=True) diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index d4920ac6f5c..40bcdd20d5b 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -109,6 +109,7 @@ def network_manager_deploy_status_list(client, parameters = {} parameters['regions'] = regions parameters['deployment_types'] = deployment_types + parameters['skip_token'] = skip_token return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, top=top, @@ -122,9 +123,12 @@ def network_manager_effect_vnet_list_by_network_group(client, network_group_name, top=None, skip_token=None): + parameters = {} + parameters['skip_token'] = skip_token return client.list_by_network_group(resource_group_name=resource_group_name, network_manager_name=network_manager_name, network_group_name=network_group_name, + parameters=parameters, top=top, skip_token=skip_token) @@ -136,6 +140,7 @@ def network_manager_effect_vnet_list_by_network_manager(client, skip_token=None, conditional_members=None): parameters = {} + parameters['skip_token'] = skip_token parameters['conditional_members'] = conditional_members return client.list_by_network_manager(resource_group_name=resource_group_name, network_manager_name=network_manager_name, @@ -150,11 +155,67 @@ def network_manager_active_config_list(client, top=None, skip_token=None, region=None): + parameters = {} + parameters['skip_token'] = skip_token + parameters['region'] = region return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - top=top, - skip_token=skip_token, - region=region) + parameters=parameters, + top=top) + + +def network_manager_effective_config_list(client, + resource_group_name, + network_manager_name, + skip_token=None): + parameters = {} + parameters['skip_token'] = skip_token + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) + + +def network_manager_active_security_admin_rule_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None, + region=None): + parameters = {} + parameters['skip_token'] = skip_token + parameters['region'] = region + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters, + top=top) + + +def network_manager_active_security_user_rule_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None, + region=None): + parameters = {} + parameters['skip_token'] = skip_token + parameters['region'] = region + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters, + top=top) + + +def network_manager_effective_security_user_rule_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): + parameters = {} + parameters['skip_token'] = skip_token + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters, + top=top) def network_manager_connect_config_list(client, @@ -459,15 +520,172 @@ def network_manager_security_admin_config_delete(client, configuration_name=configuration_name) +def network_manager_admin_rule_collection_list(client, + resource_group_name, + network_manager_name, + configuration_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token) + + +def network_manager_admin_rule_collection_create(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + display_name=None, + description=None, + applies_to_groups=None): + rule_collection = {} + rule_collection['display_name'] = display_name + rule_collection['description'] = description + rule_collection['applies_to_groups'] = applies_to_groups + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_collection=rule_collection) + + +def network_manager_admin_rule_collection_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + display_name=None, + description=None, + applies_to_groups=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if applies_to_groups is not None: + instance.applies_to_groups = applies_to_groups + return instance + + +def network_manager_admin_rule_collection_show(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name) + + +def network_manager_admin_rule_collection_delete(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name) + + +def network_manager_admin_rule_create(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + rule_name, + kind=None, + display_name=None, + description=None, + protocol=None, + sources=None, + destinations=None, + source_port_ranges=None, + destination_port_ranges=None, + access=None, + priority=None, + direction=None, + flag=None): + rule = {} + rule['kind'] = kind + rule['display_name'] = display_name + rule['description'] = description + rule['protocol'] = protocol + rule['sources'] = sources + rule['destinations'] = destinations + rule['source_port_ranges'] = source_port_ranges + rule['destination_port_ranges'] = destination_port_ranges + rule['access'] = access + rule['priority'] = priority + rule['direction'] = direction + rule['flag'] = flag + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + rule=rule) + + +def network_manager_admin_rule_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + collection_name, + rule_name, + kind=None, + display_name=None, + description=None, + protocol=None, + sources=None, + destinations=None, + source_port_ranges=None, + destination_port_ranges=None, + access=None, + priority=None, + direction=None, + flag=None): + if kind == 'DefaultAdminRule': + if flag is not None: + instance.flag = flag + else: + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if protocol is not None: + instance.protocol = protocol + if sources is not None: + instance.sources = sources + if destinations is not None: + instance.destinations = destinations + if source_port_ranges is not None: + instance.source_port_ranges = source_port_ranges + if destination_port_ranges is not None: + instance.destination_port_ranges = destination_port_ranges + if access is not None: + instance.access = access + if priority is not None: + instance.priority = priority + if direction is not None: + instance.direction = direction + return instance + + def network_manager_admin_rule_list(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, top=None, skip_token=None): return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, top=top, skip_token=skip_token) @@ -476,10 +694,12 @@ def network_manager_admin_rule_show(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, rule_name): return client.get(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, rule_name=rule_name) @@ -487,22 +707,97 @@ def network_manager_admin_rule_delete(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, rule_name): return client.delete(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, rule_name=rule_name) +def network_manager_user_rule_collection_list(client, + resource_group_name, + network_manager_name, + configuration_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token) + + +def network_manager_user_rule_collection_create(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + display_name=None, + description=None, + applies_to_groups=None): + rule_collection = {} + rule_collection['display_name'] = display_name + rule_collection['description'] = description + rule_collection['applies_to_groups'] = applies_to_groups + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_collection=rule_collection) + + +def network_manager_user_rule_collection_update(instance, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + display_name=None, + description=None, + applies_to_groups=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if applies_to_groups is not None: + instance.applies_to_groups = applies_to_groups + return instance + + +def network_manager_user_rule_collection_show(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name) + + +def network_manager_user_rule_collection_delete(client, + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name) + + def network_manager_user_rule_list(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, top=None, skip_token=None): return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, top=top, skip_token=skip_token) @@ -511,10 +806,12 @@ def network_manager_user_rule_show(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, rule_name): return client.get(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, rule_name=rule_name) @@ -522,27 +819,33 @@ def network_manager_user_rule_create(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, rule_name, + kind=None, display_name=None, description=None, protocol=None, - source=None, - destination=None, + sources=None, + destinations=None, source_port_ranges=None, destination_port_ranges=None, - direction=None): + direction=None, + flag=None): user_rule = {} + user_rule['kind'] = kind user_rule['display_name'] = display_name user_rule['description'] = description user_rule['protocol'] = protocol - user_rule['source'] = source - user_rule['destination'] = destination + user_rule['sources'] = sources + user_rule['destinations'] = destinations user_rule['source_port_ranges'] = source_port_ranges user_rule['destination_port_ranges'] = destination_port_ranges user_rule['direction'] = direction + user_rule['flag'] = flag return client.create_or_update(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, rule_name=rule_name, user_rule=user_rule) @@ -551,31 +854,39 @@ def network_manager_user_rule_update(instance, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, rule_name, + kind=None, display_name=None, description=None, protocol=None, - source=None, - destination=None, + sources=None, + destinations=None, source_port_ranges=None, destination_port_ranges=None, - direction=None): - if display_name is not None: - instance.display_name = display_name - if description is not None: - instance.description = description - if protocol is not None: - instance.protocol = protocol - if source is not None: - instance.source = source - if destination is not None: - instance.destination = destination - if source_port_ranges is not None: - instance.source_port_ranges = source_port_ranges - if destination_port_ranges is not None: - instance.destination_port_ranges = destination_port_ranges - if direction is not None: - instance.direction = direction + direction=None, + flag=None): + + if kind == 'DefaultUserRule': + if flag is not None: + instance.flag = flag + else: + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + if protocol is not None: + instance.protocol = protocol + if sources is not None: + instance.sources = sources + if destinations is not None: + instance.destinations = destinations + if source_port_ranges is not None: + instance.source_port_ranges = source_port_ranges + if destination_port_ranges is not None: + instance.destination_port_ranges = destination_port_ranges + if direction is not None: + instance.direction = direction return instance @@ -583,8 +894,63 @@ def network_manager_user_rule_delete(client, resource_group_name, network_manager_name, configuration_name, + rule_collection_name, rule_name): return client.delete(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, + rule_collection_name=rule_collection_name, rule_name=rule_name) + + +def network_manager_vnet_security_perimeter_list(client, + resource_group_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + top=top, + skip_token=skip_token) + + +def network_manager_vnet_security_perimeter_create(client, + resource_group_name, + network_security_perimeter_name, + display_name=None, + description=None): + parameters = {} + parameters['display_name'] = display_name + parameters['description'] = description + return client.create_or_update(resource_group_name=resource_group_name, + network_security_perimeter_name=network_security_perimeter_name, + parameters=parameters) + + +def network_manager_vnet_security_perimeter_update(instance, + resource_group_name, + network_security_perimeter_name, + display_name=None, + description=None): + if display_name is not None: + instance.display_name = display_name + if description is not None: + instance.description = description + return instance + + +def network_manager_vnet_security_perimeter_show(client, + resource_group_name, + network_security_perimeter_name): + return client.get(resource_group_name=resource_group_name, + network_security_perimeter_name=network_security_perimeter_name) + + +def network_manager_vnet_security_perimeter_delete(client, + resource_group_name, + network_security_perimeter_name): + return client.delete(resource_group_name=resource_group_name, + network_security_perimeter_name=network_security_perimeter_name) + + +def network_manager_perimeter_associable_resource_type_list(client, + location): + return client.get(location=location) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml new file mode 100644 index 00000000000..3c59340e322 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityAdmin", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '289' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"error":{"code":"BadRequest","message":"Cannot have two Network Managers + applied to the same object overlapping scope accesses. Scope id: /subscriptions/00000000-0000-0000-0000-000000000000. + Network Manager Id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager. + Overlapping accesses: SecurityAdmin, Connectivity"}}' + headers: + cache-control: + - no-cache + content-length: + - '471' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 31 Aug 2021 09:30:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 400 + message: Bad Request +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index e697d78e447..ed8beb7aafb 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -131,5 +131,43 @@ def test_network_manager_security_admin_config_crud(self, resource_group): '--description "test_description"') self.cmd('network manager security-admin-config list --network-manager-name {manager_name} -g {rg}') self.cmd('network manager security-admin-config show --configuration-name {name} --network-manager-name {manager_name} -g {rg}') + + # test nm commit + # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2" -g {rg} ' + # '--configuration-ids {sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/securityAdminConfigurations/{name}') + self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') + + @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_rule_collection_crud', location='jioindiawest') + @VirtualNetworkPreparer() + def test_network_manager_security_admin_rule_collection_crud(self, virtual_network, resource_group): + + self.kwargs.update({ + 'collection_name': '', + 'config_name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'group_name': 'TestNetworkGroup', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l jioindiawest ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' + '--group-members vnet-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ' + 'subnet-id=""') + + self.cmd('network manager security-admin-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--description {description} --delete-existing-ns-gs true --security-type "AdminPolicy" --display-name MyTestConfig') + + self.cmd('network manager admin-rule collection --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--role-collection-name {collection_name} --description {description} --display-name ASampleCollection ' + '--applies-to-groups network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name}') + From 9b83993e3f1ffd38c828b73066cb73fb0d5a505f Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 6 Sep 2021 14:06:07 +0800 Subject: [PATCH 09/28] regen sdk --- .../_effective_virtual_networks_operations.py | 11 +- .../vendored_sdks/models/__init__.py | 5 +- .../vendored_sdks/models/_models.py | 87 +++++++++------ .../vendored_sdks/models/_models_py3.py | 105 +++++++++++------- .../_network_management_client_enums.py | 7 -- .../_effective_virtual_networks_operations.py | 11 +- 6 files changed, 127 insertions(+), 99 deletions(-) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py index d603814b3c4..7f424f19c79 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py @@ -44,9 +44,9 @@ async def list_by_network_manager( self, resource_group_name: str, network_manager_name: str, + parameters: "_models.EffectiveVirtualNetworksParameter", top: Optional[int] = None, skip_token: Optional[str] = None, - parameters: Optional["_models.EffectiveVirtualNetworksParameter"] = None, **kwargs: Any ) -> "_models.EffectiveVirtualNetworksListResult": """List effective virtual networks in a network manager. @@ -55,6 +55,8 @@ async def list_by_network_manager( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str + :param parameters: Effective Virtual Networks Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -62,8 +64,6 @@ async def list_by_network_manager( 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. :type skip_token: str - :param parameters: Effective Virtual Networks Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: EffectiveVirtualNetworksListResult, or the result of cls(response) :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult @@ -101,10 +101,7 @@ async def list_by_network_manager( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - else: - body_content = None + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py index 3f8f582e653..a0e46b4c305 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py @@ -38,6 +38,7 @@ from ._models_py3 import EffectiveVirtualNetworksListResult from ._models_py3 import EffectiveVirtualNetworksParameter from ._models_py3 import GroupMembersItem + from ._models_py3 import Hub from ._models_py3 import NetworkGroup from ._models_py3 import NetworkGroupListResult from ._models_py3 import NetworkManager @@ -97,6 +98,7 @@ from ._models import EffectiveVirtualNetworksListResult # type: ignore from ._models import EffectiveVirtualNetworksParameter # type: ignore from ._models import GroupMembersItem # type: ignore + from ._models import Hub # type: ignore from ._models import NetworkGroup # type: ignore from ._models import NetworkGroupListResult # type: ignore from ._models import NetworkManager # type: ignore @@ -138,7 +140,6 @@ EffectiveUserRuleKind, GroupConnectivity, IsGlobal, - MemberType, MembershipType, ProvisioningState, SecurityConfigurationRuleAccess, @@ -181,6 +182,7 @@ 'EffectiveVirtualNetworksListResult', 'EffectiveVirtualNetworksParameter', 'GroupMembersItem', + 'Hub', 'NetworkGroup', 'NetworkGroupListResult', 'NetworkManager', @@ -220,7 +222,6 @@ 'EffectiveUserRuleKind', 'GroupConnectivity', 'IsGlobal', - 'MemberType', 'MembershipType', 'ProvisioningState', 'SecurityConfigurationRuleAccess', diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py index 82c90a284bd..c84460c5269 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py @@ -161,7 +161,7 @@ class ActiveConfigurationParameter(msrest.serialization.Model): _attribute_map = { 'regions': {'key': 'regions', 'type': '[str]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -191,8 +191,8 @@ class EffectiveConnectivityConfiguration(msrest.serialization.Model): "HubAndSpoke", "Mesh". :type connectivity_topology: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hub_id: The hub vnet Id. - :type hub_id: str + :param hubs: List of hubItems. + :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. @@ -218,7 +218,7 @@ class EffectiveConnectivityConfiguration(msrest.serialization.Model): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -235,7 +235,7 @@ def __init__( self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) self.connectivity_topology = kwargs.get('connectivity_topology', None) - self.hub_id = kwargs.get('hub_id', None) + self.hubs = kwargs.get('hubs', None) self.is_global = kwargs.get('is_global', None) self.applies_to_groups = kwargs.get('applies_to_groups', None) self.provisioning_state = None @@ -260,8 +260,8 @@ class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): "HubAndSpoke", "Mesh". :type connectivity_topology: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hub_id: The hub vnet Id. - :type hub_id: str + :param hubs: List of hubItems. + :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. @@ -291,7 +291,7 @@ class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -322,7 +322,7 @@ class ActiveConnectivityConfigurationsListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[ActiveConnectivityConfiguration]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -694,7 +694,7 @@ class ActiveSecurityAdminRulesListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[ActiveBaseSecurityAdminRule]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -817,7 +817,7 @@ class ActiveSecurityUserRulesListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[ActiveBaseSecurityUserRule]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -1178,8 +1178,8 @@ class ConfigurationGroup(msrest.serialization.Model): :type display_name: str :param description: A description of the network group. :type description: str - :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". - :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType + :param member_type: Group member type. + :type member_type: str :param group_members: Group members of network group. :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] :param conditional_membership: Network group conditional filter. @@ -1241,8 +1241,8 @@ class ConnectivityConfiguration(ProxyResource): "HubAndSpoke", "Mesh". :type connectivity_topology: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hub_id: The hub vnet Id. - :type hub_id: str + :param hubs: List of hubItems. + :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. @@ -1276,7 +1276,7 @@ class ConnectivityConfiguration(ProxyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -1292,7 +1292,7 @@ def __init__( self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) self.connectivity_topology = kwargs.get('connectivity_topology', None) - self.hub_id = kwargs.get('hub_id', None) + self.hubs = kwargs.get('hubs', None) self.is_global = kwargs.get('is_global', None) self.applies_to_groups = kwargs.get('applies_to_groups', None) self.provisioning_state = None @@ -1902,7 +1902,7 @@ class EffectiveVirtualNetworksListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -1926,7 +1926,7 @@ class EffectiveVirtualNetworksParameter(msrest.serialization.Model): _attribute_map = { 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -1941,15 +1941,12 @@ def __init__( class GroupMembersItem(msrest.serialization.Model): """GroupMembers Item. - :param vnet_id: Vnet Id. - :type vnet_id: str - :param subnet_id: Subnet Id. - :type subnet_id: str + :param resource_id: Resource Id. + :type resource_id: str """ _attribute_map = { - 'vnet_id': {'key': 'vnetId', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, } def __init__( @@ -1957,8 +1954,30 @@ def __init__( **kwargs ): super(GroupMembersItem, self).__init__(**kwargs) - self.vnet_id = kwargs.get('vnet_id', None) - self.subnet_id = kwargs.get('subnet_id', None) + self.resource_id = kwargs.get('resource_id', None) + + +class Hub(msrest.serialization.Model): + """Hub Item. + + :param resource_id: Resource Id. + :type resource_id: str + :param resource_type: Resource Type. + :type resource_type: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Hub, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.resource_type = kwargs.get('resource_type', None) class NetworkGroup(ProxyResource): @@ -1980,8 +1999,8 @@ class NetworkGroup(ProxyResource): :type display_name: str :param description: A description of the network group. :type description: str - :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". - :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType + :param member_type: Group member type. + :type member_type: str :param group_members: Group members of network group. :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] :param conditional_membership: Network group conditional filter. @@ -2258,7 +2277,7 @@ class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2286,7 +2305,7 @@ class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): _attribute_map = { 'regions': {'key': 'regions', 'type': '[str]'}, 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2312,7 +2331,7 @@ class NetworkManagerEffectiveConnectivityConfigurationListResult(msrest.serializ _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2337,7 +2356,7 @@ class NetworkManagerEffectiveSecurityAdminRulesListResult(msrest.serialization.M _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveBaseSecurityAdminRule]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2578,7 +2597,7 @@ class QueryRequestOptions(msrest.serialization.Model): """ _attribute_map = { - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py index bcd93163660..b9f1489bf65 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py @@ -186,7 +186,7 @@ class ActiveConfigurationParameter(msrest.serialization.Model): _attribute_map = { 'regions': {'key': 'regions', 'type': '[str]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -219,8 +219,8 @@ class EffectiveConnectivityConfiguration(msrest.serialization.Model): "HubAndSpoke", "Mesh". :type connectivity_topology: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hub_id: The hub vnet Id. - :type hub_id: str + :param hubs: List of hubItems. + :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. @@ -246,7 +246,7 @@ class EffectiveConnectivityConfiguration(msrest.serialization.Model): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -261,7 +261,7 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, - hub_id: Optional[str] = None, + hubs: Optional[List["Hub"]] = None, is_global: Optional[Union[str, "IsGlobal"]] = None, applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, @@ -273,7 +273,7 @@ def __init__( self.display_name = display_name self.description = description self.connectivity_topology = connectivity_topology - self.hub_id = hub_id + self.hubs = hubs self.is_global = is_global self.applies_to_groups = applies_to_groups self.provisioning_state = None @@ -298,8 +298,8 @@ class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): "HubAndSpoke", "Mesh". :type connectivity_topology: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hub_id: The hub vnet Id. - :type hub_id: str + :param hubs: List of hubItems. + :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. @@ -329,7 +329,7 @@ class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -346,7 +346,7 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, - hub_id: Optional[str] = None, + hubs: Optional[List["Hub"]] = None, is_global: Optional[Union[str, "IsGlobal"]] = None, applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, @@ -354,7 +354,7 @@ def __init__( region: Optional[str] = None, **kwargs ): - super(ActiveConnectivityConfiguration, self).__init__(id=id, configuration_groups=configuration_groups, display_name=display_name, description=description, connectivity_topology=connectivity_topology, hub_id=hub_id, is_global=is_global, applies_to_groups=applies_to_groups, delete_existing_peering=delete_existing_peering, **kwargs) + super(ActiveConnectivityConfiguration, self).__init__(id=id, configuration_groups=configuration_groups, display_name=display_name, description=description, connectivity_topology=connectivity_topology, hubs=hubs, is_global=is_global, applies_to_groups=applies_to_groups, delete_existing_peering=delete_existing_peering, **kwargs) self.commit_time = commit_time self.region = region @@ -372,7 +372,7 @@ class ActiveConnectivityConfigurationsListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[ActiveConnectivityConfiguration]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -789,7 +789,7 @@ class ActiveSecurityAdminRulesListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[ActiveBaseSecurityAdminRule]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -933,7 +933,7 @@ class ActiveSecurityUserRulesListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[ActiveBaseSecurityUserRule]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -1319,8 +1319,8 @@ class ConfigurationGroup(msrest.serialization.Model): :type display_name: str :param description: A description of the network group. :type description: str - :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". - :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType + :param member_type: Group member type. + :type member_type: str :param group_members: Group members of network group. :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] :param conditional_membership: Network group conditional filter. @@ -1351,7 +1351,7 @@ def __init__( id: Optional[str] = None, display_name: Optional[str] = None, description: Optional[str] = None, - member_type: Optional[Union[str, "MemberType"]] = None, + member_type: Optional[str] = None, group_members: Optional[List["GroupMembersItem"]] = None, conditional_membership: Optional[str] = None, **kwargs @@ -1389,8 +1389,8 @@ class ConnectivityConfiguration(ProxyResource): "HubAndSpoke", "Mesh". :type connectivity_topology: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hub_id: The hub vnet Id. - :type hub_id: str + :param hubs: List of hubItems. + :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal :param applies_to_groups: Groups for configuration. @@ -1424,7 +1424,7 @@ class ConnectivityConfiguration(ProxyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hub_id': {'key': 'properties.hubId', 'type': 'str'}, + 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -1437,7 +1437,7 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = None, - hub_id: Optional[str] = None, + hubs: Optional[List["Hub"]] = None, is_global: Optional[Union[str, "IsGlobal"]] = None, applies_to_groups: Optional[List["ConnectivityGroupItem"]] = None, delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, @@ -1448,7 +1448,7 @@ def __init__( self.display_name = display_name self.description = description self.connectivity_topology = connectivity_topology - self.hub_id = hub_id + self.hubs = hubs self.is_global = is_global self.applies_to_groups = applies_to_groups self.provisioning_state = None @@ -2109,7 +2109,7 @@ class EffectiveVirtualNetworksListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2136,7 +2136,7 @@ class EffectiveVirtualNetworksParameter(msrest.serialization.Model): _attribute_map = { 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2154,27 +2154,48 @@ def __init__( class GroupMembersItem(msrest.serialization.Model): """GroupMembers Item. - :param vnet_id: Vnet Id. - :type vnet_id: str - :param subnet_id: Subnet Id. - :type subnet_id: str + :param resource_id: Resource Id. + :type resource_id: str """ _attribute_map = { - 'vnet_id': {'key': 'vnetId', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, } def __init__( self, *, - vnet_id: Optional[str] = None, - subnet_id: Optional[str] = None, + resource_id: Optional[str] = None, **kwargs ): super(GroupMembersItem, self).__init__(**kwargs) - self.vnet_id = vnet_id - self.subnet_id = subnet_id + self.resource_id = resource_id + + +class Hub(msrest.serialization.Model): + """Hub Item. + + :param resource_id: Resource Id. + :type resource_id: str + :param resource_type: Resource Type. + :type resource_type: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + resource_type: Optional[str] = None, + **kwargs + ): + super(Hub, self).__init__(**kwargs) + self.resource_id = resource_id + self.resource_type = resource_type class NetworkGroup(ProxyResource): @@ -2196,8 +2217,8 @@ class NetworkGroup(ProxyResource): :type display_name: str :param description: A description of the network group. :type description: str - :param member_type: Group member type. Possible values include: "VirtualNetwork", "Subnet". - :type member_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MemberType + :param member_type: Group member type. + :type member_type: str :param group_members: Group members of network group. :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] :param conditional_membership: Network group conditional filter. @@ -2236,7 +2257,7 @@ def __init__( *, display_name: Optional[str] = None, description: Optional[str] = None, - member_type: Optional[Union[str, "MemberType"]] = None, + member_type: Optional[str] = None, group_members: Optional[List["GroupMembersItem"]] = None, conditional_membership: Optional[str] = None, **kwargs @@ -2506,7 +2527,7 @@ class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): _attribute_map = { 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2537,7 +2558,7 @@ class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): _attribute_map = { 'regions': {'key': 'regions', 'type': '[str]'}, 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2567,7 +2588,7 @@ class NetworkManagerEffectiveConnectivityConfigurationListResult(msrest.serializ _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2595,7 +2616,7 @@ class NetworkManagerEffectiveSecurityAdminRulesListResult(msrest.serialization.M _attribute_map = { 'value': {'key': 'value', 'type': '[EffectiveBaseSecurityAdminRule]'}, - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( @@ -2863,7 +2884,7 @@ class QueryRequestOptions(msrest.serialization.Model): """ _attribute_map = { - 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, } def __init__( diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py index b0424372439..b0161e3803d 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py @@ -122,13 +122,6 @@ class MembershipType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STATIC = "Static" DYNAMIC = "Dynamic" -class MemberType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Group member type. - """ - - VIRTUAL_NETWORK = "VirtualNetwork" - SUBNET = "Subnet" - class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py index be99eef8926..6d438d76538 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py @@ -48,9 +48,9 @@ def list_by_network_manager( self, resource_group_name, # type: str network_manager_name, # type: str + parameters, # type: "_models.EffectiveVirtualNetworksParameter" top=None, # type: Optional[int] skip_token=None, # type: Optional[str] - parameters=None, # type: Optional["_models.EffectiveVirtualNetworksParameter"] **kwargs # type: Any ): # type: (...) -> "_models.EffectiveVirtualNetworksListResult" @@ -60,6 +60,8 @@ def list_by_network_manager( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str + :param parameters: Effective Virtual Networks Parameter. + :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -67,8 +69,6 @@ def list_by_network_manager( 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. :type skip_token: str - :param parameters: Effective Virtual Networks Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: EffectiveVirtualNetworksListResult, or the result of cls(response) :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult @@ -106,10 +106,7 @@ def list_by_network_manager( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - else: - body_content = None + body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) From 49e9b2b7ced86bcb2005381f746fd94c8579d6dd Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Wed, 22 Sep 2021 13:46:19 +0800 Subject: [PATCH 10/28] sort client_factory --- .../azext_network_manager/_client_factory.py | 63 +++++++++---------- .../tests/latest/test_network_scenario.py | 3 + 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/network-manager/azext_network_manager/_client_factory.py b/src/network-manager/azext_network_manager/_client_factory.py index d420562cf93..11a93420d9e 100644 --- a/src/network-manager/azext_network_manager/_client_factory.py +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -15,52 +15,56 @@ def cf_network_cl(cli_ctx, *_): return get_mgmt_service_client(cli_ctx, NetworkManagementClient) -def cf_networkmanager(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_managers +def cf_activeconnectivityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_connectivity_configurations -def cf_networkmanagercommit(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_manager_commits +def cf_activesecurityadminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_security_admin_rules -def cf_networkmanagerdeploymentstatus(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_manager_deployment_status +def cf_activesecurityuserrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_security_user_rules -def cf_effectivevirtualnetwork(cli_ctx, *_): - return cf_network_cl(cli_ctx).effective_virtual_networks +def cf_adminrulecollection(cli_ctx, *_): + return cf_network_cl(cli_ctx).admin_rule_collections -def cf_activeconnectivityconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).active_connectivity_configurations +def cf_adminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).admin_rules + + +def cf_connectivityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).connectivity_configurations def cf_effectiveconnectivityconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).effective_connectivity_configurations -def cf_effectivesecurityadminrule(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_manager_effective_security_admin_rules +def cf_effectivevirtualnetwork(cli_ctx, *_): + return cf_network_cl(cli_ctx).effective_virtual_networks -def cf_activesecurityadminrule(cli_ctx, *_): - return cf_network_cl(cli_ctx).active_security_admin_rules +def cf_networkgroup(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_groups -def cf_activesecurityuserrule(cli_ctx, *_): - return cf_network_cl(cli_ctx).active_security_user_rules +def cf_networkmanagercommit(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_commits -def cf_connectivityconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).connectivity_configurations +def cf_networkmanagerdeploymentstatus(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_deployment_status -def cf_effectiveconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).effective_configurations +def cf_effectivesecurityadminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_effective_security_admin_rules -def cf_networkgroup(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_groups +def cf_networkmanager(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_managers def cf_securityperimeter(cli_ctx, *_): @@ -71,24 +75,17 @@ def cf_perimeterassociableresourcetype(cli_ctx, *_): return cf_network_cl(cli_ctx).perimeter_associable_resource_types -def cf_securityuserconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).security_user_configurations - - def cf_securityadminconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).security_admin_configurations -def cf_adminrule(cli_ctx, *_): - return cf_network_cl(cli_ctx).admin_rules +def cf_securityuserconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).security_user_configurations -def cf_adminrulecollection(cli_ctx, *_): - return cf_network_cl(cli_ctx).admin_rule_collections +def cf_userrulecollection(cli_ctx, *_): + return cf_network_cl(cli_ctx).user_rule_collections def cf_userrule(cli_ctx, *_): return cf_network_cl(cli_ctx).user_rules - -def cf_userrulecollection(cli_ctx, *_): - return cf_network_cl(cli_ctx).user_rule_collections diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index ed8beb7aafb..1333b4defc7 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -136,6 +136,9 @@ def test_network_manager_security_admin_config_crud(self, resource_group): # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2" -g {rg} ' # '--configuration-ids {sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/securityAdminConfigurations/{name}') + # test nm uncommit + # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2" -g {rg} ') + self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') From 18b2563391322376c2e5ab576c3258b85c29ba5d Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 23 Sep 2021 15:02:20 +0800 Subject: [PATCH 11/28] remove unused command and fix testcase --- .../azext_network_manager/_help.py | 15 ------- .../azext_network_manager/_params.py | 17 ++----- .../azext_network_manager/action.py | 8 ++-- .../azext_network_manager/commands.py | 16 +++---- .../azext_network_manager/custom.py | 11 ----- .../tests/latest/test_network_scenario.py | 44 ++++++++++++------- 6 files changed, 40 insertions(+), 71 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index c65e8daa37a..5c773d69073 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -230,21 +230,6 @@ --network-manager-name "testNetworkManager" --resource-group "myResourceGroup" """ -helps['network effectiveconfiguration'] = """ - type: group - short-summary: Manage effectiveconfiguration with network -""" - -helps['network effectiveconfiguration list'] = """ - type: command - short-summary: "List all configurations in a virtual network." - examples: - - name: List Azure Virtual Network Manager Effective Configuration - text: |- - az network effectiveconfiguration list --resource-group "myResourceGroup" --virtual-network-name \ -"testVirtualNetwork" -""" - helps['network manager group'] = """ type: group short-summary: Manage networkgroup with network diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 3f38ba29f54..cab1b798d2d 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -183,15 +183,6 @@ def load_arguments(self, _): c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.', id_part='child_name_1') - with self.argument_context('network effectiveconfiguration list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('virtual_network_name', type=str, help='The name of the virtual network.') - c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' - 'be returned by the server.') - c.argument('skip_token', type=str, 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('network manager group list') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.') @@ -343,7 +334,7 @@ def load_arguments(self, _): c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') - c.argument('collection_name', type=str, help='The name of the admin rule collection.') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') c.argument('display_name', type=str, help='A friendly name for the rule.') c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' @@ -354,7 +345,7 @@ def load_arguments(self, _): c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') - c.argument('collection_name', type=str, help='The name of the admin rule collection.') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') c.argument('display_name', type=str, help='A friendly name for the rule.') c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' @@ -376,14 +367,14 @@ def load_arguments(self, _): c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') - c.argument('collection_name', type=str, help='The name of the admin rule collection.') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') with self.argument_context('network manager admin-rule collection delete') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') - c.argument('collection_name', type=str, help='The name of the admin rule collection.') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') with self.argument_context('network manager admin-rule show') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/src/network-manager/azext_network_manager/action.py b/src/network-manager/azext_network_manager/action.py index b372311523f..e0c9776a16f 100644 --- a/src/network-manager/azext_network_manager/action.py +++ b/src/network-manager/azext_network_manager/action.py @@ -89,13 +89,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'vnet-id': - d['vnet_id'] = v[0] - elif kl == 'subnet-id': - d['subnet_id'] = v[0] + if kl == 'resource-id': + d['resource_id'] = v[0] else: raise CLIError('Unsupported Key {} is provided for parameter group_members. All possible keys are: ' - 'resource-id, subnet-id'.format(k)) + 'resource-id'.format(k)) return d diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 58d7deed437..769a0b7a399 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -13,7 +13,7 @@ from azure.cli.core.commands import CliCommandType from azext_network_manager._client_factory import ( cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, cf_effectivevirtualnetwork, - cf_activeconnectivityconfiguration, cf_connectivityconfiguration, cf_effectiveconfiguration, cf_networkgroup, cf_userrule, + cf_activeconnectivityconfiguration, cf_connectivityconfiguration, cf_networkgroup, cf_userrule, cf_userrulecollection, cf_adminrule, cf_adminrulecollection, cf_securityadminconfiguration, cf_securityuserconfiguration, cf_activesecurityadminrule, cf_activesecurityuserrule, cf_effectiveconnectivityconfiguration, cf_effectivesecurityadminrule, cf_securityperimeter, cf_perimeterassociableresourcetype) @@ -69,10 +69,10 @@ def load_command_table(self, _): client_factory=cf_connectivityconfiguration ) - network_effectiveconfiguration = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_configurations_operations#EffectiveConfigurationsOperations.{}', - client_factory=cf_effectiveconfiguration - ) + # network_effectiveconfiguration = CliCommandType( + # operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_configurations_operations#EffectiveConfigurationsOperations.{}', + # client_factory=cf_effectiveconfiguration + # ) network_networkgroup = CliCommandType( operations_tmpl='azext_network_manager.vendored_sdks.operations._network_groups_operations#NetworkGroupsOperations.{}', @@ -168,10 +168,6 @@ def load_command_table(self, _): g.generic_update_command('update', setter_arg_name='connectivity_configuration', custom_func_name='network_manager_connect_config_update') g.custom_command('delete', 'network_manager_connect_config_delete', confirmation=True) - with self.command_group('network effectiveconfiguration', network_effectiveconfiguration, - client_factory=cf_effectiveconfiguration) as g: - g.custom_command('list', 'network_effectiveconfiguration_list') - with self.command_group('network manager group', network_networkgroup, client_factory=cf_networkgroup) as g: g.custom_command('list', 'network_manager_group_list') g.custom_show_command('show', 'network_manager_group_show') @@ -202,7 +198,7 @@ def load_command_table(self, _): with self.command_group('network manager admin-rule collection', network_adminrulecollection, client_factory=cf_adminrulecollection) as g: g.custom_command('create', 'network_manager_admin_rule_collection_create') - g.generic_update_command('update', setter_arg_name='admin_rule_collection', custom_func_name='network_manager_admin_rule_collection_update') + g.generic_update_command('update', setter_arg_name='rule_collection', custom_func_name='network_manager_admin_rule_collection_update') g.custom_command('list', 'network_manager_admin_rule_collection_list') g.custom_show_command('show', 'network_manager_admin_rule_collection_show') g.custom_command('delete', 'network_manager_admin_rule_collection_delete', confirmation=True) diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 40bcdd20d5b..2c9d6c75b57 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -300,17 +300,6 @@ def network_manager_connect_config_delete(client, configuration_name=configuration_name) -def network_effectiveconfiguration_list(client, - resource_group_name, - virtual_network_name, - top=None, - skip_token=None): - return client.list(resource_group_name=resource_group_name, - virtual_network_name=virtual_network_name, - top=top, - skip_token=skip_token) - - def network_manager_group_list(client, resource_group_name, network_manager_name, diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 1333b4defc7..510c435bc39 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -27,7 +27,7 @@ class NetworkScenarioTest(ScenarioTest): def __init__(self, *args, **kwargs): super(NetworkScenarioTest, self).__init__(*args, **kwargs) - @ResourceGroupPreparer(name_prefix='test_network_manager', location='jioindiawest') + @ResourceGroupPreparer(name_prefix='test_network_manager', location='eastus2euap') def test_network_manager_crud(self, resource_group): self.kwargs.update({ 'name': 'TestNetworkManager', @@ -40,8 +40,10 @@ def test_network_manager_crud(self, resource_group): '--network-manager-scope-accesses "Routing" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' - '-l jioindiawest ' + '-l eastus2euap ' '--resource-group {rg}') + + self.cmd('network manager show --resource-group {rg} --name {name}') # Update is not allowed for NM. # self.cmd('network manager update --resource-group {rg} --name {name} --tags key1=value1') @@ -50,7 +52,7 @@ def test_network_manager_crud(self, resource_group): self.cmd('network manager delete --resource-group {rg} --name {name} --yes') - @ResourceGroupPreparer(name_prefix='test_network_manager_group', location='jioindiawest') + @ResourceGroupPreparer(name_prefix='test_network_manager_group', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_group_crud(self, virtual_network, resource_group): @@ -68,20 +70,19 @@ def test_network_manager_group_crud(self, virtual_network, resource_group): '--network-manager-scope-accesses "Routing" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' - '-l jioindiawest ' + '-l eastus2euap ' '--resource-group {rg}') self.cmd('network manager group create --name {name} --network-manager-name {manager_name} --description {description} ' '--conditional-membership "" --display-name {display_name} --member-type {member_type} -g {rg} ' - '--group-members vnet-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ' - 'subnet-id=""') + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') self.cmd('network manager group update -g {rg} --name {name} --network-manager-name {manager_name} --description "Desc changed."') self.cmd('network manager group show -g {rg} --name {name} --network-manager-name {manager_name}') self.cmd('network manager group list -g {rg} --network-manager-name {manager_name}') self.cmd('network manager group delete -g {rg} --name {name} --network-manager-name {manager_name} --yes') - @ResourceGroupPreparer(name_prefix='test_network_manager_security_user_config', location='jioindiawest') + @ResourceGroupPreparer(name_prefix='test_network_manager_security_user_config', location='eastus2euap') def test_network_manager_security_user_config_crud(self, resource_group): self.kwargs.update({ @@ -95,7 +96,7 @@ def test_network_manager_security_user_config_crud(self, resource_group): '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' - '-l jioindiawest ' + '-l eastus2euap ' '--resource-group {rg}') self.cmd('network manager security-user-config create --configuration-name {name} --network-manager-name {manager_name} -g {rg} ' @@ -107,7 +108,7 @@ def test_network_manager_security_user_config_crud(self, resource_group): self.cmd('network manager security-user-config show --configuration-name {name} --network-manager-name {manager_name} -g {rg}') self.cmd('network manager security-user-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') - @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_config', location='jioindiawest') + @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_config', location='eastus2euap') def test_network_manager_security_admin_config_crud(self, resource_group): self.kwargs.update({ @@ -121,7 +122,7 @@ def test_network_manager_security_admin_config_crud(self, resource_group): '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' - '-l jioindiawest ' + '-l eastus2euap ' '--resource-group {rg}') self.cmd('network manager security-admin-config create --configuration-name {name} --network-manager-name {manager_name} -g {rg} ' @@ -133,16 +134,16 @@ def test_network_manager_security_admin_config_crud(self, resource_group): self.cmd('network manager security-admin-config show --configuration-name {name} --network-manager-name {manager_name} -g {rg}') # test nm commit - # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2" -g {rg} ' + # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ' # '--configuration-ids {sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/securityAdminConfigurations/{name}') # test nm uncommit - # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2" -g {rg} ') + # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ') self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') - @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_rule_collection_crud', location='jioindiawest') + @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_rule_collection_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_security_admin_rule_collection_crud(self, virtual_network, resource_group): @@ -153,24 +154,33 @@ def test_network_manager_security_admin_rule_collection_crud(self, virtual_netwo 'group_name': 'TestNetworkGroup', 'description': '"A sample policy"', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' - '-l jioindiawest ' + '-l eastus2euap ' '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' - '--group-members vnet-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ' - 'subnet-id=""') + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') self.cmd('network manager security-admin-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--description {description} --delete-existing-ns-gs true --security-type "AdminPolicy" --display-name MyTestConfig') - self.cmd('network manager admin-rule collection --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + self.cmd('network manager admin-rule collection create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--role-collection-name {collection_name} --description {description} --display-name ASampleCollection ' '--applies-to-groups network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name}') + + self.cmd('network manager admin-rule collection show -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --role-collection-name {collection_name}') + + self.cmd('network manager admin-rule collection update -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --role-collection-name {collection_name} ' + '--display-name ASampleCollection2') + + self.cmd('network manager admin-rule collection list -g {rg} --configuration-name {config_name} --network-manager-name {manager_name}') + + self.cmd('network manager admin-rule collection delete -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --role-collection-name {collection_name}') From 96af50bc593d9e4c08c1ec3d0a388cd783141071 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Wed, 29 Sep 2021 16:33:55 +0800 Subject: [PATCH 12/28] fix datetime string in systemdata --- .../recordings/test_network_manager_crud.yaml | 81 ++- .../test_network_manager_group_crud.yaml | 83 +-- ...rk_manager_security_admin_config_crud.yaml | 73 +-- ...r_security_admin_rule_collection_crud.yaml | 524 +++++++++++++++++- ...ork_manager_security_user_config_crud.yaml | 69 +-- .../tests/latest/test_network_scenario.py | 13 +- .../vendored_sdks/models/_models.py | 7 +- .../vendored_sdks/models/_models_py3.py | 7 +- 8 files changed, 719 insertions(+), 138 deletions(-) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml index b0dae10b0c4..5993a82cea0 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": ["Routing", "Connectivity"]}}' @@ -14,29 +14,29 @@ interactions: Connection: - keep-alive Content-Length: - - '283' + - '282' Content-Type: - application/json ParameterSetName: - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.27.1 azsdk-python-mgmt-network/unknown Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"616d2e6b-d8bb-4dae-a2be-583516374282"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"ac996b89-b911-4d57-886c-e935a7bfcf59"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T05:53:52.4093356Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T05:53:52.4093356Z"}}' headers: cache-control: - no-cache content-length: - - '683' + - '918' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Aug 2021 09:00:34 GMT + - Wed, 29 Sep 2021 05:53:59 GMT expires: - '-1' pragma: @@ -52,7 +52,56 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager show + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"140034a2-0000-3400-0000-6153ff750000\"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"ac996b89-b911-4d57-886c-e935a7bfcf59"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 05:53:52","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 05:53:52"}}' + headers: + cache-control: + - no-cache + content-length: + - '940' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 05:54:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff status: code: 200 message: OK @@ -70,22 +119,24 @@ interactions: ParameterSetName: - --resource-group User-Agent: - - AZURECLI/2.27.1 azsdk-python-mgmt-network/unknown Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers?api-version=2021-02-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"0400da92-0000-4e00-0000-6124b5310000\"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"616d2e6b-d8bb-4dae-a2be-583516374282"}}]}' + string: '{"nextLink":"","value":[{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"140034a2-0000-3400-0000-6153ff750000\"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"ac996b89-b911-4d57-886c-e935a7bfcf59"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 05:53:52","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 05:53:52"}}]}' headers: cache-control: - no-cache content-length: - - '749' + - '966' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Aug 2021 09:00:36 GMT + - Wed, 29 Sep 2021 05:54:05 GMT expires: - '-1' pragma: @@ -119,7 +170,7 @@ interactions: ParameterSetName: - --resource-group --name --yes User-Agent: - - AZURECLI/2.27.1 azsdk-python-mgmt-network/unknown Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: @@ -131,7 +182,7 @@ interactions: content-length: - '0' date: - - Tue, 24 Aug 2021 09:00:41 GMT + - Wed, 29 Sep 2021 05:54:12 GMT expires: - '-1' pragma: diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml index 2b32a8a5e01..aaa283aacc8 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": ["Routing", "Connectivity"]}}' @@ -14,29 +14,29 @@ interactions: Connection: - keep-alive Content-Length: - - '283' + - '282' Content-Type: - application/json ParameterSetName: - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"75c61c09-243e-4319-a166-d041ea316bdf"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Routing","Connectivity"],"resourceGuid":"e5468e42-a345-449e-8266-07c29cb2816b"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T06:22:33.4413601Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:22:33.4413601Z"}}' headers: cache-control: - no-cache content-length: - - '683' + - '918' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 03:01:37 GMT + - Wed, 29 Sep 2021 06:22:37 GMT expires: - '-1' pragma: @@ -52,14 +52,14 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "MyNetworkGroup", "description": "A sample - group", "memberType": "VirtualNetwork", "groupMembers": [{"vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002", - "subnetId": ""}], "conditionalMembership": ""}}' + group", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' headers: Accept: - application/json @@ -70,29 +70,29 @@ interactions: Connection: - keep-alive Content-Length: - - '404' + - '392' Content-Type: - application/json ParameterSetName: - --name --network-manager-name --description --conditional-membership --display-name --member-type -g --group-members User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"A - sample group","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + sample group","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"fa1b0159-09eb-4b1a-ae4a-51d811f26fe8"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T06:22:38.7606925Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:22:38.7606925Z"}}' headers: cache-control: - no-cache content-length: - - '770' + - '1010' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 03:01:40 GMT + - Wed, 29 Sep 2021 06:22:41 GMT expires: - '-1' pragma: @@ -108,7 +108,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1199' status: code: 200 message: OK @@ -126,22 +126,24 @@ interactions: ParameterSetName: - -g --name --network-manager-name --description User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"04002901-0000-4e00-0000-612c4a140000\"","properties":{"displayName":"MyNetworkGroup","description":"A - sample group","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"1400a1ab-0000-3400-0000-615406310000\"","properties":{"displayName":"MyNetworkGroup","description":"A + sample group","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"fa1b0159-09eb-4b1a-ae4a-51d811f26fe8"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:22:38","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:22:38"}}' headers: cache-control: - no-cache content-length: - - '810' + - '1032' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 03:01:42 GMT + - Wed, 29 Sep 2021 06:22:42 GMT expires: - '-1' pragma: @@ -161,7 +163,7 @@ interactions: message: OK - request: body: '{"properties": {"displayName": "MyNetworkGroup", "description": "Desc changed.", - "groupMembers": [{"vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], "conditionalMembership": ""}}' headers: Accept: @@ -173,28 +175,29 @@ interactions: Connection: - keep-alive Content-Length: - - '355' + - '359' Content-Type: - application/json ParameterSetName: - -g --name --network-manager-name --description User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"Desc - changed.","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + changed.","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"fa1b0159-09eb-4b1a-ae4a-51d811f26fe8"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:22:38","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:22:44.2106205Z"}}' headers: cache-control: - no-cache content-length: - - '769' + - '1000' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 03:01:45 GMT + - Wed, 29 Sep 2021 06:22:46 GMT expires: - '-1' pragma: @@ -228,22 +231,24 @@ interactions: ParameterSetName: - -g --name --network-manager-name User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"04003001-0000-4e00-0000-612c4a190000\"","properties":{"displayName":"MyNetworkGroup","description":"Desc - changed.","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}' + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"1400a5ab-0000-3400-0000-615406360000\"","properties":{"displayName":"MyNetworkGroup","description":"Desc + changed.","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"fa1b0159-09eb-4b1a-ae4a-51d811f26fe8"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:22:38","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:22:44"}}' headers: cache-control: - no-cache content-length: - - '809' + - '1031' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 03:01:47 GMT + - Wed, 29 Sep 2021 06:22:50 GMT expires: - '-1' pragma: @@ -275,22 +280,24 @@ interactions: ParameterSetName: - -g --network-manager-name User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups?api-version=2021-02-01-preview response: body: string: '{"nextLink":"","value":[{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"Desc - changed.","groupMembers":[{"vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b3f8201a-4257-469f-a483-03def4f85d32"}}]}' + changed.","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"fa1b0159-09eb-4b1a-ae4a-51d811f26fe8"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:22:38","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:22:44"}}]}' headers: cache-control: - no-cache content-length: - - '795' + - '1017' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 03:01:50 GMT + - Wed, 29 Sep 2021 06:22:53 GMT expires: - '-1' pragma: @@ -324,7 +331,7 @@ interactions: ParameterSetName: - -g --name --network-manager-name --yes User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: @@ -336,7 +343,7 @@ interactions: content-length: - '0' date: - - Mon, 30 Aug 2021 03:01:59 GMT + - Wed, 29 Sep 2021 06:22:55 GMT expires: - '-1' pragma: diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml index 4e4252264bd..6753ac6627a 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": ["SecurityAdmin", "Connectivity"]}}' @@ -14,29 +14,29 @@ interactions: Connection: - keep-alive Content-Length: - - '289' + - '288' Content-Type: - application/json ParameterSetName: - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"3f5dc528-047c-4e7d-b9fe-229ff6428393"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"b3058217-9832-40fc-9078-17c32c8d50ea"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T06:26:29.5435507Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:26:29.5435507Z"}}' headers: cache-control: - no-cache content-length: - - '689' + - '924' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:57:59 GMT + - Wed, 29 Sep 2021 06:26:32 GMT expires: - '-1' pragma: @@ -52,7 +52,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK @@ -76,22 +76,22 @@ interactions: - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs --security-type --display-name User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + sample policy","provisioningState":"Succeeded","resourceGuid":"d5044a5c-ae10-437b-a1f5-c6ecf5a58e19"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T06:26:34.8311384Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:26:34.8311384Z"}}' headers: cache-control: - no-cache content-length: - - '536' + - '772' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:58:03 GMT + - Wed, 29 Sep 2021 06:26:35 GMT expires: - '-1' pragma: @@ -125,22 +125,24 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --description User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0400a030-0000-4e00-0000-612c9d9b0000\"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"1400dcac-0000-3400-0000-6154071b0000\"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"d5044a5c-ae10-437b-a1f5-c6ecf5a58e19"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:26:34","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:26:34"}}' headers: cache-control: - no-cache content-length: - - '576' + - '794' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:58:06 GMT + - Wed, 29 Sep 2021 06:26:37 GMT expires: - '-1' pragma: @@ -176,21 +178,22 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --description User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"d5044a5c-ae10-437b-a1f5-c6ecf5a58e19"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:26:34","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:26:37.4249858Z"}}' headers: cache-control: - no-cache content-length: - - '537' + - '764' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:58:08 GMT + - Wed, 29 Sep 2021 06:26:37 GMT expires: - '-1' pragma: @@ -206,7 +209,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1196' status: code: 200 message: OK @@ -224,21 +227,23 @@ interactions: ParameterSetName: - --network-manager-name -g User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations?api-version=2021-02-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0400a130-0000-4e00-0000-612c9da00000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}]}' + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"1400e0ac-0000-3400-0000-6154071e0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"d5044a5c-ae10-437b-a1f5-c6ecf5a58e19"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:26:34","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:26:37"}}]}' headers: cache-control: - no-cache content-length: - - '603' + - '821' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:58:10 GMT + - Wed, 29 Sep 2021 06:26:38 GMT expires: - '-1' pragma: @@ -270,21 +275,23 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0400a130-0000-4e00-0000-612c9da00000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"2abc8ebf-8bde-4886-97f6-fd9fcd177bf3"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"1400e0ac-0000-3400-0000-6154071e0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"d5044a5c-ae10-437b-a1f5-c6ecf5a58e19"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:26:34","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:26:37"}}' headers: cache-control: - no-cache content-length: - - '577' + - '795' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:58:12 GMT + - Wed, 29 Sep 2021 06:26:40 GMT expires: - '-1' pragma: @@ -318,7 +325,7 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --yes User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: @@ -330,7 +337,7 @@ interactions: content-length: - '0' date: - - Mon, 30 Aug 2021 08:58:15 GMT + - Wed, 29 Sep 2021 06:26:40 GMT expires: - '-1' pragma: @@ -342,7 +349,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14999' + - '14998' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml index 3c59340e322..25c84504bca 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": ["SecurityAdmin", "Connectivity"]}}' @@ -14,31 +14,29 @@ interactions: Connection: - keep-alive Content-Length: - - '289' + - '288' Content-Type: - application/json ParameterSetName: - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: - string: '{"error":{"code":"BadRequest","message":"Cannot have two Network Managers - applied to the same object overlapping scope accesses. Scope id: /subscriptions/00000000-0000-0000-0000-000000000000. - Network Manager Id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager. - Overlapping accesses: SecurityAdmin, Connectivity"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"49e21ee0-e66c-4b95-ab3c-3b367144b966"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:07.6036055Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:07.6036055Z"}}' headers: cache-control: - no-cache content-length: - - '471' + - '924' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Aug 2021 09:30:44 GMT + - Wed, 29 Sep 2021 08:32:11 GMT expires: - '-1' pragma: @@ -47,11 +45,515 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '391' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"d8c56c90-6db9-4689-a568-aa2425736517"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:17.2997886Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:17.2997886Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1009' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:18 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample + policy", "securityType": "AdminPolicy", "deleteExistingNSGs": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config create + Connection: + - keep-alive + Content-Length: + - '142' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs + --security-type --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"584f180a-708f-47a0-9fef-4f49b0e8f4ec"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:20.585641Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:20.585641Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '770' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:21 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' status: - code: 400 - message: Bad Request + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleCollection", "description": "A sample + policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection create + Connection: + - keep-alive + Content-Length: + - '367' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --rule-collection-name --description + --display-name --applies-to-groups + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:24.2882617Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:24.2882617Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1100' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection show + Connection: + - keep-alive + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140097d8-0000-3400-0000-615424990000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 08:32:24"}}' + headers: + cache-control: + - no-cache + content-length: + - '1122' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:26 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection update + Connection: + - keep-alive + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140097d8-0000-3400-0000-615424990000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 08:32:24"}}' + headers: + cache-control: + - no-cache + content-length: + - '1122' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleCollection2", "description": "A + sample policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection update + Connection: + - keep-alive + Content-Length: + - '368' + Content-Type: + - application/json + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:29.9291674Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1092' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:31 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection list + Connection: + - keep-alive + ParameterSetName: + - -g --configuration-name --network-manager-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"1400a3d8-0000-3400-0000-6154249f0000\"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 08:32:29"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1149' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 08:32:33 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 29 Sep 2021 08:32:36 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --configuration-name --network-manager-name -g --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 29 Sep 2021 08:32:40 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 29 Sep 2021 08:32:43 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml index ccc6fdfcdae..b5b84f60170 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"location": "jioindiawest", "properties": {"displayName": "TestNetworkManager", + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": ["SecurityUser", "Connectivity"]}}' @@ -14,29 +14,29 @@ interactions: Connection: - keep-alive Content-Length: - - '288' + - '287' Content-Type: - application/json ParameterSetName: - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"jioindiawest","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityUser","Connectivity"],"resourceGuid":"cd0574ac-49b7-44c4-8f17-994755f972f1"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityUser","Connectivity"],"resourceGuid":"cb68daca-6660-49f2-b8be-e43b4f7bcc0a"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T06:24:32.8037166Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:24:32.8037166Z"}}' headers: cache-control: - no-cache content-length: - - '688' + - '923' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:53:55 GMT + - Wed, 29 Sep 2021 06:24:39 GMT expires: - '-1' pragma: @@ -52,7 +52,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1199' status: code: 200 message: OK @@ -76,22 +76,22 @@ interactions: - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs --security-type --display-name User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + sample policy","provisioningState":"Succeeded","resourceGuid":"091a9f06-61a2-4d38-b11b-dc32f73fadc7"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T06:24:40.6503706Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:24:40.6503706Z"}}' headers: cache-control: - no-cache content-length: - - '534' + - '770' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:53:58 GMT + - Wed, 29 Sep 2021 06:24:42 GMT expires: - '-1' pragma: @@ -125,22 +125,24 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --description User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"04000430-0000-4e00-0000-612c9ca60000\"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"14003cac-0000-3400-0000-615406aa0000\"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"091a9f06-61a2-4d38-b11b-dc32f73fadc7"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:24:40","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:24:40"}}' headers: cache-control: - no-cache content-length: - - '574' + - '792' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:54:00 GMT + - Wed, 29 Sep 2021 06:24:46 GMT expires: - '-1' pragma: @@ -176,21 +178,22 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --description User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"091a9f06-61a2-4d38-b11b-dc32f73fadc7"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:24:40","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T06:24:47.6814856Z"}}' headers: cache-control: - no-cache content-length: - - '535' + - '762' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:54:02 GMT + - Wed, 29 Sep 2021 06:24:49 GMT expires: - '-1' pragma: @@ -224,21 +227,23 @@ interactions: ParameterSetName: - --network-manager-name -g User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations?api-version=2021-02-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"04000a30-0000-4e00-0000-612c9cab0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}]}' + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"14004fac-0000-3400-0000-615406b20000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"091a9f06-61a2-4d38-b11b-dc32f73fadc7"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:24:40","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:24:47"}}]}' headers: cache-control: - no-cache content-length: - - '601' + - '819' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:54:05 GMT + - Wed, 29 Sep 2021 06:24:53 GMT expires: - '-1' pragma: @@ -270,21 +275,23 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"04000a30-0000-4e00-0000-612c9cab0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"9db94d46-6ca9-4f95-8bee-b4dce580d74e"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"\"14004fac-0000-3400-0000-615406b20000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"091a9f06-61a2-4d38-b11b-dc32f73fadc7"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 06:24:40","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 06:24:47"}}' headers: cache-control: - no-cache content-length: - - '575' + - '793' content-type: - application/json; charset=utf-8 date: - - Mon, 30 Aug 2021 08:54:07 GMT + - Wed, 29 Sep 2021 06:24:54 GMT expires: - '-1' pragma: @@ -318,7 +325,7 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --yes User-Agent: - - AZURECLI/2.27.2 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_user_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: @@ -330,7 +337,7 @@ interactions: content-length: - '0' date: - - Mon, 30 Aug 2021 08:54:11 GMT + - Wed, 29 Sep 2021 06:24:55 GMT expires: - '-1' pragma: diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 510c435bc39..47e0d0c6e77 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -148,7 +148,7 @@ def test_network_manager_security_admin_config_crud(self, resource_group): def test_network_manager_security_admin_rule_collection_crud(self, virtual_network, resource_group): self.kwargs.update({ - 'collection_name': '', + 'collection_name': 'myTestCollection', 'config_name': 'myTestSecurityConfig', 'manager_name': 'TestNetworkManager', 'group_name': 'TestNetworkGroup', @@ -172,15 +172,16 @@ def test_network_manager_security_admin_rule_collection_crud(self, virtual_netwo '--description {description} --delete-existing-ns-gs true --security-type "AdminPolicy" --display-name MyTestConfig') self.cmd('network manager admin-rule collection create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' - '--role-collection-name {collection_name} --description {description} --display-name ASampleCollection ' + '--rule-collection-name {collection_name} --description {description} --display-name ASampleCollection ' '--applies-to-groups network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name}') - self.cmd('network manager admin-rule collection show -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --role-collection-name {collection_name}') + self.cmd('network manager admin-rule collection show -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name}') - self.cmd('network manager admin-rule collection update -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --role-collection-name {collection_name} ' + self.cmd('network manager admin-rule collection update -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name} ' '--display-name ASampleCollection2') self.cmd('network manager admin-rule collection list -g {rg} --configuration-name {config_name} --network-manager-name {manager_name}') - self.cmd('network manager admin-rule collection delete -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --role-collection-name {collection_name}') - + self.cmd('network manager admin-rule collection delete -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name} --yes') + self.cmd('network manager security-admin-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --yes') diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py index c84460c5269..f48bb0f58ba 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py @@ -2804,10 +2804,13 @@ class SystemData(msrest.serialization.Model): _attribute_map = { 'created_by': {'key': 'createdBy', 'type': 'str'}, 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + # TODO: Datetime Issue will be fixed later + # 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + # 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'str'}, } def __init__( diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py index b9f1489bf65..69cfb576374 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py @@ -3108,10 +3108,13 @@ class SystemData(msrest.serialization.Model): _attribute_map = { 'created_by': {'key': 'createdBy', 'type': 'str'}, 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + # TODO: Datetime Issue will be fixed later + # 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + # 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'str'}, } def __init__( From f3d34bc99cf6ea8b7acc5bdc1579d1f50a635e74 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Wed, 29 Sep 2021 17:38:07 +0800 Subject: [PATCH 13/28] test plan --- ...k_manager_admin_rule_collection_crud.yaml} | 106 +++++++++--------- .../tests/latest/test_network_scenario.py | 57 +++++++++- 2 files changed, 108 insertions(+), 55 deletions(-) rename src/network-manager/azext_network_manager/tests/latest/recordings/{test_network_manager_security_admin_rule_collection_crud.yaml => test_network_manager_admin_rule_collection_crud.yaml} (62%) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml similarity index 62% rename from src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml rename to src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml index 25c84504bca..ee7434e3c17 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_rule_collection_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml @@ -23,11 +23,11 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"49e21ee0-e66c-4b95-ab3c-3b367144b966"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:07.6036055Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:07.6036055Z"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"b5df0f5d-bea8-46d5-918c-31f61d4812bb"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T09:36:17.9792994Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T09:36:17.9792994Z"}}' headers: cache-control: - no-cache @@ -36,7 +36,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:11 GMT + - Wed, 29 Sep 2021 09:36:22 GMT expires: - '-1' pragma: @@ -52,13 +52,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1199' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample - policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], "conditionalMembership": ""}}' headers: Accept: @@ -79,11 +79,11 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: - string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"d8c56c90-6db9-4689-a568-aa2425736517"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:17.2997886Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:17.2997886Z"}}' + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"292a3f8b-e058-4ba0-abc0-b40ea8ba924e"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T09:36:23.6005657Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T09:36:23.6005657Z"}}' headers: cache-control: - no-cache @@ -92,7 +92,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:18 GMT + - Wed, 29 Sep 2021 09:36:24 GMT expires: - '-1' pragma: @@ -108,7 +108,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1198' status: code: 200 message: OK @@ -134,20 +134,20 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"584f180a-708f-47a0-9fef-4f49b0e8f4ec"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:20.585641Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:20.585641Z"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"d7f14a10-1936-4907-b8e6-55dea31f0538"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T09:36:25.7426655Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T09:36:25.7426655Z"}}' headers: cache-control: - no-cache content-length: - - '770' + - '772' content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:21 GMT + - Wed, 29 Sep 2021 09:36:26 GMT expires: - '-1' pragma: @@ -169,7 +169,7 @@ interactions: message: OK - request: body: '{"properties": {"displayName": "ASampleCollection", "description": "A sample - policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' headers: Accept: - application/json @@ -189,11 +189,11 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T08:32:24.2882617Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:24.2882617Z"}}' + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"29636cde-0777-44cb-a59e-dbefe9299b32"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-09-29T09:36:27.9130001Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T09:36:27.9130001Z"}}' headers: cache-control: - no-cache @@ -202,7 +202,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:25 GMT + - Wed, 29 Sep 2021 09:36:28 GMT expires: - '-1' pragma: @@ -218,7 +218,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK @@ -238,13 +238,13 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140097d8-0000-3400-0000-615424990000\"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 - 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 - 08:32:24"}}' + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140023f1-0000-3400-0000-6154339d0000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"29636cde-0777-44cb-a59e-dbefe9299b32"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 09:36:27","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 09:36:27"}}' headers: cache-control: - no-cache @@ -253,7 +253,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:26 GMT + - Wed, 29 Sep 2021 09:36:30 GMT expires: - '-1' pragma: @@ -287,13 +287,13 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140097d8-0000-3400-0000-615424990000\"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 - 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 - 08:32:24"}}' + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140023f1-0000-3400-0000-6154339d0000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"29636cde-0777-44cb-a59e-dbefe9299b32"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 09:36:27","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 09:36:27"}}' headers: cache-control: - no-cache @@ -302,7 +302,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:28 GMT + - Wed, 29 Sep 2021 09:36:32 GMT expires: - '-1' pragma: @@ -322,7 +322,7 @@ interactions: message: OK - request: body: '{"properties": {"displayName": "ASampleCollection2", "description": "A - sample policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + sample policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' headers: Accept: - application/json @@ -341,12 +341,12 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview response: body: - string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection2","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 - 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T08:32:29.9291674Z"}}' + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"29636cde-0777-44cb-a59e-dbefe9299b32"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 09:36:27","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-09-29T09:36:33.0835968Z"}}' headers: cache-control: - no-cache @@ -355,7 +355,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:31 GMT + - Wed, 29 Sep 2021 09:36:35 GMT expires: - '-1' pragma: @@ -391,13 +391,13 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections?api-version=2021-02-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"1400a3d8-0000-3400-0000-6154249f0000\"","properties":{"displayName":"ASampleCollection2","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"cd1c5f73-29c8-440e-9826-9f989072de04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 - 08:32:24","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 - 08:32:29"}}]}' + string: '{"nextLink":"","value":[{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"140036f1-0000-3400-0000-615433a30000\"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"29636cde-0777-44cb-a59e-dbefe9299b32"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"09/29/2021 + 09:36:27","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"09/29/2021 + 09:36:33"}}]}' headers: cache-control: - no-cache @@ -406,7 +406,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 29 Sep 2021 08:32:33 GMT + - Wed, 29 Sep 2021 09:36:36 GMT expires: - '-1' pragma: @@ -442,7 +442,7 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview response: body: string: '' @@ -452,7 +452,7 @@ interactions: content-length: - '0' date: - - Wed, 29 Sep 2021 08:32:36 GMT + - Wed, 29 Sep 2021 09:36:39 GMT expires: - '-1' pragma: @@ -486,7 +486,7 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview response: body: string: '' @@ -496,7 +496,7 @@ interactions: content-length: - '0' date: - - Wed, 29 Sep 2021 08:32:40 GMT + - Wed, 29 Sep 2021 09:36:41 GMT expires: - '-1' pragma: @@ -530,7 +530,7 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: string: '' @@ -540,7 +540,7 @@ interactions: content-length: - '0' date: - - Wed, 29 Sep 2021 08:32:43 GMT + - Wed, 29 Sep 2021 09:36:44 GMT expires: - '-1' pragma: @@ -552,7 +552,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14998' + - '14999' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 47e0d0c6e77..0dbc700505b 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -143,9 +143,16 @@ def test_network_manager_security_admin_config_crud(self, resource_group): self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') - @ResourceGroupPreparer(name_prefix='test_network_manager_security_admin_rule_collection_crud', location='eastus2euap') + @unittest.skip('TODO') + @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_crud', location='eastus2euap') @VirtualNetworkPreparer() - def test_network_manager_security_admin_rule_collection_crud(self, virtual_network, resource_group): + def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): + pass + + + @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_collection_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_admin_rule_collection_crud(self, virtual_network, resource_group): self.kwargs.update({ 'collection_name': 'myTestCollection', @@ -185,3 +192,49 @@ def test_network_manager_security_admin_rule_collection_crud(self, virtual_netwo self.cmd('network manager admin-rule collection delete -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name} --yes') self.cmd('network manager security-admin-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --yes') + + + @unittest.skip('TODO') + @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_user_rule_crud(self, virtual_network, resource_group): + pass + + + @unittest.skip('TODO') + @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_collection_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_user_rule_collection_crud(self, virtual_network, resource_group): + pass + + + @unittest.skip('TODO') + @ResourceGroupPreparer(name_prefix='test_network_manager_vnet_security_perimeter_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_vnet_security_perimeter_crud(self, virtual_network, resource_group): + # TODO: need test other list commands: + # manager perimeter-associable-resource-types list + pass + + + @unittest.skip('TODO') + @ResourceGroupPreparer(name_prefix='test_network_manager_connect_config_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_connect_config_crud(self, virtual_network, resource_group): + pass + + + @unittest.skip('TODO') + @ResourceGroupPreparer(name_prefix='test_network_manager_list_queries', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_list_queries(self, virtual_network, resource_group): + # TODO: need test other list commands: + # manager deploy-status list + # manager effect-vent list-by-network-group + # manager effect-vent list-by-network-manager + # manager active-config list + # manager effective-config list + # manager active-security-admin-rule list + # manager active-security-user-rule list + # manager effective-security-admin-rule list + pass From cdeca48c911d8f9b851d236057294d896a07833d Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Fri, 8 Oct 2021 14:01:09 +0800 Subject: [PATCH 14/28] test admin-rule --- .../azext_network_manager/_help.py | 20 + .../azext_network_manager/_params.py | 42 +- .../azext_network_manager/commands.py | 2 +- .../azext_network_manager/custom.py | 36 +- .../test_network_manager_admin_rule_crud.yaml | 526 ++++++++++++++++++ .../tests/latest/test_network_scenario.py | 41 +- 6 files changed, 639 insertions(+), 28 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 5c773d69073..28cf82e9328 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -408,6 +408,16 @@ short-summary: Manage adminrule with network """ +helps['network manager admin-rule create'] = """ + type: command + short-summary: "Create a network manager security configuration admin rule." + examples: + - name: Create security admin rules + text: |- + az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" --kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound" +""" + helps['network manager admin-rule list'] = """ type: command short-summary: "Retrieves a network manager security configuration admin rule." @@ -418,6 +428,16 @@ "testNetworkManager" --resource-group "rg1" """ +helps['network manager admin-rule update'] = """ + type: command + short-summary: "Update a network manager security configuration admin rule in a subscription." + examples: + - name: Update security admin rule + text: |- + az network manager admin-rule update --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" --access "Deny" +""" + helps['network manager admin-rule show'] = """ type: command short-summary: "Gets a network manager security configuration admin rule in a subscription." diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index cab1b798d2d..f0b07f385f6 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -376,19 +376,47 @@ def load_arguments(self, _): id_part='child_name_1') c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') - with self.argument_context('network manager admin-rule show') as c: + with self.argument_context('network manager admin-rule') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') - with self.argument_context('network manager admin-rule delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', - id_part='child_name_1') - c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + with self.argument_context('network manager admin-rule create') as c: + c.argument('access', type=str, help='Indicates the access allowed for this particular rule.', arg_type=get_enum_type(['Allow', 'Deny', 'AlwaysAllow'])) + c.argument('flag', type=str, help='Default rule flag.') + c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default'])) + c.argument('priority', type=int, help='The priority of the rule.') + c.argument('sources', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') + c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' + 'destination IP ranges.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' + 'protocol this rule applies to.') + c.argument('source_port_ranges', nargs='+', help='The source port ranges.') + c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' + 'matched against the rule in inbound or outbound.') + + with self.argument_context('network manager admin-rule update') as c: + c.argument('access', type=str, help='Indicates the access allowed for this particular rule.', arg_type=get_enum_type(['Allow', 'Deny', 'AlwaysAllow'])) + c.argument('flag', type=str, help='Default rule flag.') + c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default'])) + c.argument('priority', type=int, help='The priority of the rule.') + c.argument('sources', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') + c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' + 'destination IP ranges.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' + 'protocol this rule applies to.') + c.argument('source_port_ranges', nargs='+', help='The source port ranges.') + c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' + 'matched against the rule in inbound or outbound.') with self.argument_context('network manager user-rule list') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 769a0b7a399..f776f7c2b74 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -191,7 +191,7 @@ def load_command_table(self, _): with self.command_group('network manager admin-rule', network_adminrule, client_factory=cf_adminrule) as g: g.custom_command('create', 'network_manager_admin_rule_create') - g.generic_update_command('update', setter_arg_name='admin_rule', custom_func_name='network_manager_admin_update') + g.generic_update_command('update', setter_arg_name='admin_rule', custom_func_name='network_manager_admin_rule_update') g.custom_command('list', 'network_manager_admin_rule_list') g.custom_show_command('show', 'network_manager_admin_rule_show') g.custom_command('delete', 'network_manager_admin_rule_delete', confirmation=True) diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 2c9d6c75b57..57fcf843e5a 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -616,27 +616,27 @@ def network_manager_admin_rule_create(client, configuration_name=configuration_name, rule_collection_name=rule_collection_name, rule_name=rule_name, - rule=rule) + admin_rule=rule) def network_manager_admin_rule_update(instance, - resource_group_name, - network_manager_name, - configuration_name, - collection_name, - rule_name, - kind=None, - display_name=None, - description=None, - protocol=None, - sources=None, - destinations=None, - source_port_ranges=None, - destination_port_ranges=None, - access=None, - priority=None, - direction=None, - flag=None): + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + rule_name, + kind=None, + display_name=None, + description=None, + protocol=None, + sources=None, + destinations=None, + source_port_ranges=None, + destination_port_ranges=None, + access=None, + priority=None, + direction=None, + flag=None): if kind == 'DefaultAdminRule': if flag is not None: instance.flag = flag diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml new file mode 100644 index 00000000000..6e263cad4e8 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml @@ -0,0 +1,526 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityAdmin", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '288' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"4af49608-5401-4572-a4f3-b46371fd6d6f"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T03:44:46.8935054Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T03:44:46.8935054Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '924' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:44:51 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '391' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"eeeaab10-04a7-4587-8be1-ecba276e8a70"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T03:44:52.2122003Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T03:44:52.2122003Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1009' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:44:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample + policy", "securityType": "AdminPolicy", "deleteExistingNSGs": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config create + Connection: + - keep-alive + Content-Length: + - '142' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs + --security-type --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"1c4830c1-0ab3-47cb-bd30-70d66d9b3b22"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T03:44:54.1344492Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T03:44:54.1344492Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '772' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:44:56 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleCollection", "description": "A sample + policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule collection create + Connection: + - keep-alive + Content-Length: + - '367' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --rule-collection-name --description + --display-name --applies-to-groups + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"396c50d3-01fe-4a07-ac1e-f1399f0b11fd"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T03:44:57.7307094Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T03:44:57.7307094Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1100' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:44:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"kind": "Custom", "properties": {"protocol": "Tcp", "access": "Allow", + "priority": 32, "direction": "Inbound"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule create + Connection: + - keep-alive + Content-Length: + - '112' + Content-Type: + - application/json + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --kind --protocol --access --priority --direction + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"69f5e3e1-21e8-4f08-97c6-a49e478957b2"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T03:45:02.1212584Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T03:45:02.1212584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '975' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:45:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule show + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"0100c8cc-0000-3400-0000-615fbebf0000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"69f5e3e1-21e8-4f08-97c6-a49e478957b2"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 03:45:02","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 03:45:02"}}' + headers: + cache-control: + - no-cache + content-length: + - '997' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:45:05 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule update + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --access + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"0100c8cc-0000-3400-0000-615fbebf0000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"69f5e3e1-21e8-4f08-97c6-a49e478957b2"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 03:45:02","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 03:45:02"}}' + headers: + cache-control: + - no-cache + content-length: + - '997' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:45:06 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"kind": "Custom", "properties": {"displayName": "", "description": "", + "protocol": "Tcp", "sources": [], "destinations": [], "sourcePortRanges": [], + "destinationPortRanges": [], "access": "Deny", "priority": 32, "direction": + "Inbound"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule update + Connection: + - keep-alive + Content-Length: + - '237' + Content-Type: + - application/json + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --access + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Deny","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"69f5e3e1-21e8-4f08-97c6-a49e478957b2"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 03:45:02","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T03:45:07.5822849Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '965' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:45:07 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule list + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"010083cd-0000-3400-0000-615fbec40000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Deny","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"69f5e3e1-21e8-4f08-97c6-a49e478957b2"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 03:45:02","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 03:45:07"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1022' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 03:45:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager admin-rule delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 08 Oct 2021 03:45:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 0dbc700505b..35f89db21d4 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -143,11 +143,48 @@ def test_network_manager_security_admin_config_crud(self, resource_group): self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') - @unittest.skip('TODO') @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): - pass + + self.kwargs.update({ + 'rule_name': 'myRule', + 'collection_name': 'myTestCollection', + 'config_name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'group_name': 'TestNetworkGroup', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + + self.cmd('network manager security-admin-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--description {description} --delete-existing-ns-gs true --security-type "AdminPolicy" --display-name MyTestConfig') + + self.cmd('network manager admin-rule collection create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--rule-collection-name {collection_name} --description {description} --display-name ASampleCollection ' + '--applies-to-groups network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name}') + + + self.cmd('network manager admin-rule create -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} ' + '--rule-name {rule_name} --kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound"') + self.cmd('network manager admin-rule show -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name}') + self.cmd('network manager admin-rule update -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name} ' + '--access "Deny"') + self.cmd('network manager admin-rule list -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name}') + self.cmd('network manager admin-rule delete -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name} --yes') @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_collection_crud', location='eastus2euap') From 0b94a111ba88707db691296bccbd63baa9dbd553 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Fri, 8 Oct 2021 16:11:29 +0800 Subject: [PATCH 15/28] test user rule collection --- .../azext_network_manager/_help.py | 136 ++++- .../azext_network_manager/_params.py | 47 ++ .../azext_network_manager/commands.py | 2 +- .../azext_network_manager/custom.py | 30 +- ...ork_manager_user_rule_collection_crud.yaml | 559 ++++++++++++++++++ .../tests/latest/test_network_scenario.py | 39 +- 6 files changed, 784 insertions(+), 29 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_collection_crud.yaml diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 28cf82e9328..96deebe32e1 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -403,6 +403,63 @@ --network-manager-name "testNetworkManager" --resource-group "rg1" """ +helps['network manager admin-rule collection'] = """ + type: group + short-summary: Manage admin rule collection with network +""" + +helps['network manager admin-rule collection create'] = """ + type: command + short-summary: "Create a network manager security configuration admin rule collection." + examples: + - name: Create security admin rule collections + text: |- + az network manager admin-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ +--rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ +--applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +""" + +helps['network manager admin-rule collection list'] = """ + type: command + short-summary: "List network manager security configuration admin rule collections." + examples: + - name: List security admin rule collections + text: |- + az network manager admin-rule collection list --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" +""" + +helps['network manager admin-rule collection update'] = """ + type: command + short-summary: "Update a network manager security configuration admin rule collection in a subscription." + examples: + - name: Update security admin rule collection + text: |- + az network manager admin-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +""" + +helps['network manager admin-rule collection show'] = """ + type: command + short-summary: "Gets a network manager security configuration admin rule collection in a subscription." + examples: + - name: Gets security admin rule collection + text: |- + az network manager admin-rule collection show --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" +""" + +helps['network manager admin-rule collection delete'] = """ + type: command + short-summary: "Delete an admin rule collection." + examples: + - name: Delete an admin rule collection. + text: |- + az network manager admin-rule collection delete --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection +""" + + helps['network manager admin-rule'] = """ type: group short-summary: Manage adminrule with network @@ -415,7 +472,7 @@ - name: Create security admin rules text: |- az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" --kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" --kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound" """ helps['network manager admin-rule list'] = """ @@ -425,7 +482,7 @@ - name: List security admin rules text: |- az network manager admin-rule list --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" """ helps['network manager admin-rule update'] = """ @@ -435,7 +492,7 @@ - name: Update security admin rule text: |- az network manager admin-rule update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" --access "Deny" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" --access "Deny" """ helps['network manager admin-rule show'] = """ @@ -445,7 +502,7 @@ - name: Gets security admin rule text: |- az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" """ helps['network manager admin-rule delete'] = """ @@ -455,7 +512,63 @@ - name: Deletes an admin rule. text: |- az network manager admin-rule delete --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleAdminRule" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" +""" + +helps['network manager user-rule collection'] = """ + type: group + short-summary: Manage user rule collection with network +""" + +helps['network manager user-rule collection create'] = """ + type: command + short-summary: "Create a network manager security configuration user rule collection." + examples: + - name: Create security user rule collections + text: |- + az network manager user-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ +--rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ +--applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +""" + +helps['network manager user-rule collection list'] = """ + type: command + short-summary: "List network manager security configuration user rule collections." + examples: + - name: List security user rule collections + text: |- + az network manager user-rule collection list --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" +""" + +helps['network manager user-rule collection update'] = """ + type: command + short-summary: "Update a network manager security configuration user rule collection in a subscription." + examples: + - name: Update security user rule collection + text: |- + az network manager user-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +""" + +helps['network manager user-rule collection show'] = """ + type: command + short-summary: "Gets a network manager security configuration user rule collection in a subscription." + examples: + - name: Gets security user rule collection + text: |- + az network manager user-rule collection show --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" +""" + +helps['network manager user-rule collection delete'] = """ + type: command + short-summary: "Delete an user rule collection." + examples: + - name: Delete an user rule collection. + text: |- + az network manager user-rule collection delete --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection """ helps['network manager user-rule'] = """ @@ -470,7 +583,7 @@ - name: List security user rules text: |- az network manager user-rule list --configuration-name "myTestConnectivityConfig" \ ---network-manager-name "testNetworkManager" --resource-group "rg1" +--network-manager-name "testNetworkManager" --resource-group "rg1 --rule-collection-name "myTestCollection"" """ helps['network manager user-rule show'] = """ @@ -480,7 +593,7 @@ - name: Gets a user rule text: |- az network manager user-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" +"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule --rule-collection-name "myTestCollection"" """ helps['network manager user-rule create'] = """ @@ -509,7 +622,7 @@ - name: Create a user rule text: |- az network manager user-rule create --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" --description "Sample User Rule" \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleUserRule" --description "Sample User Rule" \ --destination address-prefix="*" address-prefix-type="IPPrefix" --destination-port-ranges "22" --direction "Inbound" \ --source address-prefix="*" address-prefix-type="IPPrefix" --source-port-ranges "0-65535" --protocol "Tcp" """ @@ -536,6 +649,11 @@ address-prefix-type: Address prefix type. Multiple actions can be specified by using more than one --destination argument. + examples: + - name: Update a user rule + text: |- + az network manager user-rule update --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleUserRule" --description "Sample User Rule" """ helps['network manager user-rule delete'] = """ @@ -545,5 +663,5 @@ - name: Delete a user rule. text: |- az network manager user-rule delete --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleUserRule" """ diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index f0b07f385f6..308d127e65f 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -418,6 +418,53 @@ def load_arguments(self, _): c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') + with self.argument_context('network manager user-rule collection create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' + 'for configuration') + + with self.argument_context('network manager user-rule collection update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') + c.argument('display_name', type=str, help='A friendly name for the rule.') + c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') + c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' + 'for configuration') + + with self.argument_context('network manager user-rule collection list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, 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('network manager user-rule collection show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') + + with self.argument_context('network manager user-rule collection delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', + id_part='child_name_1') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') + with self.argument_context('network manager user-rule list') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index f776f7c2b74..2866c1b42d8 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -105,7 +105,7 @@ def load_command_table(self, _): ) network_userrulecollection = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._user_rule_collection_operations#UserRuleCollectionsOperations.{}', + operations_tmpl='azext_network_manager.vendored_sdks.operations._user_rule_collections_operations#UserRuleCollectionsOperations.{}', client_factory=cf_userrulecollection ) diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 57fcf843e5a..d6293538ccd 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -719,13 +719,13 @@ def network_manager_user_rule_collection_list(client, def network_manager_user_rule_collection_create(client, - resource_group_name, - network_manager_name, - configuration_name, - rule_collection_name, - display_name=None, - description=None, - applies_to_groups=None): + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + display_name=None, + description=None, + applies_to_groups=None): rule_collection = {} rule_collection['display_name'] = display_name rule_collection['description'] = description @@ -734,17 +734,17 @@ def network_manager_user_rule_collection_create(client, network_manager_name=network_manager_name, configuration_name=configuration_name, rule_collection_name=rule_collection_name, - rule_collection=rule_collection) + user_rule_collection=rule_collection) def network_manager_user_rule_collection_update(instance, - resource_group_name, - network_manager_name, - configuration_name, - rule_collection_name, - display_name=None, - description=None, - applies_to_groups=None): + resource_group_name, + network_manager_name, + configuration_name, + rule_collection_name, + display_name=None, + description=None, + applies_to_groups=None): if display_name is not None: instance.display_name = display_name if description is not None: diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_collection_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_collection_crud.yaml new file mode 100644 index 00000000000..d09316084ee --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_collection_crud.yaml @@ -0,0 +1,559 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityUser", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"22c5c4d2-f231-43f2-a419-23b63e1d6e59"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T07:35:38.7688739Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T07:35:38.7688739Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '923' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '391' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"9253cd40-8c06-4a8f-b633-7f5c032078f2"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T07:35:45.3043524Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T07:35:45.3043524Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1009' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample + policy", "securityType": "UserPolicy", "deleteExistingNSGs": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config create + Connection: + - keep-alive + Content-Length: + - '141' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs + --security-type --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"16e99ffb-0c77-4837-86e4-39b4cc5f6a49"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T07:35:48.842456Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T07:35:48.842456Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '768' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:49 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleCollection", "description": "A sample + policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection create + Connection: + - keep-alive + Content-Length: + - '367' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --rule-collection-name --description + --display-name --applies-to-groups + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"b26fb16d-28a9-40b0-8965-5013cfe8a6ff"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T07:35:50.9287073Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T07:35:50.9287073Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1098' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:51 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection show + Connection: + - keep-alive + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections","etag":"\"050011b7-0000-3400-0000-615ff4d80000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"b26fb16d-28a9-40b0-8965-5013cfe8a6ff"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 07:35:50","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 07:35:50"}}' + headers: + cache-control: + - no-cache + content-length: + - '1120' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:53 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection update + Connection: + - keep-alive + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections","etag":"\"050011b7-0000-3400-0000-615ff4d80000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"b26fb16d-28a9-40b0-8965-5013cfe8a6ff"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 07:35:50","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 07:35:50"}}' + headers: + cache-control: + - no-cache + content-length: + - '1120' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:56 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleCollection2", "description": "A + sample policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection update + Connection: + - keep-alive + Content-Length: + - '368' + Content-Type: + - application/json + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"b26fb16d-28a9-40b0-8965-5013cfe8a6ff"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 07:35:50","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T07:35:57.0032648Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1090' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:35:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection list + Connection: + - keep-alive + ParameterSetName: + - -g --configuration-name --network-manager-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections","etag":"\"050070b8-0000-3400-0000-615ff4de0000\"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"b26fb16d-28a9-40b0-8965-5013cfe8a6ff"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 07:35:50","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 07:35:57"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1147' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 07:36:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --configuration-name --network-manager-name --rule-collection-name --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 08 Oct 2021 07:36:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --configuration-name --network-manager-name -g --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 08 Oct 2021 07:36:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 08 Oct 2021 07:36:07 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 35f89db21d4..bb4236536db 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -231,19 +231,50 @@ def test_network_manager_admin_rule_collection_crud(self, virtual_network, resou self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --yes') - @unittest.skip('TODO') @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_user_rule_crud(self, virtual_network, resource_group): pass - - @unittest.skip('TODO') @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_collection_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_user_rule_collection_crud(self, virtual_network, resource_group): - pass + self.kwargs.update({ + 'collection_name': 'myTestCollection', + 'config_name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'group_name': 'TestNetworkGroup', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + + self.cmd('network manager security-user-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--description {description} --delete-existing-ns-gs true --security-type "UserPolicy" --display-name MyTestConfig') + + self.cmd('network manager user-rule collection create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--rule-collection-name {collection_name} --description {description} --display-name ASampleCollection ' + '--applies-to-groups network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name}') + + self.cmd('network manager user-rule collection show -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name}') + self.cmd('network manager user-rule collection update -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name} ' + '--display-name ASampleCollection2') + self.cmd('network manager user-rule collection list -g {rg} --configuration-name {config_name} --network-manager-name {manager_name}') + self.cmd('network manager user-rule collection delete -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name} --yes') + self.cmd('network manager security-user-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --yes') @unittest.skip('TODO') @ResourceGroupPreparer(name_prefix='test_network_manager_vnet_security_perimeter_crud', location='eastus2euap') From 669a93a9f05eb1d857c738b0c9f978365279ba33 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Fri, 8 Oct 2021 17:28:59 +0800 Subject: [PATCH 16/28] test user rule --- .../azext_network_manager/_help.py | 40 +- .../azext_network_manager/_params.py | 42 +- .../azext_network_manager/custom.py | 6 +- .../test_network_manager_user_rule_crud.yaml | 524 ++++++++++++++++++ .../tests/latest/test_network_scenario.py | 37 +- 5 files changed, 616 insertions(+), 33 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_crud.yaml diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 96deebe32e1..073031e36c0 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -468,6 +468,25 @@ helps['network manager admin-rule create'] = """ type: command short-summary: "Create a network manager security configuration admin rule." + parameters: + - name: --source + short-summary: "The CIDR or source IP ranges." + long-summary: | + Usage: --source address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --source argument. + - name: --destination + short-summary: "The destination address prefixes. CIDR or destination IP ranges." + long-summary: | + Usage: --destination address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --destination argument. examples: - name: Create security admin rules text: |- @@ -488,6 +507,25 @@ helps['network manager admin-rule update'] = """ type: command short-summary: "Update a network manager security configuration admin rule in a subscription." + parameters: + - name: --source + short-summary: "The CIDR or source IP ranges." + long-summary: | + Usage: --source address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --source argument. + - name: --destination + short-summary: "The destination address prefixes. CIDR or destination IP ranges." + long-summary: | + Usage: --destination address-prefix=XX address-prefix-type=XX + + address-prefix: Address prefix. + address-prefix-type: Address prefix type. + + Multiple actions can be specified by using more than one --destination argument. examples: - name: Update security admin rule text: |- @@ -649,7 +687,7 @@ address-prefix-type: Address prefix type. Multiple actions can be specified by using more than one --destination argument. - examples: + examples: - name: Update a user rule text: |- az network manager user-rule update --configuration-name "myTestSecurityConfig" --network-manager-name \ diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 308d127e65f..4cef2670351 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -465,62 +465,48 @@ def load_arguments(self, _): id_part='child_name_1') c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') - with self.argument_context('network manager user-rule list') as c: + + with self.argument_context('network manager user-rule') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') + c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') + c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') + + with self.argument_context('network manager user-rule list') as c: c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, 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('network manager user-rule show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', - id_part='child_name_1') - c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') - with self.argument_context('network manager user-rule create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') - c.argument('rule_name', type=str, help='The name of the rule.') c.argument('display_name', type=str, help='A friendly name for the rule.') c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' 'protocol this rule applies to.') - c.argument('source', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') - c.argument('destination', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' + c.argument('sources', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') + c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' 'destination IP ranges.') c.argument('source_port_ranges', nargs='+', help='The source port ranges.') c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') + c.argument('flag', type=str, help='Default rule flag.') + c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default'])) with self.argument_context('network manager user-rule update') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', - id_part='child_name_1') - c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') c.argument('display_name', type=str, help='A friendly name for the rule.') c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.') c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' 'protocol this rule applies to.') - c.argument('source', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') - c.argument('destination', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' + c.argument('sources', action=AddSource, nargs='+', help='The CIDR or source IP ranges.') + c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' 'destination IP ranges.') c.argument('source_port_ranges', nargs='+', help='The source port ranges.') c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') + c.argument('flag', type=str, help='Default rule flag.') + c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default'])) c.ignore('user_rule') - - with self.argument_context('network manager user-rule delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') - c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', - id_part='child_name_1') - c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index d6293538ccd..9afbd3319db 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -771,9 +771,9 @@ def network_manager_user_rule_collection_delete(client, configuration_name, rule_collection_name): return client.delete(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - configuration_name=configuration_name, - rule_collection_name=rule_collection_name) + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name) def network_manager_user_rule_list(client, diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_crud.yaml new file mode 100644 index 00000000000..69dc4ecd9a9 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_crud.yaml @@ -0,0 +1,524 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityUser", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"af536de1-288b-490f-913f-08493c86f777"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T09:27:34.630078Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T09:27:34.630078Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '921' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '391' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"7f14bf5f-7545-4e86-b244-4dbfba3aeee1"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T09:27:40.8058815Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T09:27:40.8058815Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1009' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample + policy", "securityType": "UserPolicy", "deleteExistingNSGs": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-user-config create + Connection: + - keep-alive + Content-Length: + - '141' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs + --security-type --display-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityUserConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"e5b055d5-d0bf-42c1-8076-ffcb485950b6"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T09:27:42.7871791Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T09:27:42.7871791Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '770' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleCollection", "description": "A sample + policy", "appliesToGroups": [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule collection create + Connection: + - keep-alive + Content-Length: + - '367' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --rule-collection-name --description + --display-name --applies-to-groups + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"43c5d9f5-885a-4d34-89e1-f8c7114db494"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T09:27:44.7900336Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T09:27:44.7900336Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1098' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"kind": "Custom", "properties": {"protocol": "Tcp", "direction": "Inbound"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule create + Connection: + - keep-alive + Content-Length: + - '77' + Content-Type: + - application/json + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --kind --protocol --direction + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","protocol":"Tcp","direction":"Inbound","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"flag":"","resourceGuid":"ebdc3ea5-0cbc-4c42-ba9f-6e76d5d68125"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-08T09:27:46.161694Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T09:27:46.161694Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '908' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule show + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections/rules","etag":"\"0800d1e7-0000-3400-0000-61600f130000\"","properties":{"displayName":"","description":"","protocol":"Tcp","direction":"Inbound","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"flag":"","resourceGuid":"ebdc3ea5-0cbc-4c42-ba9f-6e76d5d68125"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 09:27:46","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 09:27:46"}}' + headers: + cache-control: + - no-cache + content-length: + - '932' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:50 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule update + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --protocol + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections/rules","etag":"\"0800d1e7-0000-3400-0000-61600f130000\"","properties":{"displayName":"","description":"","protocol":"Tcp","direction":"Inbound","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"flag":"","resourceGuid":"ebdc3ea5-0cbc-4c42-ba9f-6e76d5d68125"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 09:27:46","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 09:27:46"}}' + headers: + cache-control: + - no-cache + content-length: + - '932' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"kind": "Custom", "properties": {"displayName": "", "description": "", + "protocol": "Udp", "sources": [], "destinations": [], "sourcePortRanges": [], + "destinationPortRanges": [], "direction": "Inbound"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule update + Connection: + - keep-alive + Content-Length: + - '203' + Content-Type: + - application/json + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --protocol + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","protocol":"Udp","direction":"Inbound","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"flag":"","resourceGuid":"ebdc3ea5-0cbc-4c42-ba9f-6e76d5d68125"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 09:27:46","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-08T09:27:53.7732485Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '901' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule list + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections/rules","etag":"\"0800c0e8-0000-3400-0000-61600f1b0000\"","properties":{"displayName":"","description":"","protocol":"Udp","direction":"Inbound","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"flag":"","resourceGuid":"ebdc3ea5-0cbc-4c42-ba9f-6e76d5d68125"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/08/2021 + 09:27:46","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/08/2021 + 09:27:53"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '958' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 08 Oct 2021 09:27:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager user-rule delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --network-manager-name --configuration-name --rule-collection-name --rule-name + --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_user_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 08 Oct 2021 09:27:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index bb4236536db..6b079944d92 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -234,7 +234,42 @@ def test_network_manager_admin_rule_collection_crud(self, virtual_network, resou @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_user_rule_crud(self, virtual_network, resource_group): - pass + self.kwargs.update({ + 'rule_name': 'myRule', + 'collection_name': 'myTestCollection', + 'config_name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'group_name': 'TestNetworkGroup', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + + self.cmd('network manager security-user-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--description {description} --delete-existing-ns-gs true --security-type "UserPolicy" --display-name MyTestConfig') + + self.cmd('network manager user-rule collection create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--rule-collection-name {collection_name} --description {description} --display-name ASampleCollection ' + '--applies-to-groups network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name}') + + self.cmd('network manager user-rule create -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} ' + '--rule-name {rule_name} --kind "Custom" --protocol "Tcp" --direction "Inbound"') + self.cmd('network manager user-rule show -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name}') + self.cmd('network manager user-rule update -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name} ' + '--protocol "Udp"') + self.cmd('network manager user-rule list -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name}') + self.cmd('network manager user-rule delete -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name} --yes') @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_collection_crud', location='eastus2euap') @VirtualNetworkPreparer() From 3889e3906278ef629601c732bf3b65605175215b Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Sat, 9 Oct 2021 14:01:43 +0800 Subject: [PATCH 17/28] test connection configuration --- .../azext_network_manager/_help.py | 32 +- .../azext_network_manager/_params.py | 6 +- .../azext_network_manager/action.py | 4 +- .../azext_network_manager/custom.py | 10 +- ...t_network_manager_connect_config_crud.yaml | 424 ++++++++++++++++++ .../tests/latest/test_network_scenario.py | 32 +- 6 files changed, 489 insertions(+), 19 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 073031e36c0..d38bed83430 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -187,19 +187,28 @@ network-group-id: Network group Id. use-hub-gateway: Flag if need to use hub gateway. is-global: Flag if global is supported. - group-connectivity: Group connectivity type. + group-connectivity: Group connectivity type. Allowed values: None, DirectlyConnected Multiple actions can be specified by using more than one --applies-to-groups argument. + - name: --hubs + short-summary: "The hub vnets" + long-summary: | + Usage: --hubs resource-id=XX resource-type=XX + + resource-id: Resource ID + resource-type: Resource Type + + Multiple actions can be specified by using more than one --hubs argument. examples: - name: Create/Update Azure Virtual Network Manager Connectivity Configuration text: |- az network manager connect-config create --configuration-name "myTestConnectivityConfig" --description \ -"Sample Configuration" --applies-to-groups group-connectivity="Transitive" is-global=false \ +"Sample Configuration" --applies-to-groups group-connectivity="None" is-global=false \ network-group-id="subscriptions/subscriptionA/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManager\ -s/testNetworkManager/networkManagerGroups/group1" use-hub-gateway=true --connectivity-topology "HubAndSpokeTopology" \ ---delete-existing-peering true --display-name "myTestConnectivityConfig" --hub-id "subscriptions/subscriptionA/resource\ -Groups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig" --is-global true \ ---network-manager-name "testNetworkManager" --resource-group "myResourceGroup" +s/testNetworkManager/networkManagerGroups/group1" use-hub-gateway=true --connectivity-topology "HubAndSpoke" \ +--delete-existing-peering true --display-name "myTestConnectivityConfig" --hubs resource-id="subscriptions/subscriptionA/resource\ +Groups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig" resource-type="Microsoft.Network/virtualNetworks" \ +--is-global true --network-manager-name "testNetworkManager" --resource-group "myResourceGroup" """ helps['network manager connect-config update'] = """ @@ -214,9 +223,18 @@ network-group-id: Network group Id. use-hub-gateway: Flag if need to use hub gateway. is-global: Flag if global is supported. - group-connectivity: Group connectivity type. + group-connectivity: Group connectivity type. Allowed values: None, DirectlyConnected Multiple actions can be specified by using more than one --applies-to-groups argument. + - name: --hubs + short-summary: "The hub vnets" + long-summary: | + Usage: --hubs resource-id=XX resource-type=XX + + resource-id: Resource ID + resource-type: Resource Type + + Multiple actions can be specified by using more than one --hubs argument. """ helps['network manager connect-config delete'] = """ diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 4cef2670351..2fc848febfa 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -151,12 +151,12 @@ def load_arguments(self, _): c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.') c.argument('display_name', type=str, help='A friendly name for the resource.') c.argument('description', type=str, help='A description of the connectivity configuration.') - c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']), + c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpoke', 'Mesh']), help='Connectivity topology type.') - c.argument('hub_id', type=str, help='The hub vnet Id.') c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.') c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' 'for configuration') + c.argument('hubs', action=AddGroupMembers, nargs='+', help='The hub vnets.') c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current ' 'existing peerings.') @@ -169,10 +169,10 @@ def load_arguments(self, _): c.argument('description', type=str, help='A description of the connectivity configuration.') c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpokeTopology', 'MeshTopology']), help='Connectivity topology type.') - c.argument('hub_id', type=str, help='The hub vnet Id.') c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.') c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' 'for configuration') + c.argument('hubs', action=AddGroupMembers, nargs='+', help='The hub vnets.') c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current ' 'existing peerings.') c.ignore('connectivity_configuration') diff --git a/src/network-manager/azext_network_manager/action.py b/src/network-manager/azext_network_manager/action.py index e0c9776a16f..373564253bc 100644 --- a/src/network-manager/azext_network_manager/action.py +++ b/src/network-manager/azext_network_manager/action.py @@ -91,9 +91,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use v = properties[k] if kl == 'resource-id': d['resource_id'] = v[0] + elif kl == 'resource-type': + d['resource_type'] = v[0] else: raise CLIError('Unsupported Key {} is provided for parameter group_members. All possible keys are: ' - 'resource-id'.format(k)) + 'resource-id, resource-type'.format(k)) return d diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 9afbd3319db..0c3dda7344b 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -245,7 +245,7 @@ def network_manager_connect_config_create(client, display_name=None, description=None, connectivity_topology=None, - hub_id=None, + hubs=None, is_global=None, applies_to_groups=None, delete_existing_peering=None): @@ -253,7 +253,7 @@ def network_manager_connect_config_create(client, connectivity_configuration['display_name'] = display_name connectivity_configuration['description'] = description connectivity_configuration['connectivity_topology'] = connectivity_topology - connectivity_configuration['hub_id'] = hub_id + connectivity_configuration['hubs'] = hubs connectivity_configuration['is_global'] = is_global connectivity_configuration['applies_to_groups'] = applies_to_groups connectivity_configuration['delete_existing_peering'] = delete_existing_peering @@ -270,7 +270,7 @@ def network_manager_connect_config_update(instance, display_name=None, description=None, connectivity_topology=None, - hub_id=None, + hubs=None, is_global=None, applies_to_groups=None, delete_existing_peering=None): @@ -280,8 +280,8 @@ def network_manager_connect_config_update(instance, instance.description = description if connectivity_topology is not None: instance.connectivity_topology = connectivity_topology - if hub_id is not None: - instance.hub_id = hub_id + if hubs is not None: + instance.hubs = hubs if is_global is not None: instance.is_global = is_global if applies_to_groups is not None: diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml new file mode 100644 index 00000000000..d7a6cc8e322 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml @@ -0,0 +1,424 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityUser", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"2cb0de67-6b4f-4070-bd7e-4cf9da852c04"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-09T03:22:26.7630658Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-09T03:22:26.7630658Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '923' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:34 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '391' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"9b0955ac-378f-4477-9b2b-bc3be34336bf"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-09T03:22:35.954563Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-09T03:22:35.954563Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1007' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:38 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "Sample Configuration", "connectivityTopology": + "HubAndSpoke", "hubs": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002", + "resourceType": "Microsoft.Network/virtualNetworks"}], "isGlobal": "True", "appliesToGroups": + [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup", + "useHubGateway": "true", "isGlobal": "false", "groupConnectivity": "None"}], + "deleteExistingPeering": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connect-config create + Connection: + - keep-alive + Content-Length: + - '797' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g --applies-to-groups --connectivity-topology + --delete-existing-peering --hubs --description --is-global + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"ef7e58c8-b399-4b0f-9cd6-3c9be0411564"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-09T03:22:39.7372376Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-09T03:22:39.7372376Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1485' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:40 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connect-config show + Connection: + - keep-alive + ParameterSetName: + - --configuration-name --network-manager-name -g + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"0c005561-0000-3400-0000-61610b010000\"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"ef7e58c8-b399-4b0f-9cd6-3c9be0411564"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/09/2021 + 03:22:39","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/09/2021 + 03:22:39"}}' + headers: + cache-control: + - no-cache + content-length: + - '1507' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connect-config update + Connection: + - keep-alive + ParameterSetName: + - --configuration-name --network-manager-name -g + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"0c005561-0000-3400-0000-61610b010000\"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"ef7e58c8-b399-4b0f-9cd6-3c9be0411564"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/09/2021 + 03:22:39","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/09/2021 + 03:22:39"}}' + headers: + cache-control: + - no-cache + content-length: + - '1507' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "", "description": "Sample Configuration", + "connectivityTopology": "HubAndSpoke", "hubs": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002", + "resourceType": "Microsoft.Network/virtualNetworks"}], "isGlobal": "True", "appliesToGroups": + [{"networkGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup", + "useHubGateway": "True", "isGlobal": "False", "groupConnectivity": "None"}], + "deleteExistingPeering": "True"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connect-config update + Connection: + - keep-alive + Content-Length: + - '816' + Content-Type: + - application/json + ParameterSetName: + - --configuration-name --network-manager-name -g + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"ef7e58c8-b399-4b0f-9cd6-3c9be0411564"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/09/2021 + 03:22:39","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-09T03:22:47.9147238Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1476' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:48 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connect-config list + Connection: + - keep-alive + ParameterSetName: + - --network-manager-name -g + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations?api-version=2021-02-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"0c005661-0000-3400-0000-61610b090000\"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"ef7e58c8-b399-4b0f-9cd6-3c9be0411564"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"10/09/2021 + 03:22:39","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"10/09/2021 + 03:22:47"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1533' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 09 Oct 2021 03:22:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connect-config delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --configuration-name --network-manager-name -g --yes + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sat, 09 Oct 2021 03:22:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 6b079944d92..27de35455c4 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -319,12 +319,38 @@ def test_network_manager_vnet_security_perimeter_crud(self, virtual_network, res # manager perimeter-associable-resource-types list pass - - @unittest.skip('TODO') @ResourceGroupPreparer(name_prefix='test_network_manager_connect_config_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_connect_config_crud(self, virtual_network, resource_group): - pass + self.kwargs.update({ + 'config_name': 'myTestSecurityConfig', + 'manager_name': 'TestNetworkManager', + 'group_name': 'TestNetworkGroup', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + + self.cmd('network manager connect-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' + '--applies-to-groups group-connectivity="None" network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name} ' + 'is-global=false use-hub-gateway=true --connectivity-topology "HubAndSpoke" --delete-existing-peering true --hubs ' + 'resource-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network} ' + 'resource-type="Microsoft.Network/virtualNetworks" --description "Sample Configuration" --is-global true') + self.cmd('network manager connect-config show --configuration-name {config_name} --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager connect-config update --configuration-name {config_name} --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager connect-config list --network-manager-name {manager_name} -g {rg}') + self.cmd('network manager connect-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') @unittest.skip('TODO') From 323f4f0d6f9960bd74b6e3c543037c183a352b81 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 11 Oct 2021 10:58:05 +0800 Subject: [PATCH 18/28] test other list options --- .../azext_network_manager/_client_factory.py | 8 - .../azext_network_manager/_params.py | 3 + .../azext_network_manager/commands.py | 36 +- .../azext_network_manager/custom.py | 28 +- .../test_network_manager_list_queries.yaml | 375 ++++++++++++++++++ .../tests/latest/test_network_scenario.py | 48 ++- 6 files changed, 416 insertions(+), 82 deletions(-) create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml diff --git a/src/network-manager/azext_network_manager/_client_factory.py b/src/network-manager/azext_network_manager/_client_factory.py index 11a93420d9e..f179932e2f6 100644 --- a/src/network-manager/azext_network_manager/_client_factory.py +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -67,14 +67,6 @@ def cf_networkmanager(cli_ctx, *_): return cf_network_cl(cli_ctx).network_managers -def cf_securityperimeter(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_security_perimeters - - -def cf_perimeterassociableresourcetype(cli_ctx, *_): - return cf_network_cl(cli_ctx).perimeter_associable_resource_types - - def cf_securityadminconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).security_admin_configurations diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 2fc848febfa..8667c855580 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -120,6 +120,9 @@ def load_arguments(self, _): 'include a skipToken parameter that specifies a starting point to use for subsequent calls.') c.argument('conditional_members', type=str, help='Conditional Members.') + with self.argument_context('network manager effective-config list') as c: + c.argument('virtual_network_name', type=str, help='The name of the virtual network.') + with self.argument_context('network manager active-config list') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 2866c1b42d8..7516ccbc10e 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -15,8 +15,7 @@ cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, cf_effectivevirtualnetwork, cf_activeconnectivityconfiguration, cf_connectivityconfiguration, cf_networkgroup, cf_userrule, cf_userrulecollection, cf_adminrule, cf_adminrulecollection, cf_securityadminconfiguration, cf_securityuserconfiguration, - cf_activesecurityadminrule, cf_activesecurityuserrule, cf_effectiveconnectivityconfiguration, cf_effectivesecurityadminrule, - cf_securityperimeter, cf_perimeterassociableresourcetype) + cf_activesecurityadminrule, cf_activesecurityuserrule, cf_effectiveconnectivityconfiguration, cf_effectivesecurityadminrule) def load_command_table(self, _): @@ -49,11 +48,6 @@ def load_command_table(self, _): client_factory=cf_effectiveconnectivityconfiguration ) - network_effectivesecurityadminrule = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_security_admin_rules_operations#EffectiveSecurityAdminRulesOperations.{}', - client_factory=cf_effectivesecurityadminrule - ) - network_activesecurityadminrule = CliCommandType( operations_tmpl='azext_network_manager.vendored_sdks.operations._active_security_admin_rules_operations#ActiveSecurityAdminRulesOperations.{}', client_factory=cf_activesecurityadminrule @@ -69,11 +63,6 @@ def load_command_table(self, _): client_factory=cf_connectivityconfiguration ) - # network_effectiveconfiguration = CliCommandType( - # operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_configurations_operations#EffectiveConfigurationsOperations.{}', - # client_factory=cf_effectiveconfiguration - # ) - network_networkgroup = CliCommandType( operations_tmpl='azext_network_manager.vendored_sdks.operations._network_groups_operations#NetworkGroupsOperations.{}', client_factory=cf_networkgroup @@ -109,16 +98,6 @@ def load_command_table(self, _): client_factory=cf_userrulecollection ) - network_securityperimeter = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._network_security_perimeters_operations#NetworkSecurityPerimetersOperations.{}', - client_factory=cf_securityperimeter - ) - - network_perimeterassociableresourcetype = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._perimeter_associable_resource_types_operations#PerimeterAssociableResourceTypesOperations.{}', - client_factory=cf_perimeterassociableresourcetype - ) - with self.command_group('network manager', network_networkmanager, client_factory=cf_networkmanager) as g: g.custom_command('create', 'network_manager_create') g.custom_command('list', 'network_manager_list') @@ -148,19 +127,6 @@ def load_command_table(self, _): with self.command_group('network manager active-security-user-rule', network_activesecurityuserrule, client_factory=cf_activesecurityuserrule) as g: g.custom_command('list', 'network_manager_active_security_user_rule_list') - with self.command_group('network manager effective-security-admin-rule', network_effectivesecurityadminrule, client_factory=cf_effectivesecurityadminrule) as g: - g.custom_command('list', 'network_manager_effective_security_admin_rule_list') - - with self.command_group('network manager vnet-security-perimeter', network_securityperimeter, client_factory=cf_securityperimeter) as g: - g.custom_command('list', 'network_manager_vnet_security_perimeter_list') - g.custom_show_command('show', 'network_manager_vnet_security_perimeter_show') - g.custom_command('create', 'network_manager_vnet_security_perimeter_create') - g.generic_update_command('update', custom_func_name='network_manager_vnet_security_perimeter_update') - g.custom_command('delete', 'network_manager_vnet_security_perimeter_delete', confirmation=True) - - with self.command_group('network manager perimeter-associable-resource-types', network_perimeterassociableresourcetype, client_factory=cf_perimeterassociableresourcetype) as g: - g.custom_command('list', 'network_manager_perimeter_associable_resource_type_list') - with self.command_group('network manager connect-config', network_connectivityconfiguration, client_factory=cf_connectivityconfiguration) as g: g.custom_command('list', 'network_manager_connect_config_list') g.custom_show_command('show', 'network_manager_connect_config_show') diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 0c3dda7344b..d1e0e5d0ab3 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -102,7 +102,6 @@ def network_manager_commit_post(client, def network_manager_deploy_status_list(client, resource_group_name, network_manager_name, - top=None, skip_token=None, regions=None, deployment_types=None): @@ -112,8 +111,6 @@ def network_manager_deploy_status_list(client, parameters['skip_token'] = skip_token return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - top=top, - skip_token=skip_token, parameters=parameters) @@ -121,16 +118,13 @@ def network_manager_effect_vnet_list_by_network_group(client, resource_group_name, network_manager_name, network_group_name, - top=None, skip_token=None): parameters = {} parameters['skip_token'] = skip_token return client.list_by_network_group(resource_group_name=resource_group_name, network_manager_name=network_manager_name, network_group_name=network_group_name, - parameters=parameters, - top=top, - skip_token=skip_token) + parameters=parameters) def network_manager_effect_vnet_list_by_network_manager(client, @@ -152,7 +146,6 @@ def network_manager_effect_vnet_list_by_network_manager(client, def network_manager_active_config_list(client, resource_group_name, network_manager_name, - top=None, skip_token=None, region=None): parameters = {} @@ -160,25 +153,23 @@ def network_manager_active_config_list(client, parameters['region'] = region return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - parameters=parameters, - top=top) + parameters=parameters) def network_manager_effective_config_list(client, - resource_group_name, - network_manager_name, - skip_token=None): + resource_group_name, + virtual_network_name, + skip_token=None): parameters = {} parameters['skip_token'] = skip_token return client.list(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, + virtual_network_name=virtual_network_name, parameters=parameters) def network_manager_active_security_admin_rule_list(client, resource_group_name, network_manager_name, - top=None, skip_token=None, region=None): parameters = {} @@ -186,14 +177,12 @@ def network_manager_active_security_admin_rule_list(client, parameters['region'] = region return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - parameters=parameters, - top=top) + parameters=parameters) def network_manager_active_security_user_rule_list(client, resource_group_name, network_manager_name, - top=None, skip_token=None, region=None): parameters = {} @@ -201,8 +190,7 @@ def network_manager_active_security_user_rule_list(client, parameters['region'] = region return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - parameters=parameters, - top=top) + parameters=parameters) def network_manager_effective_security_user_rule_list(client, diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml new file mode 100644 index 00000000000..cbce57e4a67 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml @@ -0,0 +1,375 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityUser", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"bd67f380-af1e-4eb4-9798-2d52fa1d6dcc"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T02:43:08.6706867Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T02:43:08.6706867Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '923' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1194' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample + policy", "memberType": "VirtualNetwork", "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], + "conditionalMembership": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '391' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --conditional-membership --display-name + --member-type -g --group-members + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"39be2062-edc9-44ef-aad4-4affdb85ce84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T02:43:14.099211Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T02:43:14.099211Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1007' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:13 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1191' + status: + code: 200 + message: OK +- request: + body: '{"regions": ["eastus2euap"], "deploymentTypes": ["Connectivity"]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager deploy-status list + Connection: + - keep-alive + Content-Length: + - '65' + Content-Type: + - application/json + ParameterSetName: + - --network-manager-name --deployment-types --regions --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listDeploymentStatus?api-version=2021-02-01-preview + response: + body: + string: '{"skipToken":"","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '27' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1192' + status: + code: 200 + message: OK +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager effect-vnet list-by-network-group + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + ParameterSetName: + - --network-group-name --network-manager-name --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + response: + body: + string: '{"skipToken":"","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '27' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:19 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 200 + message: OK +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager active-config list + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + ParameterSetName: + - --network-manager-name --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveConnectivityConfigurations?api-version=2021-02-01-preview + response: + body: + string: '{"skipToken":"","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '27' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:21 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 200 + message: OK +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager effective-config list + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + ParameterSetName: + - --virtual-network-name -g + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveConnectivityConfigurations?api-version=2021-02-01-preview + response: + body: + string: '{"skipToken":"","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '27' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:22 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1191' + status: + code: 200 + message: OK +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager active-security-admin-rule list + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + ParameterSetName: + - --network-manager-name -g --region + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveSecurityAdminRules?api-version=2021-02-01-preview + response: + body: + string: '{"skipToken":"","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '27' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 11 Oct 2021 02:43:24 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 27de35455c4..0c7730a54b8 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -311,14 +311,6 @@ def test_network_manager_user_rule_collection_crud(self, virtual_network, resour self.cmd('network manager security-user-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --yes') - @unittest.skip('TODO') - @ResourceGroupPreparer(name_prefix='test_network_manager_vnet_security_perimeter_crud', location='eastus2euap') - @VirtualNetworkPreparer() - def test_network_manager_vnet_security_perimeter_crud(self, virtual_network, resource_group): - # TODO: need test other list commands: - # manager perimeter-associable-resource-types list - pass - @ResourceGroupPreparer(name_prefix='test_network_manager_connect_config_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_connect_config_crud(self, virtual_network, resource_group): @@ -353,17 +345,35 @@ def test_network_manager_connect_config_crud(self, virtual_network, resource_gro self.cmd('network manager connect-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') - @unittest.skip('TODO') @ResourceGroupPreparer(name_prefix='test_network_manager_list_queries', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_list_queries(self, virtual_network, resource_group): - # TODO: need test other list commands: - # manager deploy-status list - # manager effect-vent list-by-network-group - # manager effect-vent list-by-network-manager - # manager active-config list - # manager effective-config list - # manager active-security-admin-rule list - # manager active-security-user-rule list - # manager effective-security-admin-rule list - pass + + self.kwargs.update({ + 'manager_name': 'TestNetworkManager', + 'group_name': 'TestNetworkGroup', + 'description': '"A sample policy"', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' + '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + + self.cmd('network manager deploy-status list --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') + self.cmd('network manager effect-vnet list-by-network-group --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') + # Internal Server Error + # self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager active-config list --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager effective-config list --virtual-network-name {virtual_network} -g {rg}') + self.cmd('network manager active-security-admin-rule list --network-manager-name {manager_name} -g {rg} --region eastus2euap') + # Internal Server Error + # self.cmd('network manager active-security-user-rule list --network-manager-name {manager_name} -g {rg} --region eastus2euap') From 2b517d188ee248d5a6a6432dab414a8176ff615e Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 11 Oct 2021 11:37:57 +0800 Subject: [PATCH 19/28] fix --- .../azext_network_manager/_help.py | 10 +- .../azext_network_manager/_params.py | 1 - .../azext_network_manager/custom.py | 16 +- .../test_network_manager_list_queries.yaml | 158 +++++++++++------- .../tests/latest/test_network_scenario.py | 2 +- 5 files changed, 115 insertions(+), 72 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index d38bed83430..b44b4e61522 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -289,7 +289,7 @@ text: |- az network manager group create --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ --description "A sample group" --conditional-membership "" --display-name "My Network Group" --group-members \ -vnet-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" subnet-id="" \ +resource-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" \ --member-type "VirtualNetwork" --resource-group "rg1" """ @@ -434,7 +434,7 @@ text: |- az network manager admin-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ --rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ ---applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +--applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup """ helps['network manager admin-rule collection list'] = """ @@ -454,7 +454,7 @@ - name: Update security admin rule collection text: |- az network manager admin-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" """ helps['network manager admin-rule collection show'] = """ @@ -584,7 +584,7 @@ text: |- az network manager user-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ --rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ ---applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +--applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup """ helps['network manager user-rule collection list'] = """ @@ -604,7 +604,7 @@ - name: Update security user rule collection text: |- az network manager user-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" """ helps['network manager user-rule collection show'] = """ diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 8667c855580..bb294bd06cd 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -468,7 +468,6 @@ def load_arguments(self, _): id_part='child_name_1') c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.') - with self.argument_context('network manager user-rule') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index d1e0e5d0ab3..26508792fa6 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -194,10 +194,10 @@ def network_manager_active_security_user_rule_list(client, def network_manager_effective_security_user_rule_list(client, - resource_group_name, - network_manager_name, - top=None, - skip_token=None): + resource_group_name, + network_manager_name, + top=None, + skip_token=None): parameters = {} parameters['skip_token'] = skip_token return client.list(resource_group_name=resource_group_name, @@ -563,9 +563,9 @@ def network_manager_admin_rule_collection_delete(client, configuration_name, rule_collection_name): return client.delete(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - configuration_name=configuration_name, - rule_collection_name=rule_collection_name) + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name) def network_manager_admin_rule_create(client, @@ -774,7 +774,7 @@ def network_manager_user_rule_list(client, return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, configuration_name=configuration_name, - rule_collection_name=rule_collection_name, + rule_collection_name=rule_collection_name, top=top, skip_token=skip_token) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml index cbce57e4a67..5d046008b16 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml @@ -27,7 +27,7 @@ interactions: response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"bd67f380-af1e-4eb4-9798-2d52fa1d6dcc"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T02:43:08.6706867Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T02:43:08.6706867Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"1c6ce98c-0ced-481b-9c89-5ae0cbaf9220"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T03:18:01.8236046Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T03:18:01.8236046Z"}}' headers: cache-control: - no-cache @@ -36,7 +36,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 02:43:12 GMT + - Mon, 11 Oct 2021 03:18:08 GMT expires: - '-1' pragma: @@ -52,7 +52,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1194' + - '1199' status: code: 200 message: OK @@ -83,16 +83,16 @@ interactions: response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"39be2062-edc9-44ef-aad4-4affdb85ce84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T02:43:14.099211Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T02:43:14.099211Z"}}' + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"797d22a8-a95d-47df-8aa2-724b0f6d1485"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T03:18:09.9474252Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T03:18:09.9474252Z"}}' headers: cache-control: - no-cache content-length: - - '1007' + - '1009' content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 02:43:13 GMT + - Mon, 11 Oct 2021 03:18:13 GMT expires: - '-1' pragma: @@ -108,7 +108,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1191' + - '1199' status: code: 200 message: OK @@ -144,7 +144,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 02:43:16 GMT + - Mon, 11 Oct 2021 03:18:16 GMT expires: - '-1' pragma: @@ -160,7 +160,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1192' + - '1199' status: code: 200 message: OK @@ -187,16 +187,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/listEffectiveVirtualNetworks?api-version=2021-02-01-preview response: body: - string: '{"skipToken":"","value":[]}' + string: '{"skipToken":"","value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002","location":"eastus2euap","membershipType":"Dynamic"}]}' headers: cache-control: - no-cache content-length: - - '27' + - '299' content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 02:43:19 GMT + - Mon, 11 Oct 2021 03:18:20 GMT expires: - '-1' pragma: @@ -212,7 +212,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1199' status: code: 200 message: OK @@ -224,7 +224,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network manager active-config list + - network manager effect-vnet list-by-network-manager Connection: - keep-alive Content-Length: @@ -236,19 +236,19 @@ interactions: User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveConnectivityConfigurations?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview response: body: - string: '{"skipToken":"","value":[]}' + string: '' headers: cache-control: - no-cache + connection: + - close content-length: - - '27' - content-type: - - application/json; charset=utf-8 + - '0' date: - - Mon, 11 Oct 2021 02:43:21 GMT + - Mon, 11 Oct 2021 03:18:25 GMT expires: - '-1' pragma: @@ -257,17 +257,15 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding x-content-type-options: - nosniff + x-ms-failure-cause: + - service x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1199' status: - code: 200 - message: OK + code: 500 + message: Internal Server Error - request: body: '{}' headers: @@ -276,7 +274,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network manager effective-config list + - network manager effect-vnet list-by-network-manager Connection: - keep-alive Content-Length: @@ -284,23 +282,23 @@ interactions: Content-Type: - application/json ParameterSetName: - - --virtual-network-name -g + - --network-manager-name --resource-group User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveConnectivityConfigurations?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview response: body: - string: '{"skipToken":"","value":[]}' + string: '' headers: cache-control: - no-cache + connection: + - close content-length: - - '27' - content-type: - - application/json; charset=utf-8 + - '0' date: - - Mon, 11 Oct 2021 02:43:22 GMT + - Mon, 11 Oct 2021 03:18:27 GMT expires: - '-1' pragma: @@ -309,17 +307,15 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding x-content-type-options: - nosniff + x-ms-failure-cause: + - service x-ms-ratelimit-remaining-subscription-writes: - - '1191' + - '1199' status: - code: 200 - message: OK + code: 500 + message: Internal Server Error - request: body: '{}' headers: @@ -328,7 +324,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network manager active-security-admin-rule list + - network manager effect-vnet list-by-network-manager Connection: - keep-alive Content-Length: @@ -336,23 +332,23 @@ interactions: Content-Type: - application/json ParameterSetName: - - --network-manager-name -g --region + - --network-manager-name --resource-group User-Agent: - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveSecurityAdminRules?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview response: body: - string: '{"skipToken":"","value":[]}' + string: '' headers: cache-control: - no-cache + connection: + - close content-length: - - '27' - content-type: - - application/json; charset=utf-8 + - '0' date: - - Mon, 11 Oct 2021 02:43:24 GMT + - Mon, 11 Oct 2021 03:18:33 GMT expires: - '-1' pragma: @@ -361,15 +357,63 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding x-content-type-options: - nosniff + x-ms-failure-cause: + - service x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1199' status: - code: 200 - message: OK + code: 500 + message: Internal Server Error +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager effect-vnet list-by-network-manager + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + ParameterSetName: + - --network-manager-name --resource-group + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '0' + date: + - Mon, 11 Oct 2021 03:18:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 0c7730a54b8..081990af1cf 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -371,7 +371,7 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): self.cmd('network manager deploy-status list --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') self.cmd('network manager effect-vnet list-by-network-group --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') # Internal Server Error - # self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') self.cmd('network manager active-config list --network-manager-name {manager_name} --resource-group {rg}') self.cmd('network manager effective-config list --virtual-network-name {virtual_network} -g {rg}') self.cmd('network manager active-security-admin-rule list --network-manager-name {manager_name} -g {rg} --region eastus2euap') From 3e2701c7dbba2f7c3ff5456e40beaebcaca4792b Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 11 Oct 2021 15:53:56 +0800 Subject: [PATCH 20/28] fix --- .../azext_network_manager/_help.py | 91 +++++++--- .../azext_network_manager/_params.py | 51 ++++-- .../azext_network_manager/custom.py | 8 +- .../test_network_manager_list_queries.yaml | 160 +++++++----------- .../tests/latest/test_network_scenario.py | 26 +-- 5 files changed, 177 insertions(+), 159 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index b44b4e61522..93685610197 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -134,6 +134,52 @@ --conditional-members "location=\'useast2\'" --resource-group "rg1" """ +helps['network manager active-security-admin-rule'] = """ + type: group + short-summary: Manage active security admin rule +""" + +helps['network manager active-security-admin-rule list'] = """ + type: command + short-summary: "Lists active security admin rule in a network manager." + examples: + - name: Get Azure Virtual Network Manager Active Security Admin Rule + text: |- + az network manager active-security-admin-rule list --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup --region eastus2euap" +""" + +helps['network manager active-security-user-rule'] = """ + type: group + short-summary: Manage active security user rule +""" + +helps['network manager active-security-user-rule list'] = """ + type: command + short-summary: "Lists active security user rule in a network manager." + examples: + - name: Get Azure Virtual Network Manager Active Security User Rule + text: |- + az network manager active-security-user-rule list --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup --region eastus2euap" +""" + +helps['network manager effective-config'] = """ + type: group + short-summary: Manage effective configuration +""" + +helps['network manager effective-config list'] = """ + type: command + short-summary: "Lists effective configuration in a network manager." + examples: + - name: Get Azure Virtual Network Manager Effective Configuration + text: |- + az network manager effective-config list --virtual-network--name "myVirtualNetwork" --resource-group "myResourceGroup" +""" + + + helps['network manager active-config'] = """ type: group short-summary: Manage activeconfiguration with network @@ -289,7 +335,7 @@ text: |- az network manager group create --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ --description "A sample group" --conditional-membership "" --display-name "My Network Group" --group-members \ -resource-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" \ +vnet-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" subnet-id="" \ --member-type "VirtualNetwork" --resource-group "rg1" """ @@ -433,8 +479,8 @@ - name: Create security admin rule collections text: |- az network manager admin-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ ---rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ ---applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +--rule-collection-name "myTestCollection" --description "A sample description" --display-name "ASampleCollection" \ +--applies-to-groups network-group-id="sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup" """ helps['network manager admin-rule collection list'] = """ @@ -454,7 +500,7 @@ - name: Update security admin rule collection text: |- az network manager admin-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" """ helps['network manager admin-rule collection show'] = """ @@ -473,8 +519,8 @@ examples: - name: Delete an admin rule collection. text: |- - az network manager admin-rule collection delete --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection + az network manager admin-rule collection delete --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" \ +--resource-group "rg1" --rule-collection-name "myTestCollection" """ @@ -487,7 +533,7 @@ type: command short-summary: "Create a network manager security configuration admin rule." parameters: - - name: --source + - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | Usage: --source address-prefix=XX address-prefix-type=XX @@ -496,7 +542,7 @@ address-prefix-type: Address prefix type. Multiple actions can be specified by using more than one --source argument. - - name: --destination + - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | Usage: --destination address-prefix=XX address-prefix-type=XX @@ -508,8 +554,9 @@ examples: - name: Create security admin rules text: |- - az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" --kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound" + az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" \ +--resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" \ +--kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound" """ helps['network manager admin-rule list'] = """ @@ -526,7 +573,7 @@ type: command short-summary: "Update a network manager security configuration admin rule in a subscription." parameters: - - name: --source + - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | Usage: --source address-prefix=XX address-prefix-type=XX @@ -535,7 +582,7 @@ address-prefix-type: Address prefix type. Multiple actions can be specified by using more than one --source argument. - - name: --destination + - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | Usage: --destination address-prefix=XX address-prefix-type=XX @@ -584,7 +631,7 @@ text: |- az network manager user-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ --rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ ---applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +--applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup """ helps['network manager user-rule collection list'] = """ @@ -604,7 +651,7 @@ - name: Update security user rule collection text: |- az network manager user-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" """ helps['network manager user-rule collection show'] = """ @@ -624,7 +671,7 @@ - name: Delete an user rule collection. text: |- az network manager user-rule collection delete --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" """ helps['network manager user-rule'] = """ @@ -639,7 +686,7 @@ - name: List security user rules text: |- az network manager user-rule list --configuration-name "myTestConnectivityConfig" \ ---network-manager-name "testNetworkManager" --resource-group "rg1 --rule-collection-name "myTestCollection"" +--network-manager-name "testNetworkManager" --resource-group "rg1 --rule-collection-name "myTestCollection" """ helps['network manager user-rule show'] = """ @@ -649,14 +696,14 @@ - name: Gets a user rule text: |- az network manager user-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule --rule-collection-name "myTestCollection"" +"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule --rule-collection-name "myTestCollection" """ helps['network manager user-rule create'] = """ type: command short-summary: "Create a user rule." parameters: - - name: --source + - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | Usage: --source address-prefix=XX address-prefix-type=XX @@ -665,7 +712,7 @@ address-prefix-type: Address prefix type. Multiple actions can be specified by using more than one --source argument. - - name: --destination + - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | Usage: --destination address-prefix=XX address-prefix-type=XX @@ -679,7 +726,7 @@ text: |- az network manager user-rule create --configuration-name "myTestSecurityConfig" --network-manager-name \ "testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleUserRule" --description "Sample User Rule" \ ---destination address-prefix="*" address-prefix-type="IPPrefix" --destination-port-ranges "22" --direction "Inbound" \ +--destinations address-prefix="*" address-prefix-type="IPPrefix" --destination-port-ranges "22" --direction "Inbound" \ --source address-prefix="*" address-prefix-type="IPPrefix" --source-port-ranges "0-65535" --protocol "Tcp" """ @@ -687,7 +734,7 @@ type: command short-summary: "Update a user rule." parameters: - - name: --source + - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | Usage: --source address-prefix=XX address-prefix-type=XX @@ -696,7 +743,7 @@ address-prefix-type: Address prefix type. Multiple actions can be specified by using more than one --source argument. - - name: --destination + - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | Usage: --destination address-prefix=XX address-prefix-type=XX diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index bb294bd06cd..424cd69fe52 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -58,7 +58,7 @@ def load_arguments(self, _): c.argument('description', type=str, help='A description of the network manager.') c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network ' 'Manager.') - c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access. Available value: SecurityAdmin, ' + c.argument('network_manager_scope_accesses', options_list=['--scope-accesses'], nargs='+', help='Scope Access. Available value: SecurityAdmin, ' 'SecurityUser, Connectivity.') with self.argument_context('network manager update') as c: @@ -71,7 +71,7 @@ def load_arguments(self, _): c.argument('description', type=str, help='A description of the network manager.') c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network ' 'Manager.') - c.argument('network_manager_scope_accesses', nargs='+', help='Scope Access. Available value: SecurityAdmin, ' + c.argument('network_manager_scope_accesses', options_list=['--scope-accesses'], nargs='+', help='Scope Access. Available value: SecurityAdmin, ' 'SecurityUser, Connectivity.') c.ignore('parameters') @@ -91,7 +91,7 @@ def load_arguments(self, _): with self.argument_context('network manager deploy-status list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -121,11 +121,25 @@ def load_arguments(self, _): c.argument('conditional_members', type=str, help='Conditional Members.') with self.argument_context('network manager effective-config list') as c: - c.argument('virtual_network_name', type=str, help='The name of the virtual network.') + c.argument('virtual_network_name', type=str, help='The name of the virtual network.', id_part=None) + + with self.argument_context('network manager active-security-admin-rule list') as c: + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) + c.argument('skip_token', type=str, 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.') + c.argument('regions', nargs='+', help='List of locations.') + + with self.argument_context('network manager active-security-user-rule list') as c: + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) + c.argument('skip_token', type=str, 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.') + c.argument('regions', nargs='+', help='List of locations.') with self.argument_context('network manager active-config list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -135,7 +149,7 @@ def load_arguments(self, _): with self.argument_context('network manager connect-config list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -160,7 +174,7 @@ def load_arguments(self, _): c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' 'for configuration') c.argument('hubs', action=AddGroupMembers, nargs='+', help='The hub vnets.') - c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current ' + c.argument('delete_existing_peering', options_list=['--delete-peering'], arg_type=get_three_state_flag(), help='Flag if need to remove current ' 'existing peerings.') with self.argument_context('network manager connect-config update') as c: @@ -176,7 +190,7 @@ def load_arguments(self, _): c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups ' 'for configuration') c.argument('hubs', action=AddGroupMembers, nargs='+', help='The hub vnets.') - c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current ' + c.argument('delete_existing_peering', options_list=['--delete-peering'], arg_type=get_three_state_flag(), help='Flag if need to remove current ' 'existing peerings.') c.ignore('connectivity_configuration') @@ -188,7 +202,7 @@ def load_arguments(self, _): with self.argument_context('network manager group list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.') + c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -238,7 +252,7 @@ def load_arguments(self, _): with self.argument_context('network manager security-user-config list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -281,7 +295,7 @@ def load_arguments(self, _): with self.argument_context('network manager admin-rule list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') @@ -291,7 +305,7 @@ def load_arguments(self, _): with self.argument_context('network manager security-admin-config list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -356,7 +370,7 @@ def load_arguments(self, _): with self.argument_context('network manager admin-rule collection list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' @@ -400,7 +414,7 @@ def load_arguments(self, _): c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' 'protocol this rule applies to.') c.argument('source_port_ranges', nargs='+', help='The source port ranges.') - c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('destination_port_ranges', options_list=['--dest-port-ranges'], nargs='+', help='The destination port ranges.') c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') @@ -417,7 +431,7 @@ def load_arguments(self, _): c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network ' 'protocol this rule applies to.') c.argument('source_port_ranges', nargs='+', help='The source port ranges.') - c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('destination_port_ranges', options_list=['--dest-port-ranges'], nargs='+', help='The destination port ranges.') c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') @@ -445,7 +459,7 @@ def load_arguments(self, _): with self.argument_context('network manager user-rule collection list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' @@ -476,6 +490,7 @@ def load_arguments(self, _): c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2') with self.argument_context('network manager user-rule list') as c: + c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' 'be returned by the server.') c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' @@ -491,7 +506,7 @@ def load_arguments(self, _): c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' 'destination IP ranges.') c.argument('source_port_ranges', nargs='+', help='The source port ranges.') - c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('destination_port_ranges', options_list=['--dest-port-ranges'], nargs='+', help='The destination port ranges.') c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') c.argument('flag', type=str, help='Default rule flag.') @@ -506,7 +521,7 @@ def load_arguments(self, _): c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or ' 'destination IP ranges.') c.argument('source_port_ranges', nargs='+', help='The source port ranges.') - c.argument('destination_port_ranges', nargs='+', help='The destination port ranges.') + c.argument('destination_port_ranges', options_list=['--dest-port-ranges'], nargs='+', help='The destination port ranges.') c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic ' 'matched against the rule in inbound or outbound.') c.argument('flag', type=str, help='Default rule flag.') diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 26508792fa6..576fc3a2d23 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -171,10 +171,10 @@ def network_manager_active_security_admin_rule_list(client, resource_group_name, network_manager_name, skip_token=None, - region=None): + regions=None): parameters = {} parameters['skip_token'] = skip_token - parameters['region'] = region + parameters['region'] = regions return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, parameters=parameters) @@ -184,10 +184,10 @@ def network_manager_active_security_user_rule_list(client, resource_group_name, network_manager_name, skip_token=None, - region=None): + regions=None): parameters = {} parameters['skip_token'] = skip_token - parameters['region'] = region + parameters['regions'] = regions return client.list(resource_group_name=resource_group_name, network_manager_name=network_manager_name, parameters=parameters) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml index 5d046008b16..71bfb255a63 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml @@ -18,16 +18,16 @@ interactions: Content-Type: - application/json ParameterSetName: - - --name --description --display-name --network-manager-scope-accesses --network-manager-scopes + - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"1c6ce98c-0ced-481b-9c89-5ae0cbaf9220"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T03:18:01.8236046Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T03:18:01.8236046Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"8a7df201-02b3-410a-a25b-c068ff94ec3f"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T07:52:53.3638375Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T07:52:53.3638375Z"}}' headers: cache-control: - no-cache @@ -36,7 +36,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:08 GMT + - Mon, 11 Oct 2021 07:52:58 GMT expires: - '-1' pragma: @@ -52,7 +52,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK @@ -77,13 +77,13 @@ interactions: - --name --network-manager-name --description --conditional-membership --display-name --member-type -g --group-members User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"797d22a8-a95d-47df-8aa2-724b0f6d1485"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T03:18:09.9474252Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T03:18:09.9474252Z"}}' + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"51e7d804-5223-4bb4-b208-f9f80748bd03"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T07:52:59.7792546Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T07:52:59.7792546Z"}}' headers: cache-control: - no-cache @@ -92,7 +92,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:13 GMT + - Mon, 11 Oct 2021 07:53:02 GMT expires: - '-1' pragma: @@ -108,7 +108,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1196' status: code: 200 message: OK @@ -130,7 +130,7 @@ interactions: ParameterSetName: - --network-manager-name --deployment-types --regions --resource-group User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listDeploymentStatus?api-version=2021-02-01-preview response: @@ -144,7 +144,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:16 GMT + - Mon, 11 Oct 2021 07:53:06 GMT expires: - '-1' pragma: @@ -182,7 +182,7 @@ interactions: ParameterSetName: - --network-group-name --network-manager-name --resource-group User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/listEffectiveVirtualNetworks?api-version=2021-02-01-preview response: @@ -196,7 +196,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:20 GMT + - Mon, 11 Oct 2021 07:53:08 GMT expires: - '-1' pragma: @@ -224,7 +224,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network manager effect-vnet list-by-network-manager + - network manager active-config list Connection: - keep-alive Content-Length: @@ -234,71 +234,21 @@ interactions: ParameterSetName: - --network-manager-name --resource-group User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveConnectivityConfigurations?api-version=2021-02-01-preview response: body: - string: '' - headers: - cache-control: - - no-cache - connection: - - close - content-length: - - '0' - date: - - Mon, 11 Oct 2021 03:18:25 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-failure-cause: - - service - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 500 - message: Internal Server Error -- request: - body: '{}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - network manager effect-vnet list-by-network-manager - Connection: - - keep-alive - Content-Length: - - '2' - Content-Type: - - application/json - ParameterSetName: - - --network-manager-name --resource-group - User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview - response: - body: - string: '' + string: '{"skipToken":"","value":[]}' headers: cache-control: - no-cache - connection: - - close content-length: - - '0' + - '27' + content-type: + - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:27 GMT + - Mon, 11 Oct 2021 07:53:09 GMT expires: - '-1' pragma: @@ -307,15 +257,17 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-failure-cause: - - service x-ms-ratelimit-remaining-subscription-writes: - '1199' status: - code: 500 - message: Internal Server Error + code: 200 + message: OK - request: body: '{}' headers: @@ -324,7 +276,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network manager effect-vnet list-by-network-manager + - network manager effective-config list Connection: - keep-alive Content-Length: @@ -332,23 +284,23 @@ interactions: Content-Type: - application/json ParameterSetName: - - --network-manager-name --resource-group + - --virtual-network-name -g User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveConnectivityConfigurations?api-version=2021-02-01-preview response: body: - string: '' + string: '{"skipToken":"","value":[]}' headers: cache-control: - no-cache - connection: - - close content-length: - - '0' + - '27' + content-type: + - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:33 GMT + - Mon, 11 Oct 2021 07:53:13 GMT expires: - '-1' pragma: @@ -357,15 +309,17 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-failure-cause: - - service x-ms-ratelimit-remaining-subscription-writes: - '1199' status: - code: 500 - message: Internal Server Error + code: 200 + message: OK - request: body: '{}' headers: @@ -374,7 +328,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network manager effect-vnet list-by-network-manager + - network manager active-security-admin-rule list Connection: - keep-alive Content-Length: @@ -382,23 +336,23 @@ interactions: Content-Type: - application/json ParameterSetName: - - --network-manager-name --resource-group + - --network-manager-name -g --regions User-Agent: - - AZURECLI/2.28.1 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveSecurityAdminRules?api-version=2021-02-01-preview response: body: - string: '' + string: '{"skipToken":"","value":[]}' headers: cache-control: - no-cache - connection: - - close content-length: - - '0' + - '27' + content-type: + - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 03:18:39 GMT + - Mon, 11 Oct 2021 07:53:16 GMT expires: - '-1' pragma: @@ -407,13 +361,15 @@ interactions: - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-failure-cause: - - service x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: - code: 500 - message: Internal Server Error + code: 200 + message: OK version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 081990af1cf..c10135f2f12 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -37,7 +37,7 @@ def test_network_manager_crud(self, resource_group): }) self.cmd('network manager create --name {name} --description {description} --display-name {display_name} ' - '--network-manager-scope-accesses "Routing" "Connectivity" ' + '--scope-accesses "Routing" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -67,7 +67,7 @@ def test_network_manager_group_crud(self, virtual_network, resource_group): }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "Routing" "Connectivity" ' + '--scope-accesses "Routing" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -93,7 +93,7 @@ def test_network_manager_security_user_config_crud(self, resource_group): }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--scope-accesses "SecurityUser" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -119,7 +119,7 @@ def test_network_manager_security_admin_config_crud(self, resource_group): }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' + '--scope-accesses "SecurityAdmin" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -160,7 +160,7 @@ def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' + '--scope-accesses "SecurityAdmin" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -202,7 +202,7 @@ def test_network_manager_admin_rule_collection_crud(self, virtual_network, resou }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityAdmin" "Connectivity" ' + '--scope-accesses "SecurityAdmin" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -246,7 +246,7 @@ def test_network_manager_user_rule_crud(self, virtual_network, resource_group): }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--scope-accesses "SecurityUser" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -286,7 +286,7 @@ def test_network_manager_user_rule_collection_crud(self, virtual_network, resour }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--scope-accesses "SecurityUser" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -324,7 +324,7 @@ def test_network_manager_connect_config_crud(self, virtual_network, resource_gro }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--scope-accesses "SecurityUser" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -336,7 +336,7 @@ def test_network_manager_connect_config_crud(self, virtual_network, resource_gro self.cmd('network manager connect-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--applies-to-groups group-connectivity="None" network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name} ' - 'is-global=false use-hub-gateway=true --connectivity-topology "HubAndSpoke" --delete-existing-peering true --hubs ' + 'is-global=false use-hub-gateway=true --connectivity-topology "HubAndSpoke" --delete-peering true --hubs ' 'resource-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network} ' 'resource-type="Microsoft.Network/virtualNetworks" --description "Sample Configuration" --is-global true') self.cmd('network manager connect-config show --configuration-name {config_name} --network-manager-name {manager_name} -g {rg}') @@ -358,7 +358,7 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' - '--network-manager-scope-accesses "SecurityUser" "Connectivity" ' + '--scope-accesses "SecurityUser" "Connectivity" ' '--network-manager-scopes ' ' subscriptions={sub} ' '-l eastus2euap ' @@ -371,9 +371,9 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): self.cmd('network manager deploy-status list --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') self.cmd('network manager effect-vnet list-by-network-group --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') # Internal Server Error - self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') + # self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') self.cmd('network manager active-config list --network-manager-name {manager_name} --resource-group {rg}') self.cmd('network manager effective-config list --virtual-network-name {virtual_network} -g {rg}') - self.cmd('network manager active-security-admin-rule list --network-manager-name {manager_name} -g {rg} --region eastus2euap') + self.cmd('network manager active-security-admin-rule list --network-manager-name {manager_name} -g {rg} --regions eastus2euap') # Internal Server Error # self.cmd('network manager active-security-user-rule list --network-manager-name {manager_name} -g {rg} --region eastus2euap') From e1935e8c60b0f1350aef022f1e2606b67a3b9e4a Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 11 Oct 2021 16:24:21 +0800 Subject: [PATCH 21/28] fix --- src/network-manager/azext_network_manager/_help.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 93685610197..8316a461c18 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -166,7 +166,7 @@ helps['network manager effective-config'] = """ type: group - short-summary: Manage effective configuration + short-summary: Manage effective configuration """ helps['network manager effective-config list'] = """ @@ -178,8 +178,6 @@ az network manager effective-config list --virtual-network--name "myVirtualNetwork" --resource-group "myResourceGroup" """ - - helps['network manager active-config'] = """ type: group short-summary: Manage activeconfiguration with network @@ -480,7 +478,7 @@ text: |- az network manager admin-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ --rule-collection-name "myTestCollection" --description "A sample description" --display-name "ASampleCollection" \ ---applies-to-groups network-group-id="sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup" +--applies-to-groups network-group-id="sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup" """ helps['network manager admin-rule collection list'] = """ @@ -500,7 +498,7 @@ - name: Update security admin rule collection text: |- az network manager admin-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" """ helps['network manager admin-rule collection show'] = """ @@ -631,7 +629,7 @@ text: |- az network manager user-rule collection create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" -g "rg1" \ --rule-collection-name myTestCollection --description "A sample description" --display-name "ASampleCollection" \ ---applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup +--applies-to-groups network-group-id=sub_id/resourceGroups/rgid/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup """ helps['network manager user-rule collection list'] = """ @@ -651,7 +649,7 @@ - name: Update security user rule collection text: |- az network manager user-rule collection update --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --display-name "ASampleCollection2" """ helps['network manager user-rule collection show'] = """ From f580a67d58ec5d73e539d097de09f45631c77144 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Mon, 11 Oct 2021 17:52:00 +0800 Subject: [PATCH 22/28] fix --- .github/CODEOWNERS | 2 ++ src/network-manager/azext_network_manager/_help.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 56c4e000173..b1a3a29b3d6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -58,6 +58,8 @@ /src/netappfiles-preview/ @b-lefr +/src/network-manager/ @kairu-ms @jsntcy + /src/healthcareapis/ @fengzhou-msft @iviark /src/healthbot/ @guy-microsoft diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 8316a461c18..a1f98612946 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -333,7 +333,7 @@ text: |- az network manager group create --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ --description "A sample group" --conditional-membership "" --display-name "My Network Group" --group-members \ -vnet-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" subnet-id="" \ +resource-id="/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1" \ --member-type "VirtualNetwork" --resource-group "rg1" """ From 58ae05334deb85eb8617348f852c6dd7bb1fa2e9 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Tue, 12 Oct 2021 10:30:33 +0800 Subject: [PATCH 23/28] fix --- .../azext_network_manager/_help.py | 32 +++++++++---------- .../azext_network_manager/_params.py | 3 ++ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index a1f98612946..63418f27269 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -50,7 +50,7 @@ - name: Create/Update Azure Virtual Network Manager text: |- az network manager create --name "TestNetworkManager" --description "My Test Network Manager" \ ---display-name "TestNetworkManager" --network-manager-scope-accesses "Security" "Routing" "Connectivity" \ +--display-name "TestNetworkManager" --scope-accesses "Security" "Routing" "Connectivity" \ --network-manager-scopes management-groups="/Microsoft.Management/testmg" subscriptions="/subscriptions/00000000-0000-0\ 000-0000-000000000000" --resource-group "rg1" """ @@ -175,7 +175,7 @@ examples: - name: Get Azure Virtual Network Manager Effective Configuration text: |- - az network manager effective-config list --virtual-network--name "myVirtualNetwork" --resource-group "myResourceGroup" + az network manager effective-config list --virtual-network-name "myVirtualNetwork" --resource-group "myResourceGroup" """ helps['network manager active-config'] = """ @@ -250,7 +250,7 @@ "Sample Configuration" --applies-to-groups group-connectivity="None" is-global=false \ network-group-id="subscriptions/subscriptionA/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManager\ s/testNetworkManager/networkManagerGroups/group1" use-hub-gateway=true --connectivity-topology "HubAndSpoke" \ ---delete-existing-peering true --display-name "myTestConnectivityConfig" --hubs resource-id="subscriptions/subscriptionA/resource\ +--delete-peering true --display-name "myTestConnectivityConfig" --hubs resource-id="subscriptions/subscriptionA/resource\ Groups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig" resource-type="Microsoft.Network/virtualNetworks" \ --is-global true --network-manager-name "testNetworkManager" --resource-group "myResourceGroup" """ @@ -534,12 +534,12 @@ - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | - Usage: --source address-prefix=XX address-prefix-type=XX + Usage: --sources address-prefix=XX address-prefix-type=XX address-prefix: Address prefix. address-prefix-type: Address prefix type. - Multiple actions can be specified by using more than one --source argument. + Multiple actions can be specified by using more than one --sources argument. - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | @@ -552,7 +552,7 @@ examples: - name: Create security admin rules text: |- - az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" \ + az network manager admin-rule create --configuration-name "myTestSecurityConfig" --network-manager-name "testNetworkManager" \ --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleAdminRule" \ --kind "Custom" --protocol "Tcp" --access "Allow" --priority 32 --direction "Inbound" """ @@ -574,12 +574,12 @@ - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | - Usage: --source address-prefix=XX address-prefix-type=XX + Usage: --sources address-prefix=XX address-prefix-type=XX address-prefix: Address prefix. address-prefix-type: Address prefix type. - Multiple actions can be specified by using more than one --source argument. + Multiple actions can be specified by using more than one --sources argument. - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | @@ -684,7 +684,7 @@ - name: List security user rules text: |- az network manager user-rule list --configuration-name "myTestConnectivityConfig" \ ---network-manager-name "testNetworkManager" --resource-group "rg1 --rule-collection-name "myTestCollection" +--network-manager-name "testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" """ helps['network manager user-rule show'] = """ @@ -694,7 +694,7 @@ - name: Gets a user rule text: |- az network manager user-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ -"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule --rule-collection-name "myTestCollection" +"testNetworkManager" --resource-group "rg1" --rule-name "SampleUserRule" --rule-collection-name "myTestCollection" """ helps['network manager user-rule create'] = """ @@ -704,12 +704,12 @@ - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | - Usage: --source address-prefix=XX address-prefix-type=XX + Usage: --sources address-prefix=XX address-prefix-type=XX address-prefix: Address prefix. address-prefix-type: Address prefix type. - Multiple actions can be specified by using more than one --source argument. + Multiple actions can be specified by using more than one --sources argument. - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | @@ -724,8 +724,8 @@ text: |- az network manager user-rule create --configuration-name "myTestSecurityConfig" --network-manager-name \ "testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleUserRule" --description "Sample User Rule" \ ---destinations address-prefix="*" address-prefix-type="IPPrefix" --destination-port-ranges "22" --direction "Inbound" \ ---source address-prefix="*" address-prefix-type="IPPrefix" --source-port-ranges "0-65535" --protocol "Tcp" +--destinations address-prefix="*" address-prefix-type="IPPrefix" --dest-port-ranges 22 --direction "Inbound" \ +--sources address-prefix="*" address-prefix-type="IPPrefix" --source-port-ranges "0-65535" --protocol "Tcp" """ helps['network manager user-rule update'] = """ @@ -735,12 +735,12 @@ - name: --sources short-summary: "The CIDR or source IP ranges." long-summary: | - Usage: --source address-prefix=XX address-prefix-type=XX + Usage: --sources address-prefix=XX address-prefix-type=XX address-prefix: Address prefix. address-prefix-type: Address prefix type. - Multiple actions can be specified by using more than one --source argument. + Multiple actions can be specified by using more than one --sources argument. - name: --destinations short-summary: "The destination address prefixes. CIDR or destination IP ranges." long-summary: | diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 424cd69fe52..a0b2792d1de 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -122,6 +122,9 @@ def load_arguments(self, _): with self.argument_context('network manager effective-config list') as c: c.argument('virtual_network_name', type=str, help='The name of the virtual network.', id_part=None) + c.argument('skip_token', type=str, 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('network manager active-security-admin-rule list') as c: c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) From ed48b4b6b0ddc4c7f4f9f08c7f52ad73b3ed7f1c Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Wed, 13 Oct 2021 12:16:28 +0800 Subject: [PATCH 24/28] enable test for effect-vent list-by-network-manager --- .../test_network_manager_list_queries.yaml | 80 +++++++++++++++---- .../tests/latest/test_network_scenario.py | 2 +- 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml index 71bfb255a63..786d9cf92c4 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml @@ -27,7 +27,7 @@ interactions: response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"8a7df201-02b3-410a-a25b-c068ff94ec3f"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T07:52:53.3638375Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T07:52:53.3638375Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SEcurityUser","Connectivity"],"resourceGuid":"a62237ed-429c-433b-8eaf-adddac3c709c"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-13T03:16:52.4715833Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-13T03:16:52.4715833Z"}}' headers: cache-control: - no-cache @@ -36,7 +36,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:52:58 GMT + - Wed, 13 Oct 2021 03:17:00 GMT expires: - '-1' pragma: @@ -52,7 +52,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1198' status: code: 200 message: OK @@ -83,16 +83,16 @@ interactions: response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"51e7d804-5223-4bb4-b208-f9f80748bd03"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-11T07:52:59.7792546Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-11T07:52:59.7792546Z"}}' + sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"2e8037ca-44a6-4911-85cd-da8ddb162620"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-10-13T03:17:01.781487Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-13T03:17:01.781487Z"}}' headers: cache-control: - no-cache content-length: - - '1009' + - '1007' content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:53:02 GMT + - Wed, 13 Oct 2021 03:17:04 GMT expires: - '-1' pragma: @@ -108,7 +108,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1199' status: code: 200 message: OK @@ -144,7 +144,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:53:06 GMT + - Wed, 13 Oct 2021 03:17:08 GMT expires: - '-1' pragma: @@ -196,7 +196,59 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:53:08 GMT + - Wed, 13 Oct 2021 03:17:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager effect-vnet list-by-network-manager + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + ParameterSetName: + - --network-manager-name --resource-group + User-Agent: + - AZURECLI/2.29.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + response: + body: + string: '{"skipToken":"","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '27' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 03:17:14 GMT expires: - '-1' pragma: @@ -248,7 +300,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:53:09 GMT + - Wed, 13 Oct 2021 03:17:16 GMT expires: - '-1' pragma: @@ -300,7 +352,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:53:13 GMT + - Wed, 13 Oct 2021 03:17:19 GMT expires: - '-1' pragma: @@ -316,7 +368,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK @@ -352,7 +404,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 11 Oct 2021 07:53:16 GMT + - Wed, 13 Oct 2021 03:17:21 GMT expires: - '-1' pragma: @@ -368,7 +420,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1199' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index c10135f2f12..5de822d6bbb 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -371,7 +371,7 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): self.cmd('network manager deploy-status list --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') self.cmd('network manager effect-vnet list-by-network-group --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') # Internal Server Error - # self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') self.cmd('network manager active-config list --network-manager-name {manager_name} --resource-group {rg}') self.cmd('network manager effective-config list --virtual-network-name {virtual_network} -g {rg}') self.cmd('network manager active-security-admin-rule list --network-manager-name {manager_name} -g {rg} --regions eastus2euap') From e853d8f7326457e79f9b8b34140f32ee5344f991 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 14 Oct 2021 15:51:30 +0800 Subject: [PATCH 25/28] change operation names --- .../azext_network_manager/_help.py | 103 ++++++------------ .../azext_network_manager/_params.py | 16 +-- .../azext_network_manager/commands.py | 30 ++--- .../azext_network_manager/custom.py | 42 +++++-- .../tests/latest/test_network_scenario.py | 18 +-- 5 files changed, 93 insertions(+), 116 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 63418f27269..523704a28e3 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -77,122 +77,77 @@ az network manager delete --name "testNetworkManager" --resource-group "rg1" """ -helps['network manager commit'] = """ - type: group - short-summary: Manage networkmanagercommit with network -""" - -helps['network manager commit post'] = """ +helps['network manager post-commit'] = """ type: command short-summary: "Post a Network Manager Commit." examples: - name: Post Azure Virtual Network Manager Commit text: |- - az network manager commit post --network-manager-name "testNetworkManager" --commit-type "SecurityAdmin" \ + az network manager post-commit --network-manager-name "testNetworkManager" --commit-type "SecurityAdmin" \ --configuration-ids "/subscriptions/subscriptionC/resourceGroups/resoureGroupSample/providers/Microsoft.Network/network\ Managers/testNetworkManager/securityConfigurations/SampleSecurityConfig" --target-locations "eastus" --resource-group \ "resoureGroupSample" """ -helps['network manager deploy-status'] = """ - type: group - short-summary: Manage networkmanagerdeploymentstatus with network -""" - -helps['network manager deploy-status list'] = """ +helps['network manager list-deploy-status'] = """ type: command short-summary: "Post List of Network Manager Deployment Status." examples: - name: Post Azure Virtual Network Manager Deployment Status text: |- - az network manager deploy-status list --network-manager-name "testNetworkManager" --deployment-types \ + az network manager list-deploy-status --network-manager-name "testNetworkManager" --deployment-types \ "Connectivity" "AdminPolicy" --regions "eastus" "westus" --resource-group "resoureGroupSample" """ -helps['network manager effect-vnet'] = """ - type: group - short-summary: Manage effectivevirtualnetwork with network -""" - -helps['network manager effect-vnet list-by-network-group'] = """ +helps['network manager list-effect-vnet'] = """ type: command - short-summary: "Lists all effective virtual networks by specified network group." + short-summary: "List effective virtual networks in a network manager." examples: - name: List Effective Virtual Networks List By Network Groups text: |- - az network manager effect-vnet list-by-network-group --network-group-name "TestNetworkGroup" \ ---network-manager-name "testNetworkManager" --resource-group "rg1" + az network manager list-effect-vnet --network-manager-name "testNetworkManager" \ +--conditional-members "location=\'useast2\'" --resource-group "rg1" """ -helps['network manager effect-vnet list-by-network-manager'] = """ +helps['network manager list-active-config'] = """ type: command - short-summary: "List effective virtual networks in a network manager." + short-summary: "Lists active configurations in a network manager." examples: - - name: List Effective Virtual Networks List By Network Groups + - name: Get Azure Virtual Network Manager Active Configuration text: |- - az network manager effect-vnet list-by-network-manager --network-manager-name "testNetworkManager" \ ---conditional-members "location=\'useast2\'" --resource-group "rg1" + az network manager list-active-config --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup" """ -helps['network manager active-security-admin-rule'] = """ - type: group - short-summary: Manage active security admin rule +helps['network manager list-effective-config'] = """ + type: command + short-summary: "Lists effective configuration in a network manager." + examples: + - name: Get Azure Virtual Network Manager Effective Configuration + text: |- + az network manager list-effective-config --virtual-network-name "myVirtualNetwork" --resource-group "myResourceGroup" """ -helps['network manager active-security-admin-rule list'] = """ +helps['network manager list-active-security-admin-rule'] = """ type: command short-summary: "Lists active security admin rule in a network manager." examples: - name: Get Azure Virtual Network Manager Active Security Admin Rule text: |- - az network manager active-security-admin-rule list --network-manager-name "testNetworkManager" --resource-group \ + az network manager list-active-security-admin-rule --network-manager-name "testNetworkManager" --resource-group \ "myResourceGroup --region eastus2euap" """ -helps['network manager active-security-user-rule'] = """ - type: group - short-summary: Manage active security user rule -""" - -helps['network manager active-security-user-rule list'] = """ +helps['network manager list-active-security-user-rule'] = """ type: command short-summary: "Lists active security user rule in a network manager." examples: - name: Get Azure Virtual Network Manager Active Security User Rule text: |- - az network manager active-security-user-rule list --network-manager-name "testNetworkManager" --resource-group \ + az network manager list-active-security-user-rule --network-manager-name "testNetworkManager" --resource-group \ "myResourceGroup --region eastus2euap" """ -helps['network manager effective-config'] = """ - type: group - short-summary: Manage effective configuration -""" - -helps['network manager effective-config list'] = """ - type: command - short-summary: "Lists effective configuration in a network manager." - examples: - - name: Get Azure Virtual Network Manager Effective Configuration - text: |- - az network manager effective-config list --virtual-network-name "myVirtualNetwork" --resource-group "myResourceGroup" -""" - -helps['network manager active-config'] = """ - type: group - short-summary: Manage activeconfiguration with network -""" - -helps['network manager active-config list'] = """ - type: command - short-summary: "Lists active configurations in a network manager." - examples: - - name: Get Azure Virtual Network Manager Active Configuration - text: |- - az network manager active-config list --network-manager-name "testNetworkManager" --resource-group \ -"myResourceGroup" -""" - helps['network manager connect-config'] = """ type: group short-summary: Manage connectivityconfiguration with network @@ -361,6 +316,16 @@ --resource-group "rg1" """ +helps['network manager effect-vnet list-effect-vnet'] = """ + type: command + short-summary: "Lists all effective virtual networks by specified network group." + examples: + - name: List Effective Virtual Networks List By Network Groups + text: |- + az network manager list-effect-vnet --network-group-name "TestNetworkGroup" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + helps['network manager security-user-config'] = """ type: group short-summary: Manage securityuserconfiguration with network diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index a0b2792d1de..8f8d383098e 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -81,7 +81,7 @@ def load_arguments(self, _): help='The name of the network manager.', id_part='name') # endregion - with self.argument_context('network manager commit post') as c: + with self.argument_context('network manager post-commit') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('target_locations', nargs='+', help='List of target locations.') @@ -89,7 +89,7 @@ def load_arguments(self, _): c.argument('commit_type', arg_type=get_enum_type(['SecurityAdmin', 'SecurityUser', 'Connectivity']), help='Commit Type.') - with self.argument_context('network manager deploy-status list') as c: + with self.argument_context('network manager list-deploy-status') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' @@ -100,7 +100,7 @@ def load_arguments(self, _): c.argument('regions', nargs='+', help='List of locations.') c.argument('deployment_types', nargs='+', help='List of configurations\' deployment types.') - with self.argument_context('network manager effect-vnet list-by-network-group') as c: + with self.argument_context('network manager group list-effect-vnet') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') c.argument('network_group_name', type=str, help='The name of the network group to get.') @@ -110,7 +110,7 @@ def load_arguments(self, _): '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('network manager effect-vnet list-by-network-manager') as c: + with self.argument_context('network manager list-effect-vnet') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.') c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' @@ -120,27 +120,27 @@ def load_arguments(self, _): 'include a skipToken parameter that specifies a starting point to use for subsequent calls.') c.argument('conditional_members', type=str, help='Conditional Members.') - with self.argument_context('network manager effective-config list') as c: + with self.argument_context('network manager list-effective-config') as c: c.argument('virtual_network_name', type=str, help='The name of the virtual network.', id_part=None) c.argument('skip_token', type=str, 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('network manager active-security-admin-rule list') as c: + with self.argument_context('network manager list-active-security-admin-rule') as c: c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('skip_token', type=str, 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.') c.argument('regions', nargs='+', help='List of locations.') - with self.argument_context('network manager active-security-user-rule list') as c: + with self.argument_context('network manager list-active-security-user-rule') as c: c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('skip_token', type=str, 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.') c.argument('regions', nargs='+', help='List of locations.') - with self.argument_context('network manager active-config list') as c: + with self.argument_context('network manager list-active-config') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part=None) c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 7516ccbc10e..9719761461c 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -104,28 +104,13 @@ def load_command_table(self, _): g.custom_show_command('show', 'network_manager_show') g.generic_update_command('update', custom_func_name='network_manager_update') g.custom_command('delete', 'network_manager_delete', confirmation=True) - - with self.command_group('network manager commit', network_networkmanagercommit, client_factory=cf_networkmanagercommit) as g: - g.custom_command('post', 'network_manager_commit_post') - - with self.command_group('network manager deploy-status', network_networkmanagerdeploymentstatus, client_factory=cf_networkmanagerdeploymentstatus) as g: - g.custom_command('list', 'network_manager_deploy_status_list') - - with self.command_group('network manager effect-vnet', network_effectivevirtualnetwork, client_factory=cf_effectivevirtualnetwork) as g: - g.custom_command('list-by-network-group', 'network_manager_effect_vnet_list_by_network_group') - g.custom_command('list-by-network-manager', 'network_manager_effect_vnet_list_by_network_manager') - - with self.command_group('network manager active-config', network_activeconnectivityconfiguration, client_factory=cf_activeconnectivityconfiguration) as g: - g.custom_command('list', 'network_manager_active_config_list') - - with self.command_group('network manager effective-config', network_effectiveconnectivityconfiguration, client_factory=cf_effectiveconnectivityconfiguration) as g: - g.custom_command('list', 'network_manager_effective_config_list') - - with self.command_group('network manager active-security-admin-rule', network_activesecurityadminrule, client_factory=cf_activesecurityadminrule) as g: - g.custom_command('list', 'network_manager_active_security_admin_rule_list') - - with self.command_group('network manager active-security-user-rule', network_activesecurityuserrule, client_factory=cf_activesecurityuserrule) as g: - g.custom_command('list', 'network_manager_active_security_user_rule_list') + g.custom_command('post-commit', 'network_manager_commit_post') + g.custom_command('list-deploy-status', 'network_manager_deploy_status_list') + g.custom_command('list-effect-vnet', 'network_manager_effect_vnet_list_by_network_manager') + g.custom_command('list-active-config', 'network_manager_active_config_list') + g.custom_command('list-effective-config', 'network_manager_effective_config_list') + g.custom_command('list-active-security-admin-rule', 'network_manager_active_security_admin_rule_list') + g.custom_command('list-active-security-user-rule', 'network_manager_active_security_user_rule_list') with self.command_group('network manager connect-config', network_connectivityconfiguration, client_factory=cf_connectivityconfiguration) as g: g.custom_command('list', 'network_manager_connect_config_list') @@ -140,6 +125,7 @@ def load_command_table(self, _): g.custom_command('create', 'network_manager_group_create') g.generic_update_command('update', custom_func_name='network_manager_group_update') g.custom_command('delete', 'network_manager_group_delete', confirmation=True) + g.custom_command('list-effect-vnet', 'network_manager_effect_vnet_list_by_network_group') with self.command_group('network manager security-user-config', network_securityuserconfiguration, client_factory=cf_securityuserconfiguration) as g: g.custom_command('list', 'network_manager_security_user_config_list') diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 576fc3a2d23..757a85356de 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -10,6 +10,16 @@ # pylint: disable=too-many-lines # pylint: disable=unused-argument +from ._client_factory import ( + cf_networkmanagercommit, + cf_networkmanagerdeploymentstatus, + cf_effectivevirtualnetwork, + cf_activeconnectivityconfiguration, + cf_effectiveconnectivityconfiguration, + cf_activesecurityadminrule, + cf_activesecurityuserrule +) + def network_manager_list(client, resource_group_name, @@ -84,12 +94,14 @@ def network_manager_delete(client, network_manager_name=network_manager_name) -def network_manager_commit_post(client, +def network_manager_commit_post(cmd, + client, resource_group_name, network_manager_name, target_locations=None, configuration_ids=None, commit_type=None): + client = cf_networkmanagercommit(cmd.cli_ctx) parameters = {} parameters['target_locations'] = target_locations parameters['configuration_ids'] = configuration_ids @@ -99,12 +111,14 @@ def network_manager_commit_post(client, parameters=parameters) -def network_manager_deploy_status_list(client, +def network_manager_deploy_status_list(cmd, + client, resource_group_name, network_manager_name, skip_token=None, regions=None, deployment_types=None): + client = cf_networkmanagerdeploymentstatus(cmd.cli_ctx) parameters = {} parameters['regions'] = regions parameters['deployment_types'] = deployment_types @@ -114,11 +128,13 @@ def network_manager_deploy_status_list(client, parameters=parameters) -def network_manager_effect_vnet_list_by_network_group(client, +def network_manager_effect_vnet_list_by_network_group(cmd, + client, resource_group_name, network_manager_name, network_group_name, skip_token=None): + client = cf_effectivevirtualnetwork(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token return client.list_by_network_group(resource_group_name=resource_group_name, @@ -127,12 +143,14 @@ def network_manager_effect_vnet_list_by_network_group(client, parameters=parameters) -def network_manager_effect_vnet_list_by_network_manager(client, +def network_manager_effect_vnet_list_by_network_manager(cmd, + client, resource_group_name, network_manager_name, top=None, skip_token=None, conditional_members=None): + client = cf_effectivevirtualnetwork(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token parameters['conditional_members'] = conditional_members @@ -143,11 +161,13 @@ def network_manager_effect_vnet_list_by_network_manager(client, parameters=parameters) -def network_manager_active_config_list(client, +def network_manager_active_config_list(cmd, + client, resource_group_name, network_manager_name, skip_token=None, region=None): + client = cf_activeconnectivityconfiguration(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token parameters['region'] = region @@ -156,10 +176,12 @@ def network_manager_active_config_list(client, parameters=parameters) -def network_manager_effective_config_list(client, +def network_manager_effective_config_list(cmd, + client, resource_group_name, virtual_network_name, skip_token=None): + client = cf_effectiveconnectivityconfiguration(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token return client.list(resource_group_name=resource_group_name, @@ -167,11 +189,13 @@ def network_manager_effective_config_list(client, parameters=parameters) -def network_manager_active_security_admin_rule_list(client, +def network_manager_active_security_admin_rule_list(cmd, + client, resource_group_name, network_manager_name, skip_token=None, regions=None): + client = cf_activesecurityadminrule(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token parameters['region'] = regions @@ -180,11 +204,13 @@ def network_manager_active_security_admin_rule_list(client, parameters=parameters) -def network_manager_active_security_user_rule_list(client, +def network_manager_active_security_user_rule_list(cmd, + client, resource_group_name, network_manager_name, skip_token=None, regions=None): + client = cf_activesecurityuserrule(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token parameters['regions'] = regions diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 5de822d6bbb..bdebef1c497 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -134,11 +134,11 @@ def test_network_manager_security_admin_config_crud(self, resource_group): self.cmd('network manager security-admin-config show --configuration-name {name} --network-manager-name {manager_name} -g {rg}') # test nm commit - # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ' + # self.cmd('network manager post-commit --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ' # '--configuration-ids {sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/securityAdminConfigurations/{name}') # test nm uncommit - # self.cmd('network manager commit post --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ') + # self.cmd('network manager post-commit --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ') self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') @@ -368,12 +368,12 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): '--conditional-membership "" --display-name ASampleGroup --member-type VirtualNetwork -g {rg} ' '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') - self.cmd('network manager deploy-status list --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') - self.cmd('network manager effect-vnet list-by-network-group --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager list-deploy-status --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') + self.cmd('network manager group list-effect-vnet --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') # Internal Server Error - self.cmd('network manager effect-vnet list-by-network-manager --network-manager-name {manager_name} --resource-group {rg}') - self.cmd('network manager active-config list --network-manager-name {manager_name} --resource-group {rg}') - self.cmd('network manager effective-config list --virtual-network-name {virtual_network} -g {rg}') - self.cmd('network manager active-security-admin-rule list --network-manager-name {manager_name} -g {rg} --regions eastus2euap') + self.cmd('network manager list-effect-vnet --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager list-active-config --network-manager-name {manager_name} --resource-group {rg}') + self.cmd('network manager list-effective-config --virtual-network-name {virtual_network} -g {rg}') + self.cmd('network manager list-active-security-admin-rule --network-manager-name {manager_name} -g {rg} --regions eastus2euap') # Internal Server Error - # self.cmd('network manager active-security-user-rule list --network-manager-name {manager_name} -g {rg} --region eastus2euap') + # self.cmd('network manager list-active-security-user-rule --network-manager-name {manager_name} -g {rg} --region eastus2euap') From bafd7b23a2993e197e37f11e006aa676a7280494 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 14 Oct 2021 16:10:45 +0800 Subject: [PATCH 26/28] fix --- .../azext_network_manager/commands.py | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 9719761461c..4580949be6f 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -24,40 +24,6 @@ def load_command_table(self, _): client_factory=cf_networkmanager ) - network_networkmanagercommit = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._network_manager_commits_operations#NetworkManagercommitsOperations.{}', - client_factory=cf_networkmanagercommit - ) - - network_networkmanagerdeploymentstatus = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._network_manager_deployment_status_operations#NetworkManagerDeploymentStatusOperations.{}', - client_factory=cf_networkmanagerdeploymentstatus - ) - - network_effectivevirtualnetwork = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_virtual_networks_operations#EffectiveVirtualNetworksOperations.{}', - client_factory=cf_effectivevirtualnetwork) - - network_activeconnectivityconfiguration = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._active_connectivity_configurations_operations#ActiveConnetivityConfigurationsOperations.{}', - client_factory=cf_activeconnectivityconfiguration - ) - - network_effectiveconnectivityconfiguration = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._effective_connectivity_configurations_operations#EffectiveConnetivityConfigurationsOperations.{}', - client_factory=cf_effectiveconnectivityconfiguration - ) - - network_activesecurityadminrule = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._active_security_admin_rules_operations#ActiveSecurityAdminRulesOperations.{}', - client_factory=cf_activesecurityadminrule - ) - - network_activesecurityuserrule = CliCommandType( - operations_tmpl='azext_network_manager.vendored_sdks.operations._active_security_user_rules_operations#ActiveSecurityUserRulesOperations.{}', - client_factory=cf_activesecurityuserrule - ) - network_connectivityconfiguration = CliCommandType( operations_tmpl='azext_network_manager.vendored_sdks.operations._connectivity_configurations_operations#ConnectivityConfigurationsOperations.{}', client_factory=cf_connectivityconfiguration From 0a6505357ebd596b9fd406e8d32353855e764546 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 14 Oct 2021 16:25:36 +0800 Subject: [PATCH 27/28] fix --- src/network-manager/azext_network_manager/_help.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 523704a28e3..66f687f834f 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -316,13 +316,13 @@ --resource-group "rg1" """ -helps['network manager effect-vnet list-effect-vnet'] = """ +helps['network manager group list-effect-vnet'] = """ type: command short-summary: "Lists all effective virtual networks by specified network group." examples: - name: List Effective Virtual Networks List By Network Groups text: |- - az network manager list-effect-vnet --network-group-name "TestNetworkGroup" \ + az network manager group list-effect-vnet --network-group-name "TestNetworkGroup" \ --network-manager-name "testNetworkManager" --resource-group "rg1" """ From 1e041b9900027396d5269895eaf21fa2fa67b14f Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 14 Oct 2021 17:15:07 +0800 Subject: [PATCH 28/28] fix --- src/network-manager/azext_network_manager/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 8f8d383098e..86cc5430c89 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -121,7 +121,7 @@ def load_arguments(self, _): c.argument('conditional_members', type=str, help='Conditional Members.') with self.argument_context('network manager list-effective-config') as c: - c.argument('virtual_network_name', type=str, help='The name of the virtual network.', id_part=None) + c.argument('virtual_network_name', options_list=['--vnet-name', '--virtual-network-name'], type=str, help='The name of the virtual network.', id_part=None) c.argument('skip_token', type=str, 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.')