From 076f5b3d44b95eb214a7d3249fb6b138c0aafd1d Mon Sep 17 00:00:00 2001 From: "Kerwin(Kaihui) Sun" Date: Fri, 15 Oct 2021 16:29:44 +0800 Subject: [PATCH] [Network Manager] Init network manager extension (#3946) network manager extension --- .github/CODEOWNERS | 2 + src/network-manager/HISTORY.rst | 8 + src/network-manager/README.md | 13 + .../azext_network_manager/__init__.py | 37 + .../azext_network_manager/_client_factory.py | 83 + .../azext_network_manager/_help.py | 733 ++++ .../azext_network_manager/_params.py | 532 +++ .../azext_network_manager/_validators.py | 9 + .../azext_network_manager/action.py | 203 + .../azext_network_manager/azext_metadata.json | 4 + .../azext_network_manager/commands.py | 136 + .../azext_network_manager/custom.py | 959 +++++ .../azext_network_manager/tests/__init__.py | 6 + .../tests/latest/__init__.py | 12 + .../tests/latest/example_steps.py | 432 +++ .../tests/latest/preparers.py | 159 + ...rk_manager_admin_rule_collection_crud.yaml | 559 +++ .../test_network_manager_admin_rule_crud.yaml | 526 +++ ...t_network_manager_connect_config_crud.yaml | 424 +++ .../recordings/test_network_manager_crud.yaml | 201 + .../test_network_manager_group_crud.yaml | 362 ++ .../test_network_manager_list_queries.yaml | 427 +++ ...rk_manager_security_admin_config_crud.yaml | 356 ++ ...ork_manager_security_user_config_crud.yaml | 356 ++ ...ork_manager_user_rule_collection_crud.yaml | 559 +++ .../test_network_manager_user_rule_crud.yaml | 524 +++ .../tests/latest/test_network_scenario.py | 379 ++ .../vendored_sdks/__init__.py | 19 + .../vendored_sdks/_configuration.py | 71 + .../vendored_sdks/_metadata.json | 121 + .../_network_management_client.py | 178 + .../vendored_sdks/_version.py | 9 + .../vendored_sdks/aio/__init__.py | 10 + .../vendored_sdks/aio/_configuration.py | 67 + .../aio/_network_management_client.py | 171 + .../vendored_sdks/aio/operations/__init__.py | 49 + ..._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 | 360 ++ ..._connectivity_configurations_operations.py | 327 ++ ..._connectivity_configurations_operations.py | 107 + .../_effective_virtual_networks_operations.py | 190 + .../operations/_network_groups_operations.py | 334 ++ .../_network_manager_commits_operations.py | 107 + ...rk_manager_deployment_status_operations.py | 107 + ...fective_security_admin_rules_operations.py | 107 + .../_network_managers_operations.py | 453 +++ ..._network_security_perimeters_operations.py | 387 ++ ...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 | 360 ++ .../vendored_sdks/models/__init__.py | 233 ++ .../vendored_sdks/models/_models.py | 2959 +++++++++++++++ .../vendored_sdks/models/_models_py3.py | 3284 +++++++++++++++++ .../_network_management_client_enums.py | 180 + .../vendored_sdks/operations/__init__.py | 49 + ..._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 | 368 ++ ..._connectivity_configurations_operations.py | 335 ++ ..._connectivity_configurations_operations.py | 112 + .../_effective_virtual_networks_operations.py | 196 + .../operations/_network_groups_operations.py | 342 ++ .../_network_manager_commits_operations.py | 112 + ...rk_manager_deployment_status_operations.py | 112 + ...fective_security_admin_rules_operations.py | 112 + .../_network_managers_operations.py | 463 +++ ..._network_security_perimeters_operations.py | 396 ++ ...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 | 368 ++ .../vendored_sdks/py.typed | 1 + src/network-manager/setup.cfg | 1 + src/network-manager/setup.py | 49 + 82 files changed, 24765 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/recordings/test_network_manager_admin_rule_collection_crud.yaml create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml 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_list_queries.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 create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_collection_crud.yaml create mode 100644 src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_user_rule_crud.yaml 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/_version.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_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 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_connectivity_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_manager_effective_security_admin_rules_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/_network_security_perimeters_operations.py 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 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_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 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_connectivity_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_manager_effective_security_admin_rules_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/_network_security_perimeters_operations.py 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 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/.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/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..f179932e2f6 --- /dev/null +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -0,0 +1,83 @@ +# -------------------------------------------------------------------------- +# 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_activeconnectivityconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).active_connectivity_configurations + + +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_adminrulecollection(cli_ctx, *_): + return cf_network_cl(cli_ctx).admin_rule_collections + + +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_effectivevirtualnetwork(cli_ctx, *_): + return cf_network_cl(cli_ctx).effective_virtual_networks + + +def cf_networkgroup(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_groups + + +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_effectivesecurityadminrule(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_manager_effective_security_admin_rules + + +def cf_networkmanager(cli_ctx, *_): + return cf_network_cl(cli_ctx).network_managers + + +def cf_securityadminconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).security_admin_configurations + + +def cf_securityuserconfiguration(cli_ctx, *_): + return cf_network_cl(cli_ctx).security_user_configurations + + +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 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..66f687f834f --- /dev/null +++ b/src/network-manager/azext_network_manager/_help.py @@ -0,0 +1,733 @@ +# -------------------------------------------------------------------------- +# 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" --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 post-commit'] = """ + type: command + short-summary: "Post a Network Manager Commit." + examples: + - name: Post Azure Virtual Network Manager Commit + text: |- + 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 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 list-deploy-status --network-manager-name "testNetworkManager" --deployment-types \ +"Connectivity" "AdminPolicy" --regions "eastus" "westus" --resource-group "resoureGroupSample" +""" + +helps['network manager list-effect-vnet'] = """ + 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 list-effect-vnet --network-manager-name "testNetworkManager" \ +--conditional-members "location=\'useast2\'" --resource-group "rg1" +""" + +helps['network manager list-active-config'] = """ + type: command + short-summary: "Lists active configurations in a network manager." + examples: + - name: Get Azure Virtual Network Manager Active Configuration + text: |- + az network manager list-active-config --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup" +""" + +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 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 list-active-security-admin-rule --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup --region eastus2euap" +""" + +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 list-active-security-user-rule --network-manager-name "testNetworkManager" --resource-group \ +"myResourceGroup --region eastus2euap" +""" + +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. 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="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-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'] = """ + 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. 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'] = """ + 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 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 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 group 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 +""" + +helps['network manager security-user-config list'] = """ + type: command + short-summary: "Lists all the network manager security user configurations in a network manager, in a paginated \ +format." + examples: + - name: List security user configurations in a network manager + text: |- + az network manager security-user-config list --network-manager-name "testNetworkManager" --resource-group \ +"rg1" +""" + +helps['network manager security-user-config show'] = """ + type: command + short-summary: "Retrieves a network manager security user Configuration." + examples: + - name: Get security user configurations + text: |- + az network manager security-user-config show --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager security-user-config create'] = """ + type: command + short-summary: "Create a network manager security user Configuration." + examples: + - name: Create network manager security user Configuration + text: |- + 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-user-config update'] = """ + type: command + short-summary: "Update a network manager security user Configuration." +""" + +helps['network manager security-user-config delete'] = """ + type: command + short-summary: "Deletes a network manager security user Configuration." + examples: + - name: Delete network manager security user Configuration + text: |- + az network manager security-user-config delete --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager security-admin-config'] = """ + type: group + short-summary: Manage securityadminconfiguration with network +""" + +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" +""" + +helps['network manager security-admin-config show'] = """ + type: command + short-summary: "Retrieves a network manager security admin Configuration." + examples: + - name: Get security admin configurations + text: |- + az network manager security-admin-config show --configuration-name "myTestSecurityConfig" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager security-admin-config create'] = """ + type: command + 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" +""" + +helps['network manager security-admin-config update'] = """ + type: command + short-summary: "Update a network manager security admin Configuration." +""" + +helps['network manager security-admin-config delete'] = """ + type: command + short-summary: "Deletes a network manager security admin Configuration." + examples: + - name: Delete network manager security admin Configuration + text: |- + az network manager security-admin-config delete --configuration-name "myTestSecurityConfig" \ +--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 +""" + +helps['network manager admin-rule create'] = """ + type: command + short-summary: "Create a network manager security configuration admin rule." + parameters: + - name: --sources + short-summary: "The CIDR or source IP ranges." + long-summary: | + 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 --sources argument. + - name: --destinations + 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: |- + 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" +""" + +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" --rule-collection-name "myTestCollection" +""" + +helps['network manager admin-rule update'] = """ + type: command + short-summary: "Update a network manager security configuration admin rule in a subscription." + parameters: + - name: --sources + short-summary: "The CIDR or source IP ranges." + long-summary: | + 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 --sources argument. + - name: --destinations + 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: |- + az network manager admin-rule update --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --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." + examples: + - name: Gets security admin rule + text: |- + az network manager admin-rule show --configuration-name "myTestSecurityConfig" --network-manager-name \ +"testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --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-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'] = """ + 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" --rule-collection-name "myTestCollection" +""" + +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" --rule-collection-name "myTestCollection" +""" + +helps['network manager user-rule create'] = """ + type: command + short-summary: "Create a user rule." + parameters: + - name: --sources + short-summary: "The CIDR or source IP ranges." + long-summary: | + 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 --sources argument. + - name: --destinations + 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-collection-name "myTestCollection" --rule-name "SampleUserRule" --description "Sample User Rule" \ +--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'] = """ + type: command + short-summary: "Update a user rule." + parameters: + - name: --sources + short-summary: "The CIDR or source IP ranges." + long-summary: | + 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 --sources argument. + - name: --destinations + 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 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'] = """ + 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-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 new file mode 100644 index 00000000000..86cc5430c89 --- /dev/null +++ b/src/network-manager/azext_network_manager/_params.py @@ -0,0 +1,532 @@ +# -------------------------------------------------------------------------- +# 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 +) + + +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)) + 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', options_list=['--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, + 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)) + 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', options_list=['--scope-accesses'], nargs='+', help='Scope Access. Available value: SecurityAdmin, ' + 'SecurityUser, Connectivity.') + 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 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.') + c.argument('configuration_ids', nargs='+', help='List of configuration ids.') + c.argument('commit_type', arg_type=get_enum_type(['SecurityAdmin', 'SecurityUser', 'Connectivity']), + help='Commit Type.') + + 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 ' + '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 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.') + 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 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 ' + '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 list-effective-config') as c: + 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.') + + 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 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 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 ' + '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.', 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 ' + '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(['HubAndSpoke', 'Mesh']), + help='Connectivity topology type.') + 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', 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: + 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('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', options_list=['--delete-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 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.', 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 ' + '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', 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', 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 ' + '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', 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 ' + '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', 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-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.', 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 ' + '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-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-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.') + 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-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.', + 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-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 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=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.') + 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 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=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 ' + '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 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 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('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 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=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 ' + '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('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('rule_collection_name', type=str, help='The name of the admin rule collection.') + + 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 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', 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.') + + 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', 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.') + + 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=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 ' + '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') 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('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 ' + '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 create') as c: + 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('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', 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.') + 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('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('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', 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.') + 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') 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..373564253bc --- /dev/null +++ b/src/network-manager/azext_network_manager/action.py @@ -0,0 +1,203 @@ +# -------------------------------------------------------------------------- +# 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] + 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, resource-type'.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..4580949be6f --- /dev/null +++ b/src/network-manager/azext_network_manager/commands.py @@ -0,0 +1,136 @@ +# -------------------------------------------------------------------------- +# 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_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) + + +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_connectivityconfiguration = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._connectivity_configurations_operations#ConnectivityConfigurationsOperations.{}', + client_factory=cf_connectivityconfiguration + ) + + network_networkgroup = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._network_groups_operations#NetworkGroupsOperations.{}', + client_factory=cf_networkgroup + ) + + 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( + operations_tmpl='azext_network_manager.vendored_sdks.operations._admin_rules_operations#AdminRulesOperations.{}', + 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_collections_operations#UserRuleCollectionsOperations.{}', + client_factory=cf_userrulecollection + ) + + 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) + 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') + 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 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) + 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') + 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('create', 'network_manager_admin_rule_create') + 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) + + 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='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') + 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) + + 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 new file mode 100644 index 00000000000..757a85356de --- /dev/null +++ b/src/network-manager/azext_network_manager/custom.py @@ -0,0 +1,959 @@ +# -------------------------------------------------------------------------- +# 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 + +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, + 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(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 + 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(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 + 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_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, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + parameters=parameters) + + +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 + 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(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 + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) + + +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, + virtual_network_name=virtual_network_name, + parameters=parameters) + + +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 + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) + + +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 + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) + + +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, + 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, + hubs=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['hubs'] = hubs + 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, + hubs=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 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: + 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_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_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_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_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 + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + 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: + 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_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_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_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, + admin_rule=rule) + + +def network_manager_admin_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, + 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) + + +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) + + +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, + 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): + 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) + + +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) + + +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, + sources=None, + destinations=None, + source_port_ranges=None, + destination_port_ranges=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['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) + + +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, + sources=None, + destinations=None, + source_port_ranges=None, + destination_port_ranges=None, + 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 + + +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/__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/recordings/test_network_manager_admin_rule_collection_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml new file mode 100644 index 00000000000..ee7434e3c17 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_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": + ["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_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_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 + content-length: + - '924' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36: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: + - '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_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_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_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 + content-length: + - '1009' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36: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: + - '1198' + 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_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_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: + - '772' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36: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 + 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_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_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_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 + content-length: + - '1100' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36: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 + 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 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_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_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 + content-length: + - '1122' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36:30 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_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_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 + content-length: + - '1122' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36:32 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_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_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_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 + content-length: + - '1092' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36:35 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_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_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 + content-length: + - '1149' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 09:36: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 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_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 09:36:39 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_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 09:36: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 +- 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_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 09:36: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-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 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/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/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..5993a82cea0 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml @@ -0,0 +1,201 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "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: + - '282' + 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_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":"","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: + - '918' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 05:53: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: 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 +- 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.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":"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: + - '966' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 05: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 delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --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_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 29 Sep 2021 05:54:12 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_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..aaa283aacc8 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml @@ -0,0 +1,362 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "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: + - '282' + 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_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":"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: + - '918' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:22: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: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyNetworkGroup", "description": "A sample + 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 + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '392' + 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_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":[{"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: + - '1010' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:22:41 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 update + Connection: + - keep-alive + ParameterSetName: + - -g --name --network-manager-name --description + 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_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":"\"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: + - '1032' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:22: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": [{"resourceId": "/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: + - '359' + Content-Type: + - application/json + ParameterSetName: + - -g --name --network-manager-name --description + 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_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":[{"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: + - '1000' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:22:46 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.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":"\"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: + - '1031' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:22: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 list + Connection: + - keep-alive + ParameterSetName: + - -g --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_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":[{"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: + - '1017' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:22: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 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_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: + - Wed, 29 Sep 2021 06:22:55 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_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..786d9cf92c4 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml @@ -0,0 +1,427 @@ +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 --scope-accesses --network-manager-scopes + -l --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: 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":"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 + content-length: + - '923' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 03:17: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 + 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_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.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":"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: + - '1007' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 03:17:04 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: '{"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.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: + 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: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: '{}' + 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.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: + body: + 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: + - '299' + content-type: + - application/json; charset=utf-8 + date: + - 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: + - 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 active-config list + 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/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: + - Wed, 13 Oct 2021 03:17: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: + - '1199' + 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.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/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: + - Wed, 13 Oct 2021 03:17: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: + - '1197' + 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 --regions + 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/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: + - Wed, 13 Oct 2021 03:17: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: 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..6753ac6627a --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml @@ -0,0 +1,356 @@ +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_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":"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: + - '924' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:26:32 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": "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_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":"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: + - '772' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:26:35 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.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":"\"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: + - '794' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:26: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 + 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.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":"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: + - '764' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:26: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: + - '1196' + 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.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":"\"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: + - '821' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:26: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 + 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.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":"\"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: + - '795' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:26: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 + 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_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: + - Wed, 29 Sep 2021 06:26: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: + - '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 new file mode 100644 index 00000000000..b5b84f60170 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_user_config_crud.yaml @@ -0,0 +1,356 @@ +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_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":"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: + - '923' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:24: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": "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_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":"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: + - '770' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:24: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: 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.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":"\"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: + - '792' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:24:46 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.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":"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: + - '762' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:24: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: + - '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.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":"\"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: + - '819' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:24: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 security-user-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_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":"\"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: + - '793' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Sep 2021 06:24:54 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.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: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 29 Sep 2021 06:24:55 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_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/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 new file mode 100644 index 00000000000..bdebef1c497 --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -0,0 +1,379 @@ +# -------------------------------------------------------------------------- +# 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 +import unittest + +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) + + @ResourceGroupPreparer(name_prefix='test_network_manager', location='eastus2euap') + def test_network_manager_crud(self, resource_group): + self.kwargs.update({ + 'name': 'TestNetworkManager', + 'description': '"My Test Network Manager"', + 'display_name': 'TestNetworkManager', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()) + }) + + self.cmd('network manager create --name {name} --description {description} --display-name {display_name} ' + '--scope-accesses "Routing" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-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') + + self.cmd('network manager list --resource-group {rg}') + + self.cmd('network manager delete --resource-group {rg} --name {name} --yes') + + @ResourceGroupPreparer(name_prefix='test_network_manager_group', location='eastus2euap') + @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" ' + '--scope-accesses "Routing" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-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 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='eastus2euap') + 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" ' + '--scope-accesses "SecurityUser" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--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='eastus2euap') + 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" ' + '--scope-accesses "SecurityAdmin" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--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}') + + # test nm commit + # 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 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') + + + @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): + + 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" ' + '--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') + @VirtualNetworkPreparer() + def test_network_manager_admin_rule_collection_crud(self, virtual_network, resource_group): + + 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" ' + '--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 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} --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} --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') + + + @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_user_rule_crud(self, virtual_network, resource_group): + 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" ' + '--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() + def test_network_manager_user_rule_collection_crud(self, virtual_network, resource_group): + + 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" ' + '--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') + + @ResourceGroupPreparer(name_prefix='test_network_manager_connect_config_crud', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_connect_config_crud(self, virtual_network, resource_group): + 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" ' + '--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-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') + + + @ResourceGroupPreparer(name_prefix='test_network_manager_list_queries', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_list_queries(self, virtual_network, resource_group): + + 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" ' + '--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 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 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 list-active-security-user-rule --network-manager-name {manager_name} -g {rg} --region eastus2euap') 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..cbe2d6051b9 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py @@ -0,0 +1,19 @@ +# 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 +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 new file mode 100644 index 00000000000..d3ec9ffb0ec --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py @@ -0,0 +1,71 @@ +# 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 + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +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..3b8e77f02a2 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json @@ -0,0 +1,121 @@ +{ + "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": 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": { + "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: \"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: 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", + "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, + "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_connectivity_configurations": "ActiveConnectivityConfigurationsOperations", + "active_security_admin_rules": "ActiveSecurityAdminRulesOperations", + "active_security_user_rules": "ActiveSecurityUserRulesOperations", + "connectivity_configurations": "ConnectivityConfigurationsOperations", + "effective_connectivity_configurations": "EffectiveConnectivityConfigurationsOperations", + "network_manager_effective_security_admin_rules": "NetworkManagerEffectiveSecurityAdminRulesOperations", + "network_groups": "NetworkGroupsOperations", + "security_user_configurations": "SecurityUserConfigurationsOperations", + "user_rule_collections": "UserRuleCollectionsOperations", + "user_rules": "UserRulesOperations", + "security_admin_configurations": "SecurityAdminConfigurationsOperations", + "admin_rule_collections": "AdminRuleCollectionsOperations", + "admin_rules": "AdminRulesOperations", + "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 new file mode 100644 index 00000000000..7ff3d376174 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py @@ -0,0 +1,178 @@ +# 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 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 ActiveConnectivityConfigurationsOperations +from .operations import ActiveSecurityAdminRulesOperations +from .operations import ActiveSecurityUserRulesOperations +from .operations import ConnectivityConfigurationsOperations +from .operations import EffectiveConnectivityConfigurationsOperations +from .operations import NetworkManagerEffectiveSecurityAdminRulesOperations +from .operations import NetworkGroupsOperations +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 + + +class NetworkManagementClient(object): + """Network Client. + + :ivar network_managers: NetworkManagersOperations operations + :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_01_preview.operations.NetworkManagerCommitsOperations + :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations + :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_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_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_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_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. + :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._serialize.client_side_validation = False + 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_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_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_user_configurations = SecurityUserConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + 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 + 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/_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/__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..05295a7364a --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +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..9de340f52e3 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py @@ -0,0 +1,171 @@ +# 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.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 ActiveConnectivityConfigurationsOperations +from .operations import ActiveSecurityAdminRulesOperations +from .operations import ActiveSecurityUserRulesOperations +from .operations import ConnectivityConfigurationsOperations +from .operations import EffectiveConnectivityConfigurationsOperations +from .operations import NetworkManagerEffectiveSecurityAdminRulesOperations +from .operations import NetworkGroupsOperations +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 + + +class NetworkManagementClient(object): + """Network Client. + + :ivar network_managers: NetworkManagersOperations operations + :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_01_preview.aio.operations.NetworkManagerCommitsOperations + :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations + :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_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_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_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_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. + :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._serialize.client_side_validation = False + 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_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_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_user_configurations = SecurityUserConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + 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() + + 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..e3ab4d13aca --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py @@ -0,0 +1,49 @@ +# 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_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_connectivity_configurations_operations import EffectiveConnectivityConfigurationsOperations +from ._network_manager_effective_security_admin_rules_operations import NetworkManagerEffectiveSecurityAdminRulesOperations +from ._network_groups_operations import NetworkGroupsOperations +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', + 'ActiveConnectivityConfigurationsOperations', + 'ActiveSecurityAdminRulesOperations', + 'ActiveSecurityUserRulesOperations', + 'ConnectivityConfigurationsOperations', + 'EffectiveConnectivityConfigurationsOperations', + 'NetworkManagerEffectiveSecurityAdminRulesOperations', + 'NetworkGroupsOperations', + 'SecurityUserConfigurationsOperations', + 'UserRuleCollectionsOperations', + 'UserRulesOperations', + 'SecurityAdminConfigurationsOperations', + 'AdminRuleCollectionsOperations', + 'AdminRulesOperations', + 'NetworkSecurityPerimetersOperations', + 'PerimeterAssociableResourceTypesOperations', +] 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 new file mode 100644 index 00000000000..4d41ba8a9b6 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py @@ -0,0 +1,360 @@ +# 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_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, + rule_collection_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AdminRuleListResult"]: + """List all network manager security configuration admin 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 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 + :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_01_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'), + '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') + 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}/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: 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 + :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_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: 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.BaseAdminRule"] + 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'), + '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('BaseAdminRule', 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}/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.BaseAdminRule", + **kwargs: Any + ) -> "_models.BaseAdminRule": + """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_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_01_preview.models.BaseAdminRule + :keyword callable cls: A custom type or function that will be passed the direct response + :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.BaseAdminRule"] + 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'), + '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, '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) + 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('BaseAdminRule', pipeline_response) + + if response.status_code == 201: + 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}/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: Any + ) -> 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_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: 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'), + '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}/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 new file mode 100644 index 00000000000..7aaf0f0a2c5 --- /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_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, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_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_01_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: Any + ) -> "_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_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_01_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: Any + ) -> 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: Any + ) -> 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_01_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_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 new file mode 100644 index 00000000000..7f424f19c79 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py @@ -0,0 +1,190 @@ +# 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 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_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_by_network_manager( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.EffectiveVirtualNetworksParameter", + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> "_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 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 + :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: 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"] + 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_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] + 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) + 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 + + async def list_by_network_group( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + 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. + :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 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: 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"] + 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_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 new file mode 100644 index 00000000000..5393f2574ab --- /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_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, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + **kwargs: Any + ) -> "_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_01_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: Any + ) -> "_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_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_01_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: Any + ) -> 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: Any + ) -> 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_01_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..edb5e278cd4 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_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 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_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 post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManagerCommit", + **kwargs: Any + ) -> "_models.NetworkManagerCommit": + """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_01_preview.models.NetworkManagerCommit + :keyword callable cls: A custom type or function that will be passed the direct response + :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["_models.NetworkManagerCommit"] + 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 [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, 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 new file mode 100644 index 00000000000..217199348e4 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_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 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_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.NetworkManagerDeploymentStatusParameter", + **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_01_preview.models.NetworkManagerDeploymentStatusParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :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"] + 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, '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 new file mode 100644 index 00000000000..922ec5fdb52 --- /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_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, + resource_group_name: str, + network_manager_name: str, + **kwargs: Any + ) -> "_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_01_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: Any + ) -> "_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_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_01_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: Any + ) -> 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: Any + ) -> "_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_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_01_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: Any + ) -> 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_01_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: Any + ) -> 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_01_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/_network_security_perimeters_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py new file mode 100644 index 00000000000..e848ca499c6 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py @@ -0,0 +1,387 @@ +# 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 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_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, + resource_group_name: str, + 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_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: 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.NetworkSecurityPerimeter"] + 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'), + '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.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('NetworkSecurityPerimeter', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + 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_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: 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.NetworkSecurityPerimeter"] + 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'), + '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['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, 'NetworkSecurityPerimeter') + 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('NetworkSecurityPerimeter', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + 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_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 + :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 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.NetworkSecurityPerimeterListResult"] + 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('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) + + 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/networkSecurityPerimeters'} # type: ignore + + def list( + self, + resource_group_name: str, + 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 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 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.NetworkSecurityPerimeterListResult"] + 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('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) + + 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/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 new file mode 100644 index 00000000000..895b099aca7 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py @@ -0,0 +1,360 @@ +# 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_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, + rule_collection_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.UserRuleListResult"]: + """Lists all user rules in a 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 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_01_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'), + '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') + 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}/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: Any + ) -> "_models.BaseUserRule": + """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_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: 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.BaseUserRule"] + 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'), + '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('BaseUserRule', 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}/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.BaseUserRule", + **kwargs: Any + ) -> "_models.BaseUserRule": + """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_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_01_preview.models.BaseUserRule + :keyword callable cls: A custom type or function that will be passed the direct response + :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.BaseUserRule"] + 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'), + '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, '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) + 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('BaseUserRule', pipeline_response) + + if response.status_code == 201: + 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}/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: Any + ) -> 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_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: 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'), + '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}/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 new file mode 100644 index 00000000000..a0e46b4c305 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py @@ -0,0 +1,233 @@ +# 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 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 BaseAdminRule + from ._models_py3 import BaseUserRule + from ._models_py3 import CloudErrorBody + from ._models_py3 import ConfigurationGroup + from ._models_py3 import ConnectivityConfiguration + from ._models_py3 import ConnectivityConfigurationListResult + from ._models_py3 import ConnectivityGroupItem + 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 GroupMembersItem + from ._models_py3 import Hub + 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 NetworkManagerEffectiveConnectivityConfigurationListResult + from ._models_py3 import NetworkManagerEffectiveSecurityAdminRulesListResult + from ._models_py3 import NetworkManagerListResult + from ._models_py3 import NetworkManagerPropertiesNetworkManagerScopes + from ._models_py3 import NetworkManagerSecurityGroupItem + 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 SecurityConfigurationListResult + 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 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 BaseAdminRule # type: ignore + from ._models import BaseUserRule # type: ignore + from ._models import CloudErrorBody # 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 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 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 + 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 NetworkManagerEffectiveConnectivityConfigurationListResult # type: ignore + from ._models import NetworkManagerEffectiveSecurityAdminRulesListResult # type: ignore + from ._models import NetworkManagerListResult # type: ignore + from ._models import NetworkManagerPropertiesNetworkManagerScopes # type: ignore + from ._models import NetworkManagerSecurityGroupItem # 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 SecurityConfigurationListResult # 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 ( + AddressPrefixType, + AdminRuleKind, + ConfigurationType, + ConnectivityTopology, + CreatedByType, + DeleteExistingNSGs, + DeleteExistingPeering, + DeploymentStatus, + EffectiveAdminRuleKind, + EffectiveUserRuleKind, + GroupConnectivity, + IsGlobal, + MembershipType, + ProvisioningState, + SecurityConfigurationRuleAccess, + SecurityConfigurationRuleDirection, + SecurityConfigurationRuleProtocol, + SecurityType, + UseHubGateway, + UserRuleKind, +) + +__all__ = [ + 'ActiveBaseSecurityAdminRule', + 'ActiveBaseSecurityUserRule', + 'ActiveConfigurationParameter', + 'ActiveConnectivityConfiguration', + 'ActiveConnectivityConfigurationsListResult', + 'ActiveDefaultSecurityAdminRule', + 'ActiveDefaultSecurityUserRule', + 'ActiveSecurityAdminRule', + 'ActiveSecurityAdminRulesListResult', + 'ActiveSecurityUserRule', + 'ActiveSecurityUserRulesListResult', + 'AddressPrefixItem', + 'AdminRule', + 'AdminRuleListResult', + 'BaseAdminRule', + 'BaseUserRule', + 'CloudErrorBody', + 'ConfigurationGroup', + 'ConnectivityConfiguration', + 'ConnectivityConfigurationListResult', + 'ConnectivityGroupItem', + 'DefaultAdminRule', + 'DefaultUserRule', + 'EffectiveBaseSecurityAdminRule', + 'EffectiveConnectivityConfiguration', + 'EffectiveDefaultSecurityAdminRule', + 'EffectiveSecurityAdminRule', + 'EffectiveVirtualNetwork', + 'EffectiveVirtualNetworksListResult', + 'EffectiveVirtualNetworksParameter', + 'GroupMembersItem', + 'Hub', + 'NetworkGroup', + 'NetworkGroupListResult', + 'NetworkManager', + 'NetworkManagerCommit', + 'NetworkManagerDeploymentStatus', + 'NetworkManagerDeploymentStatusListResult', + 'NetworkManagerDeploymentStatusParameter', + 'NetworkManagerEffectiveConnectivityConfigurationListResult', + 'NetworkManagerEffectiveSecurityAdminRulesListResult', + 'NetworkManagerListResult', + 'NetworkManagerPropertiesNetworkManagerScopes', + 'NetworkManagerSecurityGroupItem', + 'NetworkSecurityPerimeter', + 'NetworkSecurityPerimeterListResult', + 'PerimeterAssociableResource', + 'PerimeterAssociableResourcesListResult', + 'ProxyResource', + 'QueryRequestOptions', + 'Resource', + 'RuleCollection', + 'RuleCollectionListResult', + 'SecurityConfiguration', + 'SecurityConfigurationListResult', + 'SystemData', + 'TagsObject', + 'UserRule', + 'UserRuleListResult', + 'AddressPrefixType', + 'AdminRuleKind', + 'ConfigurationType', + 'ConnectivityTopology', + 'CreatedByType', + 'DeleteExistingNSGs', + 'DeleteExistingPeering', + 'DeploymentStatus', + 'EffectiveAdminRuleKind', + 'EffectiveUserRuleKind', + 'GroupConnectivity', + 'IsGlobal', + 'MembershipType', + 'ProvisioningState', + '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 new file mode 100644 index 00000000000..f48bb0f58ba --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py @@ -0,0 +1,2959 @@ +# 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 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_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 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. + :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 = { + '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'}, + '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'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + 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.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 + self.delete_existing_peering = kwargs.get('delete_existing_peering', None) + + +class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): + """Active 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_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 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. + :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 = { + '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'}, + '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'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveConnectivityConfiguration, self).__init__(**kwargs) + self.commit_time = kwargs.get('commit_time', None) + self.region = kwargs.get('region', None) + + +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 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': '[ActiveConnectivityConfiguration]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveConnectivityConfigurationsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', 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): + """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_01_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 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. + :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 + :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 = { + 'id': {'readonly': True}, + '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}, + } + + _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'}, + '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(AdminRule, 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 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_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': '[BaseAdminRule]'}, + '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 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. + + :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 = { + '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(BaseUserRule, self).__init__(**kwargs) + self.kind = 'BaseUserRule' # type: str + self.system_data = 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_01_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 ConfigurationGroup(msrest.serialization.Model): + """The network configuration group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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. + :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. + :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 = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + '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(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): + """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_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: + "HubAndSpoke", "Mesh". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology + :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. + :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 = { + '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'}, + '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'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, + } + + 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.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 + 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_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, + **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. 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, + **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 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, + **kwargs + ): + 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 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, + **kwargs + ): + 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 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, + **kwargs + ): + 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 EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """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 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'}, + '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(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 EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """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 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'}, + '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(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 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_01_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_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]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.skip_token = kwargs.get('skip_token', None) + + +class EffectiveVirtualNetworksParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. + + :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, + **kwargs + ): + super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) + self.conditional_members = kwargs.get('conditional_members', None) + self.skip_token = kwargs.get('skip_token', 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 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): + """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_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. + :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. + :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 = { + '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_01_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_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_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes + :param network_manager_scope_accesses: Scope Access. + :type network_manager_scope_accesses: list[str or + ~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_01_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. + + 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: "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'}, + } + + def __init__( + self, + **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) + + +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_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: + "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 + """ + + _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_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]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.skip_token = kwargs.get('skip_token', 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 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, + **kwargs + ): + 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 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 = { + 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkManagerEffectiveConnectivityConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', 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_01_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 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 NetworkSecurityPerimeter(Resource): + """The Network Security Perimeter 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 + :param display_name: A friendly name for the network security perimeter. + :type display_name: str + :param description: A description of the network security perimeter. + :type description: 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 = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'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'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkSecurityPerimeter, self).__init__(**kwargs) + self.etag = None + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.provisioning_state = None + + +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 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 = { + 'value': {'key': 'value', 'type': '[NetworkSecurityPerimeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkSecurityPerimeterListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PerimeterAssociableResource(Resource): + """Resource that is onboarded to use network security perimeter. Also referred as perimeter associable 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 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': '[PerimeterAssociableResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PerimeterAssociableResourcesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class QueryRequestOptions(msrest.serialization.Model): + """Query Request Options. + + :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 = { + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + 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 RuleCollectionListResult(msrest.serialization.Model): + """Security configuration rule collection list result. + + :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': '[RuleCollection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleCollectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', 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_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(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): + """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_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_01_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'}, + # 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': 'str'}, + } + + 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(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. + :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 + :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 = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': 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'}, + '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'}, + '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(UserRule, 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 UserRuleListResult(msrest.serialization.Model): + """security user rule list result. + + :param value: A list of user rules. + :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': '[BaseUserRule]'}, + '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..69cfb576374 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py @@ -0,0 +1,3284 @@ +# 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 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_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 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. + :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 = { + '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'}, + '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'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, + } + + def __init__( + self, + *, + 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, + 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, + **kwargs + ): + 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.hubs = hubs + self.is_global = is_global + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + self.delete_existing_peering = delete_existing_peering + + +class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): + """Active 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_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 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. + :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 = { + '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'}, + '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'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, + 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + *, + 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, + 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, + commit_time: Optional[datetime.datetime] = None, + 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, 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 + + +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 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': '[ActiveConnectivityConfiguration]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ActiveConnectivityConfiguration"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(ActiveConnectivityConfigurationsListResult, self).__init__(**kwargs) + self.value = value + 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): + """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_01_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 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. + :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 + :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 = { + 'id': {'readonly': True}, + '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}, + } + + _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'}, + '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, + *, + 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(AdminRule, self).__init__(**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 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_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': '[BaseAdminRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BaseAdminRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AdminRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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. + + :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 = { + '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(BaseUserRule, self).__init__(**kwargs) + self.kind = 'BaseUserRule' # type: str + self.system_data = 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_01_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 ConfigurationGroup(msrest.serialization.Model): + """The network configuration group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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. + :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. + :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 = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + '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[str] = None, + group_members: Optional[List["GroupMembersItem"]] = None, + conditional_membership: Optional[str] = None, + **kwargs + ): + 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): + """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_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: + "HubAndSpoke", "Mesh". + :type connectivity_topology: str or + ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology + :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. + :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 = { + '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'}, + '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'}, + 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "ConnectivityTopology"]] = 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, + **kwargs + ): + super(ConnectivityConfiguration, self).__init__(**kwargs) + self.system_data = None + self.display_name = display_name + self.description = description + self.connectivity_topology = connectivity_topology + self.hubs = hubs + 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_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. + + 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 = { + '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, + *, + 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(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 EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): + """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 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'}, + '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, + 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(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): + """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_01_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_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]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EffectiveVirtualNetwork"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class EffectiveVirtualNetworksParameter(msrest.serialization.Model): + """Effective Virtual Networks Parameter. + + :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 + self.skip_token = skip_token + + +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 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): + """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_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. + :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. + :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 = { + '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[str] = 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_01_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_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_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes + :param network_manager_scope_accesses: Scope Access. + :type network_manager_scope_accesses: list[str or + ~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_01_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, "ConfigurationType"]]] = 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. + + 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: "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'}, + } + + def __init__( + self, + *, + target_locations: Optional[List[str]] = None, + configuration_ids: Optional[List[str]] = 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 + + +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_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: + "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 + """ + + _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, "ConfigurationType"]] = 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_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]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkManagerDeploymentStatus"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) + self.value = value + 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 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 = { + 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EffectiveConnectivityConfiguration"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(NetworkManagerEffectiveConnectivityConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +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, + *, + value: Optional[List["EffectiveBaseSecurityAdminRule"]] = None, + skip_token: Optional[str] = None, + **kwargs + ): + super(NetworkManagerEffectiveSecurityAdminRulesListResult, self).__init__(**kwargs) + self.value = value + 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_01_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 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 NetworkSecurityPerimeter(Resource): + """The Network Security Perimeter 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 + :param display_name: A friendly name for the network security perimeter. + :type display_name: str + :param description: A description of the network security perimeter. + :type description: 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 = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'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'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', '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, + **kwargs + ): + super(NetworkSecurityPerimeter, self).__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.display_name = display_name + self.description = description + self.provisioning_state = None + + +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 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 = { + 'value': {'key': 'value', 'type': '[NetworkSecurityPerimeter]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkSecurityPerimeter"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkSecurityPerimeterListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PerimeterAssociableResource(Resource): + """Resource that is onboarded to use network security perimeter. Also referred as perimeter associable 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 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': '[PerimeterAssociableResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PerimeterAssociableResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PerimeterAssociableResourcesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class QueryRequestOptions(msrest.serialization.Model): + """Query Request Options. + + :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 = { + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + skip_token: Optional[str] = None, + **kwargs + ): + 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 RuleCollectionListResult(msrest.serialization.Model): + """Security configuration rule collection list result. + + :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': '[RuleCollection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["RuleCollection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(RuleCollectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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_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, + *, + 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(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): + """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_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_01_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'}, + # 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': 'str'}, + } + + 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(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. + :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 + :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 = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'kind': {'required': 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'}, + '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'}, + '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, + *, + 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(UserRule, self).__init__(**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 UserRuleListResult(msrest.serialization.Model): + """security user rule list result. + + :param value: A list of user rules. + :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': '[BaseUserRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BaseUserRule"]] = 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..b0161e3803d --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py @@ -0,0 +1,180 @@ +# 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 AddressPrefixType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Address prefix type. + """ + + IP_PREFIX = "IPPrefix" + SERVICE_TAG = "ServiceTag" + +class AdminRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. + """ + + CUSTOM = "Custom" + DEFAULT = "Default" + +class ConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Configuration Deployment Type. + """ + + SECURITY_ADMIN = "SecurityAdmin" + SECURITY_USER = "SecurityUser" + CONNECTIVITY = "Connectivity" + +class ConnectivityTopology(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Connectivity topology type. + """ + + HUB_AND_SPOKE = "HubAndSpoke" + MESH = "Mesh" + +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 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. + """ + + NOT_STARTED = "NotStarted" + DEPLOYING = "Deploying" + DEPLOYED = "Deployed" + FAILED = "Failed" + +class EffectiveAdminRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. + """ + + CUSTOM = "Custom" + DEFAULT = "Default" + +class EffectiveUserRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the rule is custom or default. + """ + + CUSTOM = "Custom" + DEFAULT = "Default" + +class GroupConnectivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Group connectivity type. + """ + + NONE = "None" + DIRECTLY_CONNECTED = "DirectlyConnected" + +class IsGlobal(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag if global mesh is supported. + """ + + FALSE = "False" + TRUE = "True" + +class MembershipType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Membership Type. + """ + + STATIC = "Static" + DYNAMIC = "Dynamic" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + +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" + +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 new file mode 100644 index 00000000000..e3ab4d13aca --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py @@ -0,0 +1,49 @@ +# 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_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_connectivity_configurations_operations import EffectiveConnectivityConfigurationsOperations +from ._network_manager_effective_security_admin_rules_operations import NetworkManagerEffectiveSecurityAdminRulesOperations +from ._network_groups_operations import NetworkGroupsOperations +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', + 'ActiveConnectivityConfigurationsOperations', + 'ActiveSecurityAdminRulesOperations', + 'ActiveSecurityUserRulesOperations', + 'ConnectivityConfigurationsOperations', + 'EffectiveConnectivityConfigurationsOperations', + 'NetworkManagerEffectiveSecurityAdminRulesOperations', + 'NetworkGroupsOperations', + 'SecurityUserConfigurationsOperations', + 'UserRuleCollectionsOperations', + 'UserRulesOperations', + 'SecurityAdminConfigurationsOperations', + 'AdminRuleCollectionsOperations', + 'AdminRulesOperations', + 'NetworkSecurityPerimetersOperations', + 'PerimeterAssociableResourceTypesOperations', +] 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 new file mode 100644 index 00000000000..a0d26b49613 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py @@ -0,0 +1,368 @@ +# 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_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 + rule_collection_name, # type: str + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AdminRuleListResult"] + """List all network manager security configuration admin 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 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 + :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_01_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'), + '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') + 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}/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.BaseAdminRule" + """Gets 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 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: 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.BaseAdminRule"] + 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'), + '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('BaseAdminRule', 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}/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.BaseAdminRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.BaseAdminRule" + """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_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_01_preview.models.BaseAdminRule + :keyword callable cls: A custom type or function that will be passed the direct response + :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.BaseAdminRule"] + 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'), + '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, '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) + 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('BaseAdminRule', pipeline_response) + + if response.status_code == 201: + 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}/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 + ): + # 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_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: 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'), + '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}/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 new file mode 100644 index 00000000000..64f3fec527a --- /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_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, + 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_01_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_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_01_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_01_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_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 new file mode 100644 index 00000000000..6d438d76538 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py @@ -0,0 +1,196 @@ +# 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 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_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_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] + **kwargs # type: Any + ): + # type: (...) -> "_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 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 + :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: 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"] + 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_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] + 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) + 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( + self, + resource_group_name, # type: str + network_manager_name, # type: str + network_group_name, # type: str + parameters, # type: "_models.QueryRequestOptions" + **kwargs # type: Any + ): + # type: (...) -> "_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 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: 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"] + 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_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 new file mode 100644 index 00000000000..7a079d7d3a6 --- /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_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, + 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_01_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_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_01_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_01_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..1c68982adfe --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_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 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_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 post( + self, + resource_group_name, # type: str + network_manager_name, # type: str + parameters, # type: "_models.NetworkManagerCommit" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkManagerCommit" + """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_01_preview.models.NetworkManagerCommit + :keyword callable cls: A custom type or function that will be passed the direct response + :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["_models.NetworkManagerCommit"] + 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 [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, 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 new file mode 100644 index 00000000000..76556a8b989 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_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 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_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.NetworkManagerDeploymentStatusParameter" + **kwargs # type: Any + ): + # 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_01_preview.models.NetworkManagerDeploymentStatusParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :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"] + 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, '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 new file mode 100644 index 00000000000..0174d552e5f --- /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_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, + 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_01_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_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_01_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_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_01_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_01_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_01_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/_network_security_perimeters_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py new file mode 100644 index 00000000000..5a3be1c8dea --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py @@ -0,0 +1,396 @@ +# 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 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_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, + resource_group_name, # type: str + network_security_perimeter_name, # type: str + **kwargs # type: Any + ): + # 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_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: 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.NetworkSecurityPerimeter"] + 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'), + '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.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('NetworkSecurityPerimeter', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + network_security_perimeter_name, # type: str + parameters, # type: "_models.NetworkSecurityPerimeter" + **kwargs # type: Any + ): + # 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_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: 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.NetworkSecurityPerimeter"] + 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'), + '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['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, 'NetworkSecurityPerimeter') + 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('NetworkSecurityPerimeter', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + network_security_perimeter_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a network security perimeter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: 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: 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 + :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 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.NetworkSecurityPerimeterListResult"] + 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('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) + + 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/networkSecurityPerimeters'} # 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.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 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 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.NetworkSecurityPerimeterListResult"] + 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('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) + + 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/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 new file mode 100644 index 00000000000..8d787a37c8e --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py @@ -0,0 +1,368 @@ +# 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_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 + 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 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 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_01_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'), + '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') + 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}/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.BaseUserRule" + """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_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: 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.BaseUserRule"] + 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'), + '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('BaseUserRule', 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}/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.BaseUserRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.BaseUserRule" + """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_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_01_preview.models.BaseUserRule + :keyword callable cls: A custom type or function that will be passed the direct response + :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.BaseUserRule"] + 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'), + '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, '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) + 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('BaseUserRule', pipeline_response) + + if response.status_code == 201: + 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}/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 + ): + # 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_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: 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'), + '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}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{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']}, +)