From 339f4f2d2aa4016aa53d4cc7faac1264634138e2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 9 Jun 2023 02:13:12 +0000 Subject: [PATCH] CodeGen from PR 24254 in Azure/azure-rest-api-specs Merging the ManagedNetworkFabric changes in RPSaaSMaster into main (#24254) * Merging the RPSaaSMaster PRs into main 1. https://github.com/Azure/azure-rest-api-specs-pr/pull/11537 2. https://github.com/Azure/azure-rest-api-specs-pr/pull/11749 3. https://github.com/Azure/azure-rest-api-specs-pr/pull/12117 * updating swagger-to-sdk in readme.md * Minor changes - to resolve the dotnet and python sdk issues * minor change to resolve the dotnet sdk issue * solved sdk issue having incompatible type for optionB description. * Resolving the Duplicated model name with non-identical definitions issue. --- .../CHANGELOG.md | 5 + .../azure-mgmt-managednetworkfabric/LICENSE | 21 + .../MANIFEST.in | 8 + .../azure-mgmt-managednetworkfabric/README.md | 64 + .../_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/managednetworkfabric/__init__.py | 26 + ...e_network_fabric_management_service_api.py | 201 + .../managednetworkfabric/_configuration.py | 68 + .../azure/mgmt/managednetworkfabric/_patch.py | 20 + .../managednetworkfabric/_serialization.py | 1996 ++++ .../mgmt/managednetworkfabric/_vendor.py | 30 + .../mgmt/managednetworkfabric/_version.py | 9 + .../mgmt/managednetworkfabric/aio/__init__.py | 23 + ...e_network_fabric_management_service_api.py | 203 + .../aio/_configuration.py | 68 + .../mgmt/managednetworkfabric/aio/_patch.py | 20 + .../aio/operations/__init__.py | 55 + .../_access_control_lists_operations.py | 667 ++ .../_external_networks_operations.py | 2035 ++++ .../_internal_networks_operations.py | 2272 +++++ .../operations/_ip_communities_operations.py | 890 ++ .../_ip_extended_communities_operations.py | 916 ++ .../aio/operations/_ip_prefixes_operations.py | 888 ++ .../_l2_isolation_domains_operations.py | 1715 ++++ .../_l3_isolation_domains_operations.py | 1812 ++++ .../_network_device_skus_operations.py | 201 + .../operations/_network_devices_operations.py | 2122 ++++ .../_network_fabric_controllers_operations.py | 1153 +++ .../_network_fabric_skus_operations.py | 201 + .../operations/_network_fabrics_operations.py | 1144 +++ .../_network_interfaces_operations.py | 1224 +++ .../_network_rack_skus_operations.py | 201 + .../operations/_network_racks_operations.py | 879 ++ ...ork_to_network_interconnects_operations.py | 617 ++ .../aio/operations/_operations.py | 134 + .../aio/operations/_patch.py | 20 + .../operations/_route_policies_operations.py | 879 ++ .../managednetworkfabric/models/__init__.py | 407 + ...ork_fabric_management_service_api_enums.py | 289 + .../models/_models_py3.py | 8762 +++++++++++++++++ .../managednetworkfabric/models/_patch.py | 20 + .../operations/__init__.py | 55 + .../_access_control_lists_operations.py | 850 ++ .../_external_networks_operations.py | 2413 +++++ .../_internal_networks_operations.py | 2690 +++++ .../operations/_ip_communities_operations.py | 1074 ++ .../_ip_extended_communities_operations.py | 1102 +++ .../operations/_ip_prefixes_operations.py | 1068 ++ .../_l2_isolation_domains_operations.py | 2032 ++++ .../_l3_isolation_domains_operations.py | 2132 ++++ .../_network_device_skus_operations.py | 256 + .../operations/_network_devices_operations.py | 2560 +++++ .../_network_fabric_controllers_operations.py | 1418 +++ .../_network_fabric_skus_operations.py | 256 + .../operations/_network_fabrics_operations.py | 1382 +++ .../_network_interfaces_operations.py | 1454 +++ .../_network_rack_skus_operations.py | 256 + .../operations/_network_racks_operations.py | 1063 ++ ...ork_to_network_interconnects_operations.py | 769 ++ .../operations/_operations.py | 155 + .../managednetworkfabric/operations/_patch.py | 20 + .../operations/_route_policies_operations.py | 1063 ++ .../azure/mgmt/managednetworkfabric/py.typed | 1 + ...ss_control_lists_create_minimum_set_gen.py | 58 + ...ss_control_lists_delete_minimum_set_gen.py | 40 + ...ccess_control_lists_get_minimum_set_gen.py | 41 + ..._list_by_resource_group_minimum_set_gen.py | 41 + ...ts_list_by_subscription_minimum_set_gen.py | 39 + ...ss_control_lists_update_minimum_set_gen.py | 57 + ...works_clear_arp_entries_maximum_set_gen.py | 46 + ...ks_clear_ipv6_neighbors_maximum_set_gen.py | 46 + ...xternal_networks_create_maximum_set_gen.py | 60 + ...xternal_networks_delete_maximum_set_gen.py | 41 + .../external_networks_get_maximum_set_gen.py | 42 + .../external_networks_list_maximum_set_gen.py | 42 + ...te_administrative_state_maximum_set_gen.py | 47 + ...gp_administrative_state_maximum_set_gen.py | 47 + ...gp_administrative_state_maximum_set_gen.py | 47 + ...xternal_networks_update_maximum_set_gen.py | 61 + ...works_clear_arp_entries_maximum_set_gen.py | 46 + ...ks_clear_ipv6_neighbors_maximum_set_gen.py | 46 + ...nternal_networks_create_maximum_set_gen.py | 68 + ...nternal_networks_delete_maximum_set_gen.py | 41 + .../internal_networks_get_maximum_set_gen.py | 42 + .../internal_networks_list_maximum_set_gen.py | 42 + ...te_administrative_state_maximum_set_gen.py | 47 + ...gp_administrative_state_maximum_set_gen.py | 47 + ...te_administrative_state_maximum_set_gen.py | 47 + ...gp_administrative_state_maximum_set_gen.py | 47 + ...nternal_networks_update_maximum_set_gen.py | 67 + .../ip_communities_create_maximum_set_gen.py | 51 + .../ip_communities_delete_maximum_set_gen.py | 40 + .../ip_communities_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...es_list_by_subscription_maximum_set_gen.py | 39 + .../ip_communities_update_maximum_set_gen.py | 42 + ...nded_communities_create_maximum_set_gen.py | 46 + ...nded_communities_delete_maximum_set_gen.py | 40 + ...xtended_communities_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...es_list_by_subscription_maximum_set_gen.py | 39 + ...nded_communities_update_maximum_set_gen.py | 42 + .../ip_prefixes_create_maximum_set_gen.py | 57 + .../ip_prefixes_delete_maximum_set_gen.py | 40 + .../ip_prefixes_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...es_list_by_subscription_maximum_set_gen.py | 39 + .../ip_prefixes_update_maximum_set_gen.py | 42 + ...domains_clear_arp_table_maximum_set_gen.py | 45 + ...ns_clear_neighbor_table_maximum_set_gen.py | 45 + ...solation_domains_create_maximum_set_gen.py | 49 + ...solation_domains_delete_maximum_set_gen.py | 40 + ...domains_get_arp_entries_maximum_set_gen.py | 41 + ...2_isolation_domains_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...ns_list_by_subscription_maximum_set_gen.py | 39 + ...te_administrative_state_maximum_set_gen.py | 46 + ...solation_domains_update_maximum_set_gen.py | 42 + ...domains_clear_arp_table_maximum_set_gen.py | 45 + ...ns_clear_neighbor_table_maximum_set_gen.py | 41 + ...solation_domains_create_maximum_set_gen.py | 57 + ...solation_domains_delete_maximum_set_gen.py | 40 + ...3_isolation_domains_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...ns_list_by_subscription_maximum_set_gen.py | 39 + ...te_administrative_state_maximum_set_gen.py | 46 + ...solation_domains_update_maximum_set_gen.py | 55 + ...n_badministrative_state_maximum_set_gen.py | 46 + .../generated_samples/list_operations.py | 39 + ...network_device_skus_get_maximum_set_gen.py | 40 + ...us_list_by_subscription_maximum_set_gen.py | 39 + .../network_devices_create_maximum_set_gen.py | 52 + .../network_devices_delete_maximum_set_gen.py | 40 + ...enerate_support_package_maximum_set_gen.py | 41 + ..._dynamic_interface_maps_maximum_set_gen.py | 41 + .../network_devices_get_maximum_set_gen.py | 41 + ...t_static_interface_maps_maximum_set_gen.py | 41 + ...work_devices_get_status_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...es_list_by_subscription_maximum_set_gen.py | 39 + .../network_devices_reboot_maximum_set_gen.py | 40 + ..._devices_restore_config_maximum_set_gen.py | 40 + .../network_devices_update_maximum_set_gen.py | 49 + ...ices_update_power_cycle_maximum_set_gen.py | 41 + ..._devices_update_version_maximum_set_gen.py | 41 + ...bric_controllers_create_maximum_set_gen.py | 61 + ...bric_controllers_delete_maximum_set_gen.py | 40 + ...load_management_network_maximum_set_gen.py | 40 + ...load_management_network_maximum_set_gen.py | 40 + ..._fabric_controllers_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...rs_list_by_subscription_maximum_set_gen.py | 39 + ...bric_controllers_update_maximum_set_gen.py | 51 + ...network_fabric_skus_get_maximum_set_gen.py | 40 + ...us_list_by_subscription_maximum_set_gen.py | 39 + .../network_fabrics_create_maximum_set_gen.py | 98 + .../network_fabrics_delete_maximum_set_gen.py | 40 + ...ork_fabrics_deprovision_maximum_set_gen.py | 40 + .../network_fabrics_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...cs_list_by_subscription_maximum_set_gen.py | 39 + ...twork_fabrics_provision_maximum_set_gen.py | 40 + .../network_fabrics_update_maximum_set_gen.py | 52 + ...twork_interfaces_create_maximum_set_gen.py | 43 + ...twork_interfaces_delete_maximum_set_gen.py | 41 + .../network_interfaces_get_maximum_set_gen.py | 42 + ...k_interfaces_get_status_maximum_set_gen.py | 42 + ...network_interfaces_list_maximum_set_gen.py | 42 + ...te_administrative_state_maximum_set_gen.py | 42 + ...twork_interfaces_update_maximum_set_gen.py | 43 + .../network_rack_skus_get_maximum_set_gen.py | 40 + ...us_list_by_subscription_maximum_set_gen.py | 39 + .../network_racks_create_maximum_set_gen.py | 50 + .../network_racks_delete_maximum_set_gen.py | 40 + .../network_racks_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...ks_list_by_subscription_maximum_set_gen.py | 39 + .../network_racks_update_maximum_set_gen.py | 42 + ...rk_interconnects_create_maximum_set_gen.py | 60 + ...rk_interconnects_delete_maximum_set_gen.py | 41 + ...twork_interconnects_get_maximum_set_gen.py | 42 + ...work_interconnects_list_maximum_set_gen.py | 42 + .../route_policies_create_maximum_set_gen.py | 101 + .../route_policies_delete_maximum_set_gen.py | 40 + .../route_policies_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...es_list_by_subscription_maximum_set_gen.py | 39 + .../route_policies_update_maximum_set_gen.py | 42 + .../sdk_packaging.toml | 10 + .../azure-mgmt-managednetworkfabric/setup.py | 83 + sdk/managednetworkfabric/ci.yml | 34 + 193 files changed, 62057 insertions(+) create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/CHANGELOG.md create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/LICENSE create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/MANIFEST.in create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/README.md create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/_meta.json create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_azure_network_fabric_management_service_api.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_configuration.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_patch.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_serialization.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_vendor.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_version.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_azure_network_fabric_management_service_api.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_configuration.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_patch.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_access_control_lists_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_external_networks_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_internal_networks_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_communities_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_extended_communities_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_prefixes_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l2_isolation_domains_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l3_isolation_domains_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_device_skus_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_devices_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_controllers_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_skus_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabrics_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_interfaces_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_rack_skus_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_racks_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_to_network_interconnects_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_patch.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_route_policies_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_azure_network_fabric_management_service_api_enums.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_models_py3.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_patch.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/__init__.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_access_control_lists_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_external_networks_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_internal_networks_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_communities_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_extended_communities_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_prefixes_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l2_isolation_domains_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l3_isolation_domains_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_device_skus_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_devices_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_controllers_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_skus_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabrics_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_interfaces_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_rack_skus_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_racks_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_to_network_interconnects_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_patch.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_route_policies_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/py.typed create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_create_minimum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_delete_minimum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_get_minimum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_resource_group_minimum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_subscription_minimum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_update_minimum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_arp_entries_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_ipv6_neighbors_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_list_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bgp_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_arp_entries_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_ipv6_neighbors_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_list_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_static_route_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bgp_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_arp_table_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_neighbor_table_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_arp_entries_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_arp_table_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_neighbor_table_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_option_badministrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/list_operations.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_generate_support_package_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_dynamic_interface_maps_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_static_interface_maps_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_status_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_reboot_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_restore_config_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_power_cycle_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_version_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_disable_workload_management_network_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_enable_workload_management_network_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_deprovision_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_provision_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_status_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_list_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_administrative_state_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_list_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_create_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_delete_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_get_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_update_maximum_set_gen.py create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/sdk_packaging.toml create mode 100644 sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/setup.py create mode 100644 sdk/managednetworkfabric/ci.yml diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/CHANGELOG.md b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/LICENSE b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/MANIFEST.in b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/MANIFEST.in new file mode 100644 index 000000000000..456e86373690 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/managednetworkfabric/py.typed diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/README.md b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/README.md new file mode 100644 index 000000000000..ef7dbe3318f4 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/README.md @@ -0,0 +1,64 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.7+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-managednetworkfabric +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-managednetworkfabric%2FREADME.png) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/_meta.json b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/_meta.json new file mode 100644 index 000000000000..0f6f542cd480 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "cf7d994e28e2584ea1b5cb60a82b603275fd4d07", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", + "use": [ + "@autorest/python@6.5.0", + "@autorest/modelerfour@4.24.3" + ], + "autorest_command": "autorest specification/managednetworkfabric/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.5.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "readme": "specification/managednetworkfabric/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/__init__.py new file mode 100644 index 000000000000..51eb476cd40c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/__init__.py @@ -0,0 +1,26 @@ +# 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 ._azure_network_fabric_management_service_api import AzureNetworkFabricManagementServiceAPI +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureNetworkFabricManagementServiceAPI", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_azure_network_fabric_management_service_api.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_azure_network_fabric_management_service_api.py new file mode 100644 index 000000000000..eb2f0e8016f1 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_azure_network_fabric_management_service_api.py @@ -0,0 +1,201 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import AzureNetworkFabricManagementServiceAPIConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + AccessControlListsOperations, + ExternalNetworksOperations, + InternalNetworksOperations, + IpCommunitiesOperations, + IpExtendedCommunitiesOperations, + IpPrefixesOperations, + L2IsolationDomainsOperations, + L3IsolationDomainsOperations, + NetworkDeviceSkusOperations, + NetworkDevicesOperations, + NetworkFabricControllersOperations, + NetworkFabricSkusOperations, + NetworkFabricsOperations, + NetworkInterfacesOperations, + NetworkRackSkusOperations, + NetworkRacksOperations, + NetworkToNetworkInterconnectsOperations, + Operations, + RoutePoliciesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AzureNetworkFabricManagementServiceAPI: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Self service experience for Azure Network Fabric API. + + :ivar access_control_lists: AccessControlListsOperations operations + :vartype access_control_lists: + azure.mgmt.managednetworkfabric.operations.AccessControlListsOperations + :ivar ip_communities: IpCommunitiesOperations operations + :vartype ip_communities: azure.mgmt.managednetworkfabric.operations.IpCommunitiesOperations + :ivar ip_extended_communities: IpExtendedCommunitiesOperations operations + :vartype ip_extended_communities: + azure.mgmt.managednetworkfabric.operations.IpExtendedCommunitiesOperations + :ivar ip_prefixes: IpPrefixesOperations operations + :vartype ip_prefixes: azure.mgmt.managednetworkfabric.operations.IpPrefixesOperations + :ivar l2_isolation_domains: L2IsolationDomainsOperations operations + :vartype l2_isolation_domains: + azure.mgmt.managednetworkfabric.operations.L2IsolationDomainsOperations + :ivar l3_isolation_domains: L3IsolationDomainsOperations operations + :vartype l3_isolation_domains: + azure.mgmt.managednetworkfabric.operations.L3IsolationDomainsOperations + :ivar internal_networks: InternalNetworksOperations operations + :vartype internal_networks: + azure.mgmt.managednetworkfabric.operations.InternalNetworksOperations + :ivar external_networks: ExternalNetworksOperations operations + :vartype external_networks: + azure.mgmt.managednetworkfabric.operations.ExternalNetworksOperations + :ivar network_device_skus: NetworkDeviceSkusOperations operations + :vartype network_device_skus: + azure.mgmt.managednetworkfabric.operations.NetworkDeviceSkusOperations + :ivar network_devices: NetworkDevicesOperations operations + :vartype network_devices: azure.mgmt.managednetworkfabric.operations.NetworkDevicesOperations + :ivar network_interfaces: NetworkInterfacesOperations operations + :vartype network_interfaces: + azure.mgmt.managednetworkfabric.operations.NetworkInterfacesOperations + :ivar network_fabric_controllers: NetworkFabricControllersOperations operations + :vartype network_fabric_controllers: + azure.mgmt.managednetworkfabric.operations.NetworkFabricControllersOperations + :ivar network_fabric_skus: NetworkFabricSkusOperations operations + :vartype network_fabric_skus: + azure.mgmt.managednetworkfabric.operations.NetworkFabricSkusOperations + :ivar network_fabrics: NetworkFabricsOperations operations + :vartype network_fabrics: azure.mgmt.managednetworkfabric.operations.NetworkFabricsOperations + :ivar network_to_network_interconnects: NetworkToNetworkInterconnectsOperations operations + :vartype network_to_network_interconnects: + azure.mgmt.managednetworkfabric.operations.NetworkToNetworkInterconnectsOperations + :ivar network_rack_skus: NetworkRackSkusOperations operations + :vartype network_rack_skus: + azure.mgmt.managednetworkfabric.operations.NetworkRackSkusOperations + :ivar network_racks: NetworkRacksOperations operations + :vartype network_racks: azure.mgmt.managednetworkfabric.operations.NetworkRacksOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.managednetworkfabric.operations.Operations + :ivar route_policies: RoutePoliciesOperations operations + :vartype route_policies: azure.mgmt.managednetworkfabric.operations.RoutePoliciesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureNetworkFabricManagementServiceAPIConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.access_control_lists = AccessControlListsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ip_communities = IpCommunitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.ip_extended_communities = IpExtendedCommunitiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ip_prefixes = IpPrefixesOperations(self._client, self._config, self._serialize, self._deserialize) + self.l2_isolation_domains = L2IsolationDomainsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.l3_isolation_domains = L3IsolationDomainsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.internal_networks = InternalNetworksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.external_networks = ExternalNetworksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_device_skus = NetworkDeviceSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_devices = NetworkDevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_interfaces = NetworkInterfacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_fabric_controllers = NetworkFabricControllersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_fabric_skus = NetworkFabricSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_fabrics = NetworkFabricsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_to_network_interconnects = NetworkToNetworkInterconnectsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_rack_skus = NetworkRackSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_racks = NetworkRacksOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.route_policies = RoutePoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "AzureNetworkFabricManagementServiceAPI": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_configuration.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_configuration.py new file mode 100644 index 000000000000..10e1ada5fdfa --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_configuration.py @@ -0,0 +1,68 @@ +# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AzureNetworkFabricManagementServiceAPIConfiguration( + Configuration +): # pylint: disable=too-many-instance-attributes + """Configuration for AzureNetworkFabricManagementServiceAPI. + + 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. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(AzureNetworkFabricManagementServiceAPIConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-02-01-preview") + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-managednetworkfabric/{}".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.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 = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_patch.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_serialization.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_serialization.py new file mode 100644 index 000000000000..842ae727fbbc --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_serialization.py @@ -0,0 +1,1996 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to azure from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_vendor.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_vendor.py new file mode 100644 index 000000000000..bd0df84f5319 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_vendor.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- +# 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 List, cast + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_version.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/_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/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/__init__.py new file mode 100644 index 000000000000..a6bd87c6101b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/__init__.py @@ -0,0 +1,23 @@ +# 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 ._azure_network_fabric_management_service_api import AzureNetworkFabricManagementServiceAPI + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureNetworkFabricManagementServiceAPI", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_azure_network_fabric_management_service_api.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_azure_network_fabric_management_service_api.py new file mode 100644 index 000000000000..77b1655ab141 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_azure_network_fabric_management_service_api.py @@ -0,0 +1,203 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import AzureNetworkFabricManagementServiceAPIConfiguration +from .operations import ( + AccessControlListsOperations, + ExternalNetworksOperations, + InternalNetworksOperations, + IpCommunitiesOperations, + IpExtendedCommunitiesOperations, + IpPrefixesOperations, + L2IsolationDomainsOperations, + L3IsolationDomainsOperations, + NetworkDeviceSkusOperations, + NetworkDevicesOperations, + NetworkFabricControllersOperations, + NetworkFabricSkusOperations, + NetworkFabricsOperations, + NetworkInterfacesOperations, + NetworkRackSkusOperations, + NetworkRacksOperations, + NetworkToNetworkInterconnectsOperations, + Operations, + RoutePoliciesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureNetworkFabricManagementServiceAPI: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Self service experience for Azure Network Fabric API. + + :ivar access_control_lists: AccessControlListsOperations operations + :vartype access_control_lists: + azure.mgmt.managednetworkfabric.aio.operations.AccessControlListsOperations + :ivar ip_communities: IpCommunitiesOperations operations + :vartype ip_communities: azure.mgmt.managednetworkfabric.aio.operations.IpCommunitiesOperations + :ivar ip_extended_communities: IpExtendedCommunitiesOperations operations + :vartype ip_extended_communities: + azure.mgmt.managednetworkfabric.aio.operations.IpExtendedCommunitiesOperations + :ivar ip_prefixes: IpPrefixesOperations operations + :vartype ip_prefixes: azure.mgmt.managednetworkfabric.aio.operations.IpPrefixesOperations + :ivar l2_isolation_domains: L2IsolationDomainsOperations operations + :vartype l2_isolation_domains: + azure.mgmt.managednetworkfabric.aio.operations.L2IsolationDomainsOperations + :ivar l3_isolation_domains: L3IsolationDomainsOperations operations + :vartype l3_isolation_domains: + azure.mgmt.managednetworkfabric.aio.operations.L3IsolationDomainsOperations + :ivar internal_networks: InternalNetworksOperations operations + :vartype internal_networks: + azure.mgmt.managednetworkfabric.aio.operations.InternalNetworksOperations + :ivar external_networks: ExternalNetworksOperations operations + :vartype external_networks: + azure.mgmt.managednetworkfabric.aio.operations.ExternalNetworksOperations + :ivar network_device_skus: NetworkDeviceSkusOperations operations + :vartype network_device_skus: + azure.mgmt.managednetworkfabric.aio.operations.NetworkDeviceSkusOperations + :ivar network_devices: NetworkDevicesOperations operations + :vartype network_devices: + azure.mgmt.managednetworkfabric.aio.operations.NetworkDevicesOperations + :ivar network_interfaces: NetworkInterfacesOperations operations + :vartype network_interfaces: + azure.mgmt.managednetworkfabric.aio.operations.NetworkInterfacesOperations + :ivar network_fabric_controllers: NetworkFabricControllersOperations operations + :vartype network_fabric_controllers: + azure.mgmt.managednetworkfabric.aio.operations.NetworkFabricControllersOperations + :ivar network_fabric_skus: NetworkFabricSkusOperations operations + :vartype network_fabric_skus: + azure.mgmt.managednetworkfabric.aio.operations.NetworkFabricSkusOperations + :ivar network_fabrics: NetworkFabricsOperations operations + :vartype network_fabrics: + azure.mgmt.managednetworkfabric.aio.operations.NetworkFabricsOperations + :ivar network_to_network_interconnects: NetworkToNetworkInterconnectsOperations operations + :vartype network_to_network_interconnects: + azure.mgmt.managednetworkfabric.aio.operations.NetworkToNetworkInterconnectsOperations + :ivar network_rack_skus: NetworkRackSkusOperations operations + :vartype network_rack_skus: + azure.mgmt.managednetworkfabric.aio.operations.NetworkRackSkusOperations + :ivar network_racks: NetworkRacksOperations operations + :vartype network_racks: azure.mgmt.managednetworkfabric.aio.operations.NetworkRacksOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.managednetworkfabric.aio.operations.Operations + :ivar route_policies: RoutePoliciesOperations operations + :vartype route_policies: azure.mgmt.managednetworkfabric.aio.operations.RoutePoliciesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureNetworkFabricManagementServiceAPIConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.access_control_lists = AccessControlListsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ip_communities = IpCommunitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.ip_extended_communities = IpExtendedCommunitiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ip_prefixes = IpPrefixesOperations(self._client, self._config, self._serialize, self._deserialize) + self.l2_isolation_domains = L2IsolationDomainsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.l3_isolation_domains = L3IsolationDomainsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.internal_networks = InternalNetworksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.external_networks = ExternalNetworksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_device_skus = NetworkDeviceSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_devices = NetworkDevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_interfaces = NetworkInterfacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_fabric_controllers = NetworkFabricControllersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_fabric_skus = NetworkFabricSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_fabrics = NetworkFabricsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_to_network_interconnects = NetworkToNetworkInterconnectsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_rack_skus = NetworkRackSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_racks = NetworkRacksOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.route_policies = RoutePoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureNetworkFabricManagementServiceAPI": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_configuration.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_configuration.py new file mode 100644 index 000000000000..bc454c3c322d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_configuration.py @@ -0,0 +1,68 @@ +# 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, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureNetworkFabricManagementServiceAPIConfiguration( + Configuration +): # pylint: disable=too-many-instance-attributes + """Configuration for AzureNetworkFabricManagementServiceAPI. + + 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. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(AzureNetworkFabricManagementServiceAPIConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-02-01-preview") + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-managednetworkfabric/{}".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 = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_patch.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/__init__.py new file mode 100644 index 000000000000..b9434cdbf195 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/__init__.py @@ -0,0 +1,55 @@ +# 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 ._access_control_lists_operations import AccessControlListsOperations +from ._ip_communities_operations import IpCommunitiesOperations +from ._ip_extended_communities_operations import IpExtendedCommunitiesOperations +from ._ip_prefixes_operations import IpPrefixesOperations +from ._l2_isolation_domains_operations import L2IsolationDomainsOperations +from ._l3_isolation_domains_operations import L3IsolationDomainsOperations +from ._internal_networks_operations import InternalNetworksOperations +from ._external_networks_operations import ExternalNetworksOperations +from ._network_device_skus_operations import NetworkDeviceSkusOperations +from ._network_devices_operations import NetworkDevicesOperations +from ._network_interfaces_operations import NetworkInterfacesOperations +from ._network_fabric_controllers_operations import NetworkFabricControllersOperations +from ._network_fabric_skus_operations import NetworkFabricSkusOperations +from ._network_fabrics_operations import NetworkFabricsOperations +from ._network_to_network_interconnects_operations import NetworkToNetworkInterconnectsOperations +from ._network_rack_skus_operations import NetworkRackSkusOperations +from ._network_racks_operations import NetworkRacksOperations +from ._operations import Operations +from ._route_policies_operations import RoutePoliciesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccessControlListsOperations", + "IpCommunitiesOperations", + "IpExtendedCommunitiesOperations", + "IpPrefixesOperations", + "L2IsolationDomainsOperations", + "L3IsolationDomainsOperations", + "InternalNetworksOperations", + "ExternalNetworksOperations", + "NetworkDeviceSkusOperations", + "NetworkDevicesOperations", + "NetworkInterfacesOperations", + "NetworkFabricControllersOperations", + "NetworkFabricSkusOperations", + "NetworkFabricsOperations", + "NetworkToNetworkInterconnectsOperations", + "NetworkRackSkusOperations", + "NetworkRacksOperations", + "Operations", + "RoutePoliciesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_access_control_lists_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_access_control_lists_operations.py new file mode 100644 index 000000000000..fcd0b3d57ebb --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_access_control_lists_operations.py @@ -0,0 +1,667 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._access_control_lists_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AccessControlListsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`access_control_lists` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create( + self, + resource_group_name: str, + access_control_list_name: str, + body: _models.AccessControlList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Create Access Control List. + + Implements Access Control List PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + access_control_list_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Create Access Control List. + + Implements Access Control List PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + access_control_list_name: str, + body: Union[_models.AccessControlList, IO], + **kwargs: Any + ) -> _models.AccessControlList: + """Create Access Control List. + + Implements Access Control List PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Request payload. Is either a AccessControlList type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessControlList] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AccessControlList") + + request = build_create_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessControlList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, access_control_list_name: str, **kwargs: Any + ) -> _models.AccessControlList: + """Gets a Access Control List. + + Implements Access Control List GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessControlList] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessControlList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @overload + async def update( + self, + resource_group_name: str, + access_control_list_name: str, + body: _models.AccessControlListPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Updates a Access Control List. + + API to update certain properties of the Access Control List resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Access Control List properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlListPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + access_control_list_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Updates a Access Control List. + + API to update certain properties of the Access Control List resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Access Control List properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + access_control_list_name: str, + body: Union[_models.AccessControlListPatch, IO], + **kwargs: Any + ) -> _models.AccessControlList: + """Updates a Access Control List. + + API to update certain properties of the Access Control List resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Access Control List properties to update. Is either a AccessControlListPatch type + or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlListPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessControlList] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AccessControlListPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessControlList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, access_control_list_name: str, **kwargs: Any + ) -> None: + """Deletes a Access Control List. + + Implements Access Control List DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AccessControlList"]: + """List AccessControlLists by resource group. + + Implements AccessControlLists list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccessControlList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.AccessControlList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessControlListsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AccessControlListsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AccessControlList"]: + """List AccessControlLists by subscription. + + Implements AccessControlLists list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccessControlList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.AccessControlList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessControlListsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AccessControlListsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_external_networks_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_external_networks_operations.py new file mode 100644 index 000000000000..b8c7436b7777 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_external_networks_operations.py @@ -0,0 +1,2035 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._external_networks_operations import ( + build_clear_arp_entries_request, + build_clear_ipv6_neighbors_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_administrative_state_request, + build_update_bfd_for_bgp_administrative_state_request, + build_update_bgp_administrative_state_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ExternalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`external_networks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetwork, IO], + **kwargs: Any + ) -> _models.ExternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ExternalNetwork") + + request = build_create_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.ExternalNetwork, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExternalNetwork]: + """Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external + services. + + Creates ExternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExternalNetwork]: + """Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external + services. + + Creates ExternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetwork, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExternalNetwork]: + """Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external + services. + + Creates ExternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a ExternalNetwork type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetwork or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, l3_isolation_domain_name: str, external_network_name: str, **kwargs: Any + ) -> _models.ExternalNetwork: + """Retrieves details of ExternalNetwork. + + Implements ExternalNetworks GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExternalNetwork or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.ExternalNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + async def _update_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetworkPatch, IO], + **kwargs: Any + ) -> _models.ExternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ExternalNetworkPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.ExternalNetworkPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExternalNetwork]: + """Updates a ExternalNetworks. + + API to update certain properties of the ExternalNetworks resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: ExternalNetwork properties to update. Only annotations are supported. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExternalNetwork]: + """Updates a ExternalNetworks. + + API to update certain properties of the ExternalNetworks resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: ExternalNetwork properties to update. Only annotations are supported. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetworkPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExternalNetwork]: + """Updates a ExternalNetworks. + + API to update certain properties of the ExternalNetworks resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: ExternalNetwork properties to update. Only annotations are supported. Is either a + ExternalNetworkPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l3_isolation_domain_name: str, external_network_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, l3_isolation_domain_name: str, external_network_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a ExternalNetworks. + + Implements ExternalNetworks DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExternalNetwork"]: + """Executes list operation to display External Networks within an isolation domain. + + Implements External Networks list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExternalNetwork or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExternalNetworksList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExternalNetworksList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks" + } + + async def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateAdministrativeState" + } + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Executes update operation to enable or disable administrative State for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Executes update operation to enable or disable administrative State for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Executes update operation to enable or disable administrative State for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateAdministrativeState" + } + + async def _update_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBgpAdministrativeState" + } + + @overload + async def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes BGP state update operation to the underlying resources. + + Update BGP for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes BGP state update operation to the underlying resources. + + Update BGP for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes BGP state update operation to the underlying resources. + + Update BGP for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBgpAdministrativeState" + } + + async def _update_bfd_for_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bfd_for_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bfd_for_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bfd_for_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBfdForBgpAdministrativeState" + } + + @overload + async def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Execute BfdForBgp update operation to the underlying resources. + + Update BfdForBgp for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Execute BfdForBgp update operation to the underlying resources. + + Update BfdForBgp for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Execute BfdForBgp update operation to the underlying resources. + + Update BfdForBgp for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_bfd_for_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bfd_for_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBfdForBgpAdministrativeState" + } + + async def _clear_ipv6_neighbors_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_ipv6_neighbors_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_ipv6_neighbors_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_ipv6_neighbors_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearIpv6Neighbors" + } + + @overload + async def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes clearIpv6Neighbors table operation to the underlying resources. + + clearIpv6Neighbors for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes clearIpv6Neighbors table operation to the underlying resources. + + clearIpv6Neighbors for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes clearIpv6Neighbors table operation to the underlying resources. + + clearIpv6Neighbors for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_ipv6_neighbors_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_ipv6_neighbors.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearIpv6Neighbors" + } + + async def _clear_arp_entries_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_entries_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_entries_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_entries_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearArpEntries" + } + + @overload + async def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + clearArpEntries for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + clearArpEntries for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + clearArpEntries for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_arp_entries_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_entries.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearArpEntries" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_internal_networks_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_internal_networks_operations.py new file mode 100644 index 000000000000..099d3c18f10b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_internal_networks_operations.py @@ -0,0 +1,2272 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._internal_networks_operations import ( + build_clear_arp_entries_request, + build_clear_ipv6_neighbors_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_administrative_state_request, + build_update_bfd_for_bgp_administrative_state_request, + build_update_bfd_for_static_route_administrative_state_request, + build_update_bgp_administrative_state_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InternalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`internal_networks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetwork, IO], + **kwargs: Any + ) -> _models.InternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InternalNetwork") + + request = build_create_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.InternalNetwork, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InternalNetwork]: + """Creates InternalNetwork for Layer3 Isolation Domain for communication of compute within and + across racks. + + Creates InternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InternalNetwork]: + """Creates InternalNetwork for Layer3 Isolation Domain for communication of compute within and + across racks. + + Creates InternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetwork, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.InternalNetwork]: + """Creates InternalNetwork for Layer3 Isolation Domain for communication of compute within and + across racks. + + Creates InternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a InternalNetwork type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetwork or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, l3_isolation_domain_name: str, internal_network_name: str, **kwargs: Any + ) -> _models.InternalNetwork: + """Retrieves details of InternalNetworks using GET method. + + Gets a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InternalNetwork or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.InternalNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + async def _update_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetworkPatch, IO], + **kwargs: Any + ) -> _models.InternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InternalNetworkPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.InternalNetworkPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InternalNetwork]: + """API to update certain properties of the InternalNetworks resources. + + Updates a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: InternalNetwork properties to update. Only annotations are supported. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InternalNetwork]: + """API to update certain properties of the InternalNetworks resources. + + Updates a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: InternalNetwork properties to update. Only annotations are supported. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetworkPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.InternalNetwork]: + """API to update certain properties of the InternalNetworks resources. + + Updates a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: InternalNetwork properties to update. Only annotations are supported. Is either a + InternalNetworkPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l3_isolation_domain_name: str, internal_network_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, l3_isolation_domain_name: str, internal_network_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a InternalNetworks. + + Implements InternalNetworks DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> AsyncIterable["_models.InternalNetwork"]: + """Executes list operation to display list of all internal networks. + + Displays InternalNetworks list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InternalNetwork or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InternalNetworksList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("InternalNetworksList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks" + } + + async def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateAdministrativeState" + } + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes the operation to the underlying resources. + + Update Administrative state of InternalNetworks on resources referred by their resource ids. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes the operation to the underlying resources. + + Update Administrative state of InternalNetworks on resources referred by their resource ids. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes the operation to the underlying resources. + + Update Administrative state of InternalNetworks on resources referred by their resource ids. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateAdministrativeState" + } + + async def _update_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBgpAdministrativeState" + } + + @overload + async def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes the operation to the underlying resources for updating BGP state on edge devices. + + Update BGP state for internalNetwork. Allowed only on edge devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes the operation to the underlying resources for updating BGP state on edge devices. + + Update BGP state for internalNetwork. Allowed only on edge devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes the operation to the underlying resources for updating BGP state on edge devices. + + Update BGP state for internalNetwork. Allowed only on edge devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBgpAdministrativeState" + } + + async def _update_bfd_for_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bfd_for_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bfd_for_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bfd_for_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForBgpAdministrativeState" + } + + @overload + async def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Update BfdForBgp for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Update BfdForBgp for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Update BfdForBgp for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_bfd_for_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bfd_for_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForBgpAdministrativeState" + } + + async def _clear_ipv6_neighbors_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_ipv6_neighbors_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_ipv6_neighbors_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_ipv6_neighbors_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearIpv6Neighbors" + } + + @overload + async def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + clearIpv6Neighbors for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + clearIpv6Neighbors for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + clearIpv6Neighbors for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_ipv6_neighbors_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_ipv6_neighbors.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearIpv6Neighbors" + } + + async def _clear_arp_entries_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_entries_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_entries_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_entries_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearArpEntries" + } + + @overload + async def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes clearArpEntries operation to the underlying resources. + + clearArpEntries for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes clearArpEntries operation to the underlying resources. + + clearArpEntries for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes clearArpEntries operation to the underlying resources. + + clearArpEntries for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_arp_entries_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_entries.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearArpEntries" + } + + async def _update_bfd_for_static_route_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bfd_for_static_route_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bfd_for_static_route_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bfd_for_static_route_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForStaticRouteAdministrativeState" + } + + @overload + async def begin_update_bfd_for_static_route_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes update BfdForStaticRoutes operation to the underlying resources. + + Update BfdForStaticRoutes for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_bfd_for_static_route_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes update BfdForStaticRoutes operation to the underlying resources. + + Update BfdForStaticRoutes for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_bfd_for_static_route_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Executes update BfdForStaticRoutes operation to the underlying resources. + + Update BfdForStaticRoutes for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_bfd_for_static_route_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bfd_for_static_route_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForStaticRouteAdministrativeState" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_communities_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_communities_operations.py new file mode 100644 index 000000000000..3fb52afe5492 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_communities_operations.py @@ -0,0 +1,890 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._ip_communities_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class IpCommunitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`ip_communities` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunity, IO], **kwargs: Any + ) -> _models.IpCommunity: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpCommunity") + + request = build_create_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + ip_community_name: str, + body: _models.IpCommunity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpCommunity]: + """Create an IP Community. + + Implements an IP Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + ip_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpCommunity]: + """Create an IP Community. + + Implements an IP Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunity, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.IpCommunity]: + """Create an IP Community. + + Implements an IP Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: Request payload. Is either a IpCommunity type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunity or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, ip_community_name: str, **kwargs: Any) -> _models.IpCommunity: + """Gets an IP Community. + + Implements an IP Community GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpCommunity or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.IpCommunity + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + async def _update_initial( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunityPatch, IO], **kwargs: Any + ) -> Optional[_models.IpCommunity]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.IpCommunity]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpCommunityPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + ip_community_name: str, + body: _models.IpCommunityPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpCommunity]: + """Updates an IP Community. + + API to update certain properties of the IP Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: IP Community properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunityPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + ip_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpCommunity]: + """Updates an IP Community. + + API to update certain properties of the IP Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: IP Community properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunityPatch, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.IpCommunity]: + """Updates an IP Community. + + API to update certain properties of the IP Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: IP Community properties to update. Is either a IpCommunityPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunityPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_community_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, ip_community_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an IP Community. + + Implements IP Community DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.IpCommunity"]: + """List IpCommunities by resource group. + + Implements IpCommunities list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpCommunity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpCommunitiesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpCommunitiesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IpCommunity"]: + """List IpCommunities by subscription. + + Implements IpCommunities list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpCommunity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpCommunitiesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpCommunitiesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_extended_communities_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_extended_communities_operations.py new file mode 100644 index 000000000000..e7c1cde5da5f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_extended_communities_operations.py @@ -0,0 +1,916 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._ip_extended_communities_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class IpExtendedCommunitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`ip_extended_communities` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunity, IO], + **kwargs: Any + ) -> _models.IpExtendedCommunity: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpExtendedCommunity") + + request = build_create_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: _models.IpExtendedCommunity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpExtendedCommunity]: + """Create an IP Extended Community. + + Implements IP Extended Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpExtendedCommunity]: + """Create an IP Extended Community. + + Implements IP Extended Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunity, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.IpExtendedCommunity]: + """Create an IP Extended Community. + + Implements IP Extended Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: Request payload. Is either a IpExtendedCommunity type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, ip_extended_community_name: str, **kwargs: Any + ) -> _models.IpExtendedCommunity: + """Gets an IP Extended Community. + + Implements IP Extended Community GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpExtendedCommunity or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + async def _update_initial( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunityPatch, IO], + **kwargs: Any + ) -> Optional[_models.IpExtendedCommunity]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.IpExtendedCommunity]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpExtendedCommunityPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: _models.IpExtendedCommunityPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpExtendedCommunity]: + """Updates the IP Extended Community. + + API to update certain properties of the IP Extended Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: IP Extended Community properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunityPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpExtendedCommunity]: + """Updates the IP Extended Community. + + API to update certain properties of the IP Extended Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: IP Extended Community properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunityPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.IpExtendedCommunity]: + """Updates the IP Extended Community. + + API to update certain properties of the IP Extended Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: IP Extended Community properties to update. Is either a IpExtendedCommunityPatch + type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunityPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_extended_community_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, ip_extended_community_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the IP Extended Community. + + Implements IP Extended Community DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.IpExtendedCommunity"]: + """List IpExtendedCommunities by resource group. + + Implements IpExtendedCommunities list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpExtendedCommunity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpExtendedCommunityListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunityListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IpExtendedCommunity"]: + """List IpExtendedCommunities by subscription. + + Implements IpExtendedCommunities list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpExtendedCommunity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpExtendedCommunityListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunityListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_prefixes_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_prefixes_operations.py new file mode 100644 index 000000000000..610ad99893cd --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_ip_prefixes_operations.py @@ -0,0 +1,888 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._ip_prefixes_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class IpPrefixesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`ip_prefixes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefix, IO], **kwargs: Any + ) -> _models.IpPrefix: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpPrefix") + + request = build_create_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + ip_prefix_name: str, + body: _models.IpPrefix, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpPrefix]: + """Create an IP Prefix. + + Implements IP Prefix PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefix + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + ip_prefix_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpPrefix]: + """Create an IP Prefix. + + Implements IP Prefix PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefix, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.IpPrefix]: + """Create an IP Prefix. + + Implements IP Prefix PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: Request payload. Is either a IpPrefix type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefix or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, ip_prefix_name: str, **kwargs: Any) -> _models.IpPrefix: + """Gets an IP Prefix. + + Implements IP Prefix GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.IpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + async def _update_initial( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefixPatch, IO], **kwargs: Any + ) -> Optional[_models.IpPrefix]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.IpPrefix]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpPrefixPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + ip_prefix_name: str, + body: _models.IpPrefixPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpPrefix]: + """Updates the IP Prefix. + + API to update certain properties of the IP Prefix resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: IP Prefix properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefixPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + ip_prefix_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpPrefix]: + """Updates the IP Prefix. + + API to update certain properties of the IP Prefix resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: IP Prefix properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefixPatch, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.IpPrefix]: + """Updates the IP Prefix. + + API to update certain properties of the IP Prefix resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: IP Prefix properties to update. Is either a IpPrefixPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefixPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_prefix_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, ip_prefix_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the IP Prefix. + + Implements IP Prefix DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.IpPrefix"]: + """List IpPrefixes by resource group. + + Implements IpPrefixes list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpPrefix or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpPrefixesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpPrefixesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.IpPrefix"]: + """List IpPrefixes by subscription. + + Implements IpPrefixes list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpPrefix or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpPrefixesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpPrefixesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l2_isolation_domains_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l2_isolation_domains_operations.py new file mode 100644 index 000000000000..4f277d548fef --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l2_isolation_domains_operations.py @@ -0,0 +1,1715 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._l2_isolation_domains_operations import ( + build_clear_arp_table_request, + build_clear_neighbor_table_request, + build_create_request, + build_delete_request, + build_get_arp_entries_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_administrative_state_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class L2IsolationDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`l2_isolation_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomain, IO], + **kwargs: Any + ) -> _models.L2IsolationDomain: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L2IsolationDomain") + + request = build_create_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.L2IsolationDomain, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L2IsolationDomain]: + """Create L2 Isolation Domain. + + Creates layer 2 network connectivity between compute nodes within a rack and across racks.The + configuration is applied on the devices only after the isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L2IsolationDomain]: + """Create L2 Isolation Domain. + + Creates layer 2 network connectivity between compute nodes within a rack and across racks.The + configuration is applied on the devices only after the isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomain, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.L2IsolationDomain]: + """Create L2 Isolation Domain. + + Creates layer 2 network connectivity between compute nodes within a rack and across racks.The + configuration is applied on the devices only after the isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a L2IsolationDomain type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomain or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> _models.L2IsolationDomain: + """Retrieves details of this L2 Isolation Domain. + + Implements L2 Isolation Domain GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: L2IsolationDomain or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + async def _update_initial( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomainPatch, IO], + **kwargs: Any + ) -> Optional[_models.L2IsolationDomain]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.L2IsolationDomain]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L2IsolationDomainPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.L2IsolationDomainPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L2IsolationDomain]: + """Updates a L2 Isolation Domain. + + API to update certain properties of the L2 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: API to update certain properties of the L2 Isolation Domain resource.. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomainPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L2IsolationDomain]: + """Updates a L2 Isolation Domain. + + API to update certain properties of the L2 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: API to update certain properties of the L2 Isolation Domain resource.. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomainPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.L2IsolationDomain]: + """Updates a L2 Isolation Domain. + + API to update certain properties of the L2 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: API to update certain properties of the L2 Isolation Domain resource.. Is either a + L2IsolationDomainPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomainPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes named L2 Isolation Domain. + + Deletes layer 2 connectivity between compute nodes by managed by named L2 Isolation name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + async def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/updateAdministrativeState" + } + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Enables isolation domain across the fabric or on specified racks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Enables isolation domain across the fabric or on specified racks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_administrative_state( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Enables isolation domain across the fabric or on specified racks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/updateAdministrativeState" + } + + async def _clear_arp_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_table_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearArpTable" + } + + @overload + async def begin_clear_arp_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_arp_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_arp_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_arp_table_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearArpTable" + } + + async def _clear_neighbor_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_neighbor_table_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_neighbor_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_neighbor_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearNeighborTable" + } + + @overload + async def begin_clear_neighbor_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_neighbor_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_neighbor_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_neighbor_table_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_neighbor_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearNeighborTable" + } + + async def _get_arp_entries_initial( + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> Dict[str, _models.ARPProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Dict[str, _models.ARPProperties]] = kwargs.pop("cls", None) + + request = build_get_arp_entries_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_arp_entries_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("{ARPProperties}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_arp_entries_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/getArpEntries" + } + + @distributed_trace_async + async def begin_get_arp_entries( + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[Dict[str, _models.ARPProperties]]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either dict mapping str to ARPProperties or + the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[dict[str, + ~azure.mgmt.managednetworkfabric.models.ARPProperties]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Dict[str, _models.ARPProperties]] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._get_arp_entries_initial( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("{ARPProperties}", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_arp_entries.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/getArpEntries" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.L2IsolationDomain"]: + """List L2IsolationDomains by resource group. + + Displays L2IsolationDomains list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L2IsolationDomain or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L2IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("L2IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.L2IsolationDomain"]: + """List L2IsolationDomains by subscription. + + Displays L2IsolationDomains list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L2IsolationDomain or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L2IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("L2IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l3_isolation_domains_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l3_isolation_domains_operations.py new file mode 100644 index 000000000000..4ea403b9b846 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_l3_isolation_domains_operations.py @@ -0,0 +1,1812 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._l3_isolation_domains_operations import ( + build_clear_arp_table_request, + build_clear_neighbor_table_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_administrative_state_request, + build_update_option_b_administrative_state_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class L3IsolationDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`l3_isolation_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomain, IO], + **kwargs: Any + ) -> _models.L3IsolationDomain: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L3IsolationDomain") + + request = build_create_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.L3IsolationDomain, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L3IsolationDomain]: + """Create L3 Isolation Domain. + + Create isolation domain resources for layer 3 connectivity between compute nodes and for + communication with external services .This configuration is applied on the devices only after + the creation of networks is completed and isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L3IsolationDomain]: + """Create L3 Isolation Domain. + + Create isolation domain resources for layer 3 connectivity between compute nodes and for + communication with external services .This configuration is applied on the devices only after + the creation of networks is completed and isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomain, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.L3IsolationDomain]: + """Create L3 Isolation Domain. + + Create isolation domain resources for layer 3 connectivity between compute nodes and for + communication with external services .This configuration is applied on the devices only after + the creation of networks is completed and isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a L3IsolationDomain type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomain or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> _models.L3IsolationDomain: + """Gets a L3 Isolation Domain. + + Retrieves details of this L3 Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: L3IsolationDomain or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + async def _update_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomainPatch, IO], + **kwargs: Any + ) -> Optional[_models.L3IsolationDomain]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.L3IsolationDomain]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L3IsolationDomainPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.L3IsolationDomainPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L3IsolationDomain]: + """Updates a L3 Isolation Domain. + + API to update certain properties of the L3 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: API to update certain properties of the L3 Isolation Domain resource. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.L3IsolationDomain]: + """Updates a L3 Isolation Domain. + + API to update certain properties of the L3 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: API to update certain properties of the L3 Isolation Domain resource. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomainPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.L3IsolationDomain]: + """Updates a L3 Isolation Domain. + + API to update certain properties of the L3 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: API to update certain properties of the L3 Isolation Domain resource. Is either a + L3IsolationDomainPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a L3 Isolation Domain. + + Deletes layer 3 connectivity between compute nodes by managed by named L3 Isolation name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.L3IsolationDomain"]: + """List L3IsolationDomains by resource group. + + Displays L3IsolationDomains list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L3IsolationDomain or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L3IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("L3IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.L3IsolationDomain"]: + """List L3IsolationDomains by subscription. + + Displays L3IsolationDomains list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L3IsolationDomain or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L3IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("L3IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains" + } + + async def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateAdministrativeState" + } + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes enable operation to the underlying resources. + + Enables racks for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes enable operation to the underlying resources. + + Enables racks for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes enable operation to the underlying resources. + + Enables racks for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateAdministrativeState" + } + + async def _update_option_b_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_option_b_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_option_b_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_option_b_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateOptionBAdministrativeState" + } + + @overload + async def begin_update_option_b_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update route targets on CE devices. List the CE network device ARM resource IDs in the request + body payload. + + Update administrative state of option B on CE devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_option_b_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update route targets on CE devices. List the CE network device ARM resource IDs in the request + body payload. + + Update administrative state of option B on CE devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_option_b_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update route targets on CE devices. List the CE network device ARM resource IDs in the request + body payload. + + Update administrative state of option B on CE devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_option_b_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_option_b_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateOptionBAdministrativeState" + } + + async def _clear_arp_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_table_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearArpTable" + } + + @overload + async def begin_clear_arp_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes clear ARP operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_arp_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes clear ARP operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_arp_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes clear ARP operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_arp_table_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearArpTable" + } + + async def _clear_neighbor_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_neighbor_table_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_neighbor_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_neighbor_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearNeighborTable" + } + + @overload + async def begin_clear_neighbor_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes ipv6 clear neighbor tables operation to the underlying resources. + + Clears IPv6 neighbor tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clear_neighbor_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes ipv6 clear neighbor tables operation to the underlying resources. + + Clears IPv6 neighbor tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clear_neighbor_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """executes ipv6 clear neighbor tables operation to the underlying resources. + + Clears IPv6 neighbor tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clear_neighbor_table_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_neighbor_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearNeighborTable" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_device_skus_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_device_skus_operations.py new file mode 100644 index 000000000000..0e5cafd89b32 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_device_skus_operations.py @@ -0,0 +1,201 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_device_skus_operations import build_get_request, build_list_by_subscription_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkDeviceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_device_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, network_device_sku_name: str, **kwargs: Any) -> _models.NetworkDeviceSku: + """Gets a Network Device Sku. + + Get Network Device SKU details. + + :param network_device_sku_name: Name of the Network Device Sku. Required. + :type network_device_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkDeviceSku or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkDeviceSku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDeviceSku] = kwargs.pop("cls", None) + + request = build_get_request( + network_device_sku_name=network_device_sku_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkDeviceSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkDeviceSku"]: + """List NetworkDeviceSkus by subscription. + + List Network Device SKUs for the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkDeviceSku or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDeviceSkusListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkDeviceSkusListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_devices_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_devices_operations.py new file mode 100644 index 000000000000..f594b47d65d0 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_devices_operations.py @@ -0,0 +1,2122 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_devices_operations import ( + build_create_request, + build_delete_request, + build_generate_support_package_request, + build_get_dynamic_interface_maps_request, + build_get_request, + build_get_static_interface_maps_request, + build_get_status_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_reboot_request, + build_restore_config_request, + build_update_power_cycle_request, + build_update_request, + build_update_version_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkDevicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_devices` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_group_name: str, network_device_name: str, body: Union[_models.NetworkDevice, IO], **kwargs: Any + ) -> _models.NetworkDevice: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkDevice") + + request = build_create_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_device_name: str, + body: _models.NetworkDevice, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkDevice]: + """Create Network Device. + + Create a Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevice + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkDevice]: + """Create Network Device. + + Create a Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, network_device_name: str, body: Union[_models.NetworkDevice, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkDevice]: + """Create Network Device. + + Create a Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Request payload. Is either a NetworkDevice type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevice or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkDevice", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, network_device_name: str, **kwargs: Any) -> _models.NetworkDevice: + """Gets a Network Device. + + Get the Network Device resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkDevice or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkDevice + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + async def _update_initial( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.NetworkDevicePatchParameters, IO], + **kwargs: Any + ) -> Optional[_models.NetworkDevice]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkDevice]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkDevicePatchParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + network_device_name: str, + body: _models.NetworkDevicePatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkDevice]: + """Updates a Network Device. + + Update certain properties of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Network Device properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevicePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkDevice]: + """Updates a Network Device. + + Update certain properties of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Network Device properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.NetworkDevicePatchParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkDevice]: + """Updates a Network Device. + + Update certain properties of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Network Device properties to update. Is either a NetworkDevicePatchParameters type + or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevicePatchParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkDevice", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Network Device. + + Delete the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkDevice"]: + """List NetworkDevices by resource group. + + List all the Network Device resources in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkDevice or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDevicesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkDevicesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkDevice"]: + """List NetworkDevices by subscription. + + List all the Network Device resources in a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkDevice or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDevicesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkDevicesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices" + } + + async def _reboot_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_reboot_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reboot_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _reboot_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/reboot" + } + + @distributed_trace_async + async def begin_reboot( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Reboot the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reboot_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reboot.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/reboot" + } + + async def _restore_config_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restore_config_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restore_config_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restore_config_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/restoreConfig" + } + + @distributed_trace_async + async def begin_restore_config( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores the configuration to last applied good configuration from Azure. + + Restore the configuration of the Network Device resource to last known good configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restore_config_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restore_config.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/restoreConfig" + } + + async def _update_version_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdateVersionProperties, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateVersionProperties") + + request = build_update_version_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_version_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_version_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updateVersion" + } + + @overload + async def begin_update_version( + self, + resource_group_name: str, + network_device_name: str, + body: _models.UpdateVersionProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements SKU version upgrade of network device. + + Update the SKU version of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateVersionProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_version( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements SKU version upgrade of network device. + + Update the SKU version of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_version( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdateVersionProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements SKU version upgrade of network device. + + Update the SKU version of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Is either a UpdateVersionProperties type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateVersionProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_version_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_version.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updateVersion" + } + + async def _generate_support_package_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> _models.SupportPackageProperties: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportPackageProperties] = kwargs.pop("cls", None) + + request = build_generate_support_package_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._generate_support_package_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SupportPackageProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_support_package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/generateSupportPackage" + } + + @distributed_trace_async + async def begin_generate_support_package( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.SupportPackageProperties]: + """Implements the operation to the underlying resources. + + Generate Support Package for the given Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SupportPackageProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.SupportPackageProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportPackageProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_support_package_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SupportPackageProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_support_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/generateSupportPackage" + } + + async def _update_power_cycle_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdatePowerCycleProperties, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdatePowerCycleProperties") + + request = build_update_power_cycle_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_power_cycle_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_power_cycle_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updatePowerCycle" + } + + @overload + async def begin_update_power_cycle( + self, + resource_group_name: str, + network_device_name: str, + body: _models.UpdatePowerCycleProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Update PDU power cycle of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdatePowerCycleProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_power_cycle( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Update PDU power cycle of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_power_cycle( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdatePowerCycleProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Update PDU power cycle of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Is either a UpdatePowerCycleProperties type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdatePowerCycleProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_power_cycle_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_power_cycle.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updatePowerCycle" + } + + async def _get_status_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> _models.GetDeviceStatusProperties: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GetDeviceStatusProperties] = kwargs.pop("cls", None) + + request = build_get_status_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_status_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("GetDeviceStatusProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStatus" + } + + @distributed_trace_async + async def begin_get_status( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.GetDeviceStatusProperties]: + """Gets the running status of the network device. + + Get the running status of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GetDeviceStatusProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.GetDeviceStatusProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GetDeviceStatusProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._get_status_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("GetDeviceStatusProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStatus" + } + + async def _get_static_interface_maps_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> List[_models.GetStaticInterfaceMapsPropertiesItem]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetStaticInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + + request = build_get_static_interface_maps_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_static_interface_maps_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetStaticInterfaceMapsPropertiesItem]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_static_interface_maps_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStaticInterfaceMaps" + } + + @distributed_trace_async + async def begin_get_static_interface_maps( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[List[_models.GetStaticInterfaceMapsPropertiesItem]]: + """Show the interface maps as per the topology. + + Get the static interface maps for the given Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of + GetStaticInterfaceMapsPropertiesItem or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.managednetworkfabric.models.GetStaticInterfaceMapsPropertiesItem]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetStaticInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._get_static_interface_maps_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetStaticInterfaceMapsPropertiesItem]", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_static_interface_maps.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStaticInterfaceMaps" + } + + async def _get_dynamic_interface_maps_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> List[_models.GetDynamicInterfaceMapsPropertiesItem]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetDynamicInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + + request = build_get_dynamic_interface_maps_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_dynamic_interface_maps_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetDynamicInterfaceMapsPropertiesItem]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_dynamic_interface_maps_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getDynamicInterfaceMaps" + } + + @distributed_trace_async + async def begin_get_dynamic_interface_maps( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncLROPoller[List[_models.GetDynamicInterfaceMapsPropertiesItem]]: + """Implements the operation to the underlying resources. + + Get the dynamic interface maps for the given Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of + GetDynamicInterfaceMapsPropertiesItem or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.managednetworkfabric.models.GetDynamicInterfaceMapsPropertiesItem]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetDynamicInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._get_dynamic_interface_maps_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetDynamicInterfaceMapsPropertiesItem]", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_dynamic_interface_maps.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getDynamicInterfaceMaps" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_controllers_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_controllers_operations.py new file mode 100644 index 000000000000..1fc68e7b72ab --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_controllers_operations.py @@ -0,0 +1,1153 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_fabric_controllers_operations import ( + build_create_request, + build_delete_request, + build_disable_workload_management_network_request, + build_enable_workload_management_network_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkFabricControllersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_fabric_controllers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricController, IO], + **kwargs: Any + ) -> _models.NetworkFabricController: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabricController") + + request = build_create_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: _models.NetworkFabricController, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabricController]: + """Create Network fabric controller. + + Creates a Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricController + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabricController or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabricController]: + """Create Network fabric controller. + + Creates a Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabricController or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricController, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabricController]: + """Create Network fabric controller. + + Creates a Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Request payload. Is either a NetworkFabricController type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricController or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabricController or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> _models.NetworkFabricController: + """Gets a Network Fabric Controller. + + Shows the provisioning status of Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFabricController or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkFabricController + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + async def _update_initial( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricControllerPatch, IO], + **kwargs: Any + ) -> Optional[_models.NetworkFabricController]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkFabricController]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabricControllerPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: _models.NetworkFabricControllerPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabricController]: + """Updates a Network Fabric Controller. + + Updates are currently not supported for the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Network Fabric Controller properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabricController or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabricController]: + """Updates a Network Fabric Controller. + + Updates are currently not supported for the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Network Fabric Controller properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabricController or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricControllerPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabricController]: + """Updates a Network Fabric Controller. + + Updates are currently not supported for the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Network Fabric Controller properties to update. Is either a + NetworkFabricControllerPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabricController or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Network Fabric Controller. + + Deletes the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkFabricController"]: + """List NetworkFabricControllers by resource group. + + Lists all the NetworkFabricControllers thats available in the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricControllersListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricControllersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkFabricController"]: + """List NetworkFabricControllers by subscription. + + Lists all the NetworkFabricControllers by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricControllersListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricControllersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers" + } + + async def _enable_workload_management_network_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_enable_workload_management_network_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._enable_workload_management_network_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _enable_workload_management_network_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/enableWorkloadManagementNetwork" + } + + @distributed_trace_async + async def begin_enable_workload_management_network( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Enables the workloadManagementNetwork (Tenant Network). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the networkFabricController. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._enable_workload_management_network_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable_workload_management_network.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/enableWorkloadManagementNetwork" + } + + async def _disable_workload_management_network_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_disable_workload_management_network_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_workload_management_network_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _disable_workload_management_network_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/disableWorkloadManagementNetwork" + } + + @distributed_trace_async + async def begin_disable_workload_management_network( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Disables the workloadManagementNetwork (Tenant Network). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the networkFabricController. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._disable_workload_management_network_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable_workload_management_network.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/disableWorkloadManagementNetwork" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_skus_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_skus_operations.py new file mode 100644 index 000000000000..c21e93c74c27 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabric_skus_operations.py @@ -0,0 +1,201 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_fabric_skus_operations import build_get_request, build_list_by_subscription_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkFabricSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_fabric_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, network_fabric_sku_name: str, **kwargs: Any) -> _models.NetworkFabricSku: + """Gets a Network Fabric Sku. + + Implements Network Fabric Sku GET method. + + :param network_fabric_sku_name: Name of the Network Fabric Sku. Required. + :type network_fabric_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFabricSku or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkFabricSku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricSku] = kwargs.pop("cls", None) + + request = build_get_request( + network_fabric_sku_name=network_fabric_sku_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkFabricSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkFabricSku"]: + """List NetworkFabricSkus by subscription. + + Implements NetworkFabricSkus list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabricSku or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabricSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricSkusListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricSkusListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabrics_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabrics_operations.py new file mode 100644 index 000000000000..f9ae70b3998d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_fabrics_operations.py @@ -0,0 +1,1144 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_fabrics_operations import ( + build_create_request, + build_delete_request, + build_deprovision_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_provision_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkFabricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_fabrics` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_group_name: str, network_fabric_name: str, body: Union[_models.NetworkFabric, IO], **kwargs: Any + ) -> _models.NetworkFabric: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabric") + + request = build_create_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + body: _models.NetworkFabric, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabric]: + """Create Network Fabric. + + Create Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabric + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabric]: + """Create Network Fabric. + + Create Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, network_fabric_name: str, body: Union[_models.NetworkFabric, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabric]: + """Create Network Fabric. + + Create Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Request payload. Is either a NetworkFabric type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabric or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabric", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, network_fabric_name: str, **kwargs: Any) -> _models.NetworkFabric: + """Gets a Network Fabric. + + Get Network Fabric resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFabric or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkFabric + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + async def _update_initial( + self, + resource_group_name: str, + network_fabric_name: str, + body: Union[_models.NetworkFabricPatchParameters, IO], + **kwargs: Any + ) -> Optional[_models.NetworkFabric]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkFabric]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabricPatchParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + network_fabric_name: str, + body: _models.NetworkFabricPatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabric]: + """Updates a Network Fabric. + + Update certain properties of the Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Network Fabric properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + network_fabric_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabric]: + """Updates a Network Fabric. + + Update certain properties of the Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Network Fabric properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + network_fabric_name: str, + body: Union[_models.NetworkFabricPatchParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFabric]: + """Updates a Network Fabric. + + Update certain properties of the Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Network Fabric properties to update. Is either a NetworkFabricPatchParameters type + or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricPatchParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabric", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Network Fabric. + + Delete Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkFabric"]: + """List NetworkFabrics by resource group. + + List all the Network Fabric resources in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabric or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkFabric"]: + """List NetworkFabrics by subscription. + + List all the Network Fabric resources in the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabric or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics" + } + + async def _provision_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_provision_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._provision_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _provision_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/provision" + } + + @distributed_trace_async + async def begin_provision( + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Provisions the underlying resources in the given Network Fabric instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._provision_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_provision.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/provision" + } + + async def _deprovision_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_deprovision_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._deprovision_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _deprovision_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/deprovision" + } + + @distributed_trace_async + async def begin_deprovision( + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Implements the operation to the underlying resources. + + Deprovisions the underlying resources in the given Network Fabric instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._deprovision_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_deprovision.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/deprovision" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_interfaces_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_interfaces_operations.py new file mode 100644 index 000000000000..ceb146bec402 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_interfaces_operations.py @@ -0,0 +1,1224 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_interfaces_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_get_status_request, + build_list_request, + build_update_administrative_state_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkInterfacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_interfaces` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkInterface") + + request = build_create_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: _models.NetworkInterface, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Create NetworkInterface. + + Create a Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterface + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Create NetworkInterface. + + Create a Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Create NetworkInterface. + + Create a Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Is either a NetworkInterface type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterface or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterface", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> _models.NetworkInterface: + """Gets a NetworkInterface. + + Get the Network Interface resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + async def _update_initial( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterfacePatch, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkInterfacePatch") + + request = build_update_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: _models.NetworkInterfacePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Updates a NetworkInterface. + + Update certain properties of the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :param body: NetworkInterface properties to update. Only tags are supported. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterfacePatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Updates a NetworkInterface. + + Update certain properties of the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :param body: NetworkInterface properties to update. Only tags are supported. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterfacePatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Updates a NetworkInterface. + + Update certain properties of the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :param body: NetworkInterface properties to update. Only tags are supported. Is either a + NetworkInterfacePatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterfacePatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterface", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a NetworkInterface. + + Delete the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterface"]: + """List all Network Interfaces that are available using an Network Device. + + List all the Network Interface resources in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfacesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfacesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces" + } + + async def _get_status_initial( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> _models.InterfaceStatus: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InterfaceStatus] = kwargs.pop("cls", None) + + request = build_get_status_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_status_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("InterfaceStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/getStatus" + } + + @distributed_trace_async + async def begin_get_status( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.InterfaceStatus]: + """Implements the operation to the underlying resources. + + Get the running status of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InterfaceStatus or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.InterfaceStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InterfaceStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._get_status_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("InterfaceStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/getStatus" + } + + async def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/updateAdministrativeState" + } + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the admin state of the network interface. + + Update the admin state of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_administrative_state( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the admin state of the network interface. + + Update the admin state of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_administrative_state( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the admin state of the network interface. + + Update the admin state of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/updateAdministrativeState" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_rack_skus_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_rack_skus_operations.py new file mode 100644 index 000000000000..e983d438690d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_rack_skus_operations.py @@ -0,0 +1,201 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_rack_skus_operations import build_get_request, build_list_by_subscription_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkRackSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_rack_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, network_rack_sku_name: str, **kwargs: Any) -> _models.NetworkRackSku: + """Gets a Network Rack Sku. + + Get Network Rack SKU resource. + + :param network_rack_sku_name: Name of the Network Rack Sku. Required. + :type network_rack_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRackSku or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkRackSku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRackSku] = kwargs.pop("cls", None) + + request = build_get_request( + network_rack_sku_name=network_rack_sku_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRackSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRackSkus/{networkRackSkuName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkRackSku"]: + """List NetworkRackSkus by subscription. + + List all Network Rack SKUs in the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRackSku or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkRackSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRackSkusListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRackSkusListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRackSkus" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_racks_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_racks_operations.py new file mode 100644 index 000000000000..7fae8d1600c9 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_racks_operations.py @@ -0,0 +1,879 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_racks_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkRacksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_racks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRack, IO], **kwargs: Any + ) -> _models.NetworkRack: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkRack") + + request = build_create_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_rack_name: str, + body: _models.NetworkRack, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkRack]: + """Create Network Rack. + + Create Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRack + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_rack_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkRack]: + """Create Network Rack. + + Create Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRack, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkRack]: + """Create Network Rack. + + Create Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Request payload. Is either a NetworkRack type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRack or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkRack", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, network_rack_name: str, **kwargs: Any) -> _models.NetworkRack: + """Gets a Network Rack. + + Get Network Rack resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRack or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkRack + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + async def _update_initial( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRackPatch, IO], **kwargs: Any + ) -> Optional[_models.NetworkRack]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkRack]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkRackPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + network_rack_name: str, + body: _models.NetworkRackPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkRack]: + """Updates a Network Rack. + + Update certain properties of the Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Network Rack properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRackPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + network_rack_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkRack]: + """Updates a Network Rack. + + Update certain properties of the Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Network Rack properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRackPatch, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkRack]: + """Updates a Network Rack. + + Update certain properties of the Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Network Rack properties to update. Is either a NetworkRackPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRackPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkRack", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_rack_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_rack_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Network Rack. + + Delete Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkRack"]: + """List NetworkRacks by resource group. + + List all Network Rack resources in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRack or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRacksListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRacksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkRack"]: + """List NetworkRacks by subscription. + + List all Network Rack resources in the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRack or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRacksListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRacksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_to_network_interconnects_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_to_network_interconnects_operations.py new file mode 100644 index 000000000000..ee363158de56 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_network_to_network_interconnects_operations.py @@ -0,0 +1,617 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_to_network_interconnects_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkToNetworkInterconnectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_to_network_interconnects` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: Union[_models.NetworkToNetworkInterconnect, IO], + **kwargs: Any + ) -> _models.NetworkToNetworkInterconnect: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkToNetworkInterconnect] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkToNetworkInterconnect") + + request = build_create_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: _models.NetworkToNetworkInterconnect, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkToNetworkInterconnect]: + """Configuration used to setup CE-PE connectivity. + + Configuration used to setup CE-PE connectivity PUT Method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkToNetworkInterconnect or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkToNetworkInterconnect]: + """Configuration used to setup CE-PE connectivity. + + Configuration used to setup CE-PE connectivity PUT Method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkToNetworkInterconnect or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: Union[_models.NetworkToNetworkInterconnect, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkToNetworkInterconnect]: + """Configuration used to setup CE-PE connectivity. + + Configuration used to setup CE-PE connectivity PUT Method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :param body: Request payload. Is either a NetworkToNetworkInterconnect type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkToNetworkInterconnect or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkToNetworkInterconnect] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + **kwargs: Any + ) -> _models.NetworkToNetworkInterconnect: + """Configuration used to setup CE-PE connectivity. + + Implements NetworkToNetworkInterconnects GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnect. + Required. + :type network_to_network_interconnect_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkToNetworkInterconnect or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkToNetworkInterconnect] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a NetworkToNetworkInterconnects. + + Implements NetworkToNetworkInterconnects DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkToNetworkInterconnect"]: + """Executes list operation to display Network To Network Interconnects within a Network Fabric. + + Implements Network To Network Interconnects list by Network Fabric GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkToNetworkInterconnect or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkToNetworkInterconnectsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkToNetworkInterconnectsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_operations.py new file mode 100644 index 000000000000..e3937def886d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_operations.py @@ -0,0 +1,134 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Returns list of all operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.ManagedNetworkFabric/operations"} diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_patch.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_route_policies_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_route_policies_operations.py new file mode 100644 index 000000000000..731dd98e9a75 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/aio/operations/_route_policies_operations.py @@ -0,0 +1,879 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._route_policies_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RoutePoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.aio.AzureNetworkFabricManagementServiceAPI`'s + :attr:`route_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicy, IO], **kwargs: Any + ) -> _models.RoutePolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RoutePolicy") + + request = build_create_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + route_policy_name: str, + body: _models.RoutePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutePolicy]: + """Create Route Policy. + + Implements Route Policy PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + route_policy_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutePolicy]: + """Create Route Policy. + + Implements Route Policy PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicy, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RoutePolicy]: + """Create Route Policy. + + Implements Route Policy PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Request payload. Is either a RoutePolicy type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RoutePolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, route_policy_name: str, **kwargs: Any) -> _models.RoutePolicy: + """Gets a Route Policy. + + Implements Route Policy GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoutePolicy or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.RoutePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + async def _update_initial( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicyPatch, IO], **kwargs: Any + ) -> Optional[_models.RoutePolicy]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.RoutePolicy]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RoutePolicyPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + route_policy_name: str, + body: _models.RoutePolicyPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutePolicy]: + """Updates a Route Policy. + + API to update certain properties of the Route Policy resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Route Policy properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicyPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + route_policy_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutePolicy]: + """Updates a Route Policy. + + API to update certain properties of the Route Policy resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Route Policy properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicyPatch, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RoutePolicy]: + """Updates a Route Policy. + + API to update certain properties of the Route Policy resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Route Policy properties to update. Is either a RoutePolicyPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicyPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RoutePolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_policy_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, route_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Route Policy. + + Implements Route Policy DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RoutePolicy"]: + """List RoutePolicies by resource group. + + Implements RoutePolicies list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoutePolicy or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RoutePoliciesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RoutePoliciesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RoutePolicy"]: + """List RoutePolicies by subscription. + + Implements RoutePolicies list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoutePolicy or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RoutePoliciesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RoutePoliciesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/__init__.py new file mode 100644 index 000000000000..704b21e587fb --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/__init__.py @@ -0,0 +1,407 @@ +# 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 ._models_py3 import ARPProperties +from ._models_py3 import AccessControlList +from ._models_py3 import AccessControlListPatch +from ._models_py3 import AccessControlListPatchProperties +from ._models_py3 import AccessControlListPatchPropertiesConditionsItem +from ._models_py3 import AccessControlListProperties +from ._models_py3 import AccessControlListPropertiesConditionsItem +from ._models_py3 import AccessControlListsListResult +from ._models_py3 import AnnotationResource +from ._models_py3 import BfdConfiguration +from ._models_py3 import ( + Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet, +) +from ._models_py3 import ( + Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties, +) +from ._models_py3 import ( + Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete, +) +from ._models_py3 import ( + Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd, +) +from ._models_py3 import ( + ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet, +) +from ._models_py3 import ( + ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete, +) +from ._models_py3 import ( + ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties, +) +from ._models_py3 import EnableDisableOnResources +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ExpressRouteConnectionInformation +from ._models_py3 import ExpressRouteStatusDef +from ._models_py3 import ExtendedLocation +from ._models_py3 import ExternalNetwork +from ._models_py3 import ExternalNetworkPatch +from ._models_py3 import ExternalNetworkPatchProperties +from ._models_py3 import ExternalNetworkPatchableProperties +from ._models_py3 import ExternalNetworkProperties +from ._models_py3 import ExternalNetworkPropertiesOptionAProperties +from ._models_py3 import ExternalNetworksList +from ._models_py3 import GetDeviceStatusProperties +from ._models_py3 import GetDynamicInterfaceMapsPropertiesItem +from ._models_py3 import GetStaticInterfaceMapsPropertiesItem +from ._models_py3 import InterfaceStatus +from ._models_py3 import InternalNetwork +from ._models_py3 import InternalNetworkPatch +from ._models_py3 import InternalNetworkPatchProperties +from ._models_py3 import InternalNetworkPatchableProperties +from ._models_py3 import InternalNetworkPatchablePropertiesBgpConfiguration +from ._models_py3 import InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem +from ._models_py3 import InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem +from ._models_py3 import InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem +from ._models_py3 import InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem +from ._models_py3 import InternalNetworkPatchablePropertiesStaticRouteConfiguration +from ._models_py3 import InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem +from ._models_py3 import InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem +from ._models_py3 import InternalNetworkProperties +from ._models_py3 import InternalNetworksList +from ._models_py3 import IpCommunitiesListResult +from ._models_py3 import IpCommunity +from ._models_py3 import IpCommunityPatch +from ._models_py3 import IpCommunityProperties +from ._models_py3 import IpExtendedCommunity +from ._models_py3 import IpExtendedCommunityListResult +from ._models_py3 import IpExtendedCommunityPatch +from ._models_py3 import IpExtendedCommunityProperties +from ._models_py3 import IpPrefix +from ._models_py3 import IpPrefixPatch +from ._models_py3 import IpPrefixProperties +from ._models_py3 import IpPrefixPropertiesIpPrefixRulesItem +from ._models_py3 import IpPrefixesListResult +from ._models_py3 import L2IsolationDomain +from ._models_py3 import L2IsolationDomainPatch +from ._models_py3 import L2IsolationDomainPatchProperties +from ._models_py3 import L2IsolationDomainProperties +from ._models_py3 import L2IsolationDomainsListResult +from ._models_py3 import L3IsolationDomain +from ._models_py3 import L3IsolationDomainPatch +from ._models_py3 import L3IsolationDomainPatchProperties +from ._models_py3 import L3IsolationDomainPatchPropertiesAggregateRouteConfiguration +from ._models_py3 import L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem +from ._models_py3 import L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem +from ._models_py3 import L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy +from ._models_py3 import L3IsolationDomainProperties +from ._models_py3 import L3IsolationDomainsListResult +from ._models_py3 import Layer2Configuration +from ._models_py3 import Layer3Configuration +from ._models_py3 import Layer3IpPrefixProperties +from ._models_py3 import Layer3OptionAProperties +from ._models_py3 import NetworkDevice +from ._models_py3 import NetworkDevicePatchParameters +from ._models_py3 import NetworkDevicePatchParametersProperties +from ._models_py3 import NetworkDevicePatchableProperties +from ._models_py3 import NetworkDeviceProperties +from ._models_py3 import NetworkDeviceSku +from ._models_py3 import NetworkDeviceSkuPropertiesInterfacesItem +from ._models_py3 import NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem +from ._models_py3 import NetworkDeviceSkuPropertiesLimits +from ._models_py3 import NetworkDeviceSkuPropertiesSupportedVersionsItem +from ._models_py3 import NetworkDeviceSkusListResult +from ._models_py3 import NetworkDevicesListResult +from ._models_py3 import NetworkFabric +from ._models_py3 import NetworkFabricController +from ._models_py3 import NetworkFabricControllerPatch +from ._models_py3 import NetworkFabricControllerPatchableProperties +from ._models_py3 import NetworkFabricControllerProperties +from ._models_py3 import NetworkFabricControllerPropertiesInfrastructureServices +from ._models_py3 import NetworkFabricControllerPropertiesManagedResourceGroupConfiguration +from ._models_py3 import NetworkFabricControllerPropertiesWorkloadServices +from ._models_py3 import NetworkFabricControllersListResult +from ._models_py3 import NetworkFabricPatchParameters +from ._models_py3 import NetworkFabricPatchParametersProperties +from ._models_py3 import NetworkFabricPatchableProperties +from ._models_py3 import NetworkFabricProperties +from ._models_py3 import NetworkFabricPropertiesManagementNetworkConfiguration +from ._models_py3 import NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration +from ._models_py3 import NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration +from ._models_py3 import NetworkFabricPropertiesTerminalServerConfiguration +from ._models_py3 import NetworkFabricSku +from ._models_py3 import NetworkFabricSkusListResult +from ._models_py3 import NetworkFabricsListResult +from ._models_py3 import NetworkInterface +from ._models_py3 import NetworkInterfacePatch +from ._models_py3 import NetworkInterfacePatchProperties +from ._models_py3 import NetworkInterfaceProperties +from ._models_py3 import NetworkInterfacesList +from ._models_py3 import NetworkRack +from ._models_py3 import NetworkRackPatch +from ._models_py3 import NetworkRackProperties +from ._models_py3 import NetworkRackSku +from ._models_py3 import NetworkRackSkuPropertiesNetworkDevicesItem +from ._models_py3 import NetworkRackSkusListResult +from ._models_py3 import NetworkRacksListResult +from ._models_py3 import NetworkToNetworkInterconnect +from ._models_py3 import NetworkToNetworkInterconnectPropertiesLayer2Configuration +from ._models_py3 import NetworkToNetworkInterconnectsList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OptionAProperties +from ._models_py3 import OptionAPropertiesBfdConfiguration +from ._models_py3 import OptionBProperties +from ._models_py3 import OptionBPropertiesAutoGenerated +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import RoutePoliciesListResult +from ._models_py3 import RoutePolicy +from ._models_py3 import RoutePolicyPatch +from ._models_py3 import RoutePolicyProperties +from ._models_py3 import RoutePolicyPropertiesStatementsItem +from ._models_py3 import RoutePolicyPropertiesStatementsItemAction +from ._models_py3 import RoutePolicyPropertiesStatementsItemCondition +from ._models_py3 import RoutePolicyPropertiesStatementsProperties +from ._models_py3 import SupportPackageProperties +from ._models_py3 import SystemData +from ._models_py3 import TerminalServerPatchParameters +from ._models_py3 import TerminalServerPatchParametersTerminalServerConfiguration +from ._models_py3 import TerminalServerPatchableProperties +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateAdministrativeState +from ._models_py3 import UpdatePowerCycleProperties +from ._models_py3 import UpdateVersionProperties + +from ._azure_network_fabric_management_service_api_enums import ActionType +from ._azure_network_fabric_management_service_api_enums import AddressFamily +from ._azure_network_fabric_management_service_api_enums import AdministrativeState +from ._azure_network_fabric_management_service_api_enums import AllowASOverride +from ._azure_network_fabric_management_service_api_enums import BooleanEnumProperty +from ._azure_network_fabric_management_service_api_enums import CommunityActionTypes +from ._azure_network_fabric_management_service_api_enums import Condition +from ._azure_network_fabric_management_service_api_enums import ConditionActionType +from ._azure_network_fabric_management_service_api_enums import CreatedByType +from ._azure_network_fabric_management_service_api_enums import EnabledDisabledState +from ._azure_network_fabric_management_service_api_enums import ExpressRouteConnectionState +from ._azure_network_fabric_management_service_api_enums import FailedSucceededState +from ._azure_network_fabric_management_service_api_enums import InterfaceType +from ._azure_network_fabric_management_service_api_enums import IsCurrentVersion +from ._azure_network_fabric_management_service_api_enums import IsTestVersion +from ._azure_network_fabric_management_service_api_enums import NetworkDeviceRackRoleType +from ._azure_network_fabric_management_service_api_enums import NetworkDeviceRoleName +from ._azure_network_fabric_management_service_api_enums import NetworkDeviceRoleTypes +from ._azure_network_fabric_management_service_api_enums import NetworkFabricControllerOperationalState +from ._azure_network_fabric_management_service_api_enums import NetworkFabricOperationalState +from ._azure_network_fabric_management_service_api_enums import NetworkRackRoleName +from ._azure_network_fabric_management_service_api_enums import NniType +from ._azure_network_fabric_management_service_api_enums import OperationalState +from ._azure_network_fabric_management_service_api_enums import OperationalStatus +from ._azure_network_fabric_management_service_api_enums import Origin +from ._azure_network_fabric_management_service_api_enums import PeeringOption +from ._azure_network_fabric_management_service_api_enums import PowerCycleState +from ._azure_network_fabric_management_service_api_enums import PowerEnd +from ._azure_network_fabric_management_service_api_enums import ProvisioningState +from ._azure_network_fabric_management_service_api_enums import ReachabilityState +from ._azure_network_fabric_management_service_api_enums import RedistributeConnectedSubnets +from ._azure_network_fabric_management_service_api_enums import RedistributeStaticRoutes +from ._azure_network_fabric_management_service_api_enums import State +from ._azure_network_fabric_management_service_api_enums import TerminalServerConnectivityState +from ._azure_network_fabric_management_service_api_enums import WellKnownCommunities +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ARPProperties", + "AccessControlList", + "AccessControlListPatch", + "AccessControlListPatchProperties", + "AccessControlListPatchPropertiesConditionsItem", + "AccessControlListProperties", + "AccessControlListPropertiesConditionsItem", + "AccessControlListsListResult", + "AnnotationResource", + "BfdConfiguration", + "Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet", + "Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties", + "Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete", + "Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd", + "ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet", + "ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete", + "ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties", + "EnableDisableOnResources", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ExpressRouteConnectionInformation", + "ExpressRouteStatusDef", + "ExtendedLocation", + "ExternalNetwork", + "ExternalNetworkPatch", + "ExternalNetworkPatchProperties", + "ExternalNetworkPatchableProperties", + "ExternalNetworkProperties", + "ExternalNetworkPropertiesOptionAProperties", + "ExternalNetworksList", + "GetDeviceStatusProperties", + "GetDynamicInterfaceMapsPropertiesItem", + "GetStaticInterfaceMapsPropertiesItem", + "InterfaceStatus", + "InternalNetwork", + "InternalNetworkPatch", + "InternalNetworkPatchProperties", + "InternalNetworkPatchableProperties", + "InternalNetworkPatchablePropertiesBgpConfiguration", + "InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem", + "InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem", + "InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem", + "InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem", + "InternalNetworkPatchablePropertiesStaticRouteConfiguration", + "InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem", + "InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem", + "InternalNetworkProperties", + "InternalNetworksList", + "IpCommunitiesListResult", + "IpCommunity", + "IpCommunityPatch", + "IpCommunityProperties", + "IpExtendedCommunity", + "IpExtendedCommunityListResult", + "IpExtendedCommunityPatch", + "IpExtendedCommunityProperties", + "IpPrefix", + "IpPrefixPatch", + "IpPrefixProperties", + "IpPrefixPropertiesIpPrefixRulesItem", + "IpPrefixesListResult", + "L2IsolationDomain", + "L2IsolationDomainPatch", + "L2IsolationDomainPatchProperties", + "L2IsolationDomainProperties", + "L2IsolationDomainsListResult", + "L3IsolationDomain", + "L3IsolationDomainPatch", + "L3IsolationDomainPatchProperties", + "L3IsolationDomainPatchPropertiesAggregateRouteConfiguration", + "L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem", + "L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem", + "L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy", + "L3IsolationDomainProperties", + "L3IsolationDomainsListResult", + "Layer2Configuration", + "Layer3Configuration", + "Layer3IpPrefixProperties", + "Layer3OptionAProperties", + "NetworkDevice", + "NetworkDevicePatchParameters", + "NetworkDevicePatchParametersProperties", + "NetworkDevicePatchableProperties", + "NetworkDeviceProperties", + "NetworkDeviceSku", + "NetworkDeviceSkuPropertiesInterfacesItem", + "NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem", + "NetworkDeviceSkuPropertiesLimits", + "NetworkDeviceSkuPropertiesSupportedVersionsItem", + "NetworkDeviceSkusListResult", + "NetworkDevicesListResult", + "NetworkFabric", + "NetworkFabricController", + "NetworkFabricControllerPatch", + "NetworkFabricControllerPatchableProperties", + "NetworkFabricControllerProperties", + "NetworkFabricControllerPropertiesInfrastructureServices", + "NetworkFabricControllerPropertiesManagedResourceGroupConfiguration", + "NetworkFabricControllerPropertiesWorkloadServices", + "NetworkFabricControllersListResult", + "NetworkFabricPatchParameters", + "NetworkFabricPatchParametersProperties", + "NetworkFabricPatchableProperties", + "NetworkFabricProperties", + "NetworkFabricPropertiesManagementNetworkConfiguration", + "NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration", + "NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration", + "NetworkFabricPropertiesTerminalServerConfiguration", + "NetworkFabricSku", + "NetworkFabricSkusListResult", + "NetworkFabricsListResult", + "NetworkInterface", + "NetworkInterfacePatch", + "NetworkInterfacePatchProperties", + "NetworkInterfaceProperties", + "NetworkInterfacesList", + "NetworkRack", + "NetworkRackPatch", + "NetworkRackProperties", + "NetworkRackSku", + "NetworkRackSkuPropertiesNetworkDevicesItem", + "NetworkRackSkusListResult", + "NetworkRacksListResult", + "NetworkToNetworkInterconnect", + "NetworkToNetworkInterconnectPropertiesLayer2Configuration", + "NetworkToNetworkInterconnectsList", + "Operation", + "OperationDisplay", + "OperationListResult", + "OptionAProperties", + "OptionAPropertiesBfdConfiguration", + "OptionBProperties", + "OptionBPropertiesAutoGenerated", + "ProxyResource", + "Resource", + "RoutePoliciesListResult", + "RoutePolicy", + "RoutePolicyPatch", + "RoutePolicyProperties", + "RoutePolicyPropertiesStatementsItem", + "RoutePolicyPropertiesStatementsItemAction", + "RoutePolicyPropertiesStatementsItemCondition", + "RoutePolicyPropertiesStatementsProperties", + "SupportPackageProperties", + "SystemData", + "TerminalServerPatchParameters", + "TerminalServerPatchParametersTerminalServerConfiguration", + "TerminalServerPatchableProperties", + "TrackedResource", + "UpdateAdministrativeState", + "UpdatePowerCycleProperties", + "UpdateVersionProperties", + "ActionType", + "AddressFamily", + "AdministrativeState", + "AllowASOverride", + "BooleanEnumProperty", + "CommunityActionTypes", + "Condition", + "ConditionActionType", + "CreatedByType", + "EnabledDisabledState", + "ExpressRouteConnectionState", + "FailedSucceededState", + "InterfaceType", + "IsCurrentVersion", + "IsTestVersion", + "NetworkDeviceRackRoleType", + "NetworkDeviceRoleName", + "NetworkDeviceRoleTypes", + "NetworkFabricControllerOperationalState", + "NetworkFabricOperationalState", + "NetworkRackRoleName", + "NniType", + "OperationalState", + "OperationalStatus", + "Origin", + "PeeringOption", + "PowerCycleState", + "PowerEnd", + "ProvisioningState", + "ReachabilityState", + "RedistributeConnectedSubnets", + "RedistributeStaticRoutes", + "State", + "TerminalServerConnectivityState", + "WellKnownCommunities", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_azure_network_fabric_management_service_api_enums.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_azure_network_fabric_management_service_api_enums.py new file mode 100644 index 000000000000..5d48c22507bd --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_azure_network_fabric_management_service_api_enums.py @@ -0,0 +1,289 @@ +# 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 +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + +class AddressFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IP address family. Example: ipv4 | ipv6.""" + + IPV4 = "ipv4" + IPV6 = "ipv6" + + +class AdministrativeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Administrative state.""" + + ENABLE = "Enable" + DISABLE = "Disable" + + +class AllowASOverride(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enable Or Disable state.""" + + ENABLE = "Enable" + DISABLE = "Disable" + + +class BooleanEnumProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Boolean Enum. Example- True/False.""" + + TRUE = "True" + FALSE = "False" + + +class CommunityActionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """community action types. Example: Permit | Deny.""" + + PERMIT = "Permit" + DENY = "Deny" + + +class Condition(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specify prefix-list bounds.""" + + EQUAL_TO = "EqualTo" + GREATER_THAN_OR_EQUAL_TO = "GreaterThanOrEqualTo" + LESSER_THAN_OR_EQUAL_TO = "LesserThanOrEqualTo" + + +class ConditionActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """action. Example: allow | deny.""" + + ALLOW = "allow" + DENY = "deny" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class EnabledDisabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """EnabledDisabledState state for the resource.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ExpressRouteConnectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Express route connection state for the resource.""" + + CONNECTING = "Connecting" + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + + +class FailedSucceededState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FailedSucceeded state for the resource.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class InterfaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Interface Type. Example: Management/Data.""" + + MANAGEMENT = "Management" + DATA = "Data" + + +class IsCurrentVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If the current version is in use.""" + + TRUE = "true" + FALSE = "false" + + +class IsTestVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If the current version is a test version.""" + + TRUE = "true" + FALSE = "false" + + +class NetworkDeviceRackRoleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Role for the network device.""" + + CE = "CE" + TO_R = "ToR" + NPB = "NPB" + TS = "TS" + MANAGEMENT = "Management" + + +class NetworkDeviceRoleName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Available roles for the network device.""" + + CE = "CE" + TO_R = "ToR" + NPB = "NPB" + TS = "TS" + MANAGEMENT = "Management" + + +class NetworkDeviceRoleTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Available roles for the network device.""" + + CE = "CE" + TO_R = "ToR" + NPB = "NPB" + TS = "TS" + MANAGEMENT = "Management" + + +class NetworkFabricControllerOperationalState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operational state for the resource.""" + + CONFIGURING = "Configuring" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class NetworkFabricOperationalState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operational state for the resource.""" + + PROVISIONING = "Provisioning" + PROVISIONED = "Provisioned" + ERROR_PROVISIONING = "ErrorProvisioning" + DEPROVISIONING = "Deprovisioning" + DEPROVISIONED = "Deprovisioned" + ERROR_DEPROVISIONING = "ErrorDeprovisioning" + DEFERRED_CONTROL = "DeferredControl" + + +class NetworkRackRoleName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role of the Network Rack: Aggregate or Compute.""" + + COMPUTE_RACK = "ComputeRack" + AGGREGATE_RACK = "AggregateRack" + + +class NniType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of NNI used. Example: CE | NPB.""" + + CE = "CE" + NPB = "NPB" + + +class OperationalState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operational state for the resource.""" + + CONFIGURING = "Configuring" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class OperationalStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Primary or Secondary power end.""" + + BOOTED = "Booted" + BOOT_PROMPT = "BootPrompt" + ZTP = "Ztp" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + +class PeeringOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Peering option list.""" + + OPTION_A = "OptionA" + OPTION_B = "OptionB" + + +class PowerCycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """On or Off power cycle state.""" + + ON = "On" + OFF = "Off" + + +class PowerEnd(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Primary or Secondary power end.""" + + PRIMARY = "Primary" + SECONDARY = "Secondary" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + CANCELED = "Canceled" + DELETING = "Deleting" + FAILED = "Failed" + + +class ReachabilityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Generic network reachability state.""" + + REACHABLE = "Reachable" + UNREACHABLE = "Unreachable" + + +class RedistributeConnectedSubnets(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Advertise Connected Subnets. Ex: "True" | "False".""" + + TRUE = "True" + FALSE = "False" + + +class RedistributeStaticRoutes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Advertise Static Routes. Ex: "True" | "False".""" + + TRUE = "True" + FALSE = "False" + + +class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """On or Off toggle state.""" + + ON = "On" + OFF = "Off" + + +class TerminalServerConnectivityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TerminalServerConnectivity state for the resource.""" + + IPV4_REACHABLE = "Ipv4Reachable" + IPV4_UNREACHABLE = "Ipv4Unreachable" + + +class WellKnownCommunities(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """``Internet`` - Advertise routes to internet community. + ``LocalAS`` - Advertise routes to only localAS peers. + ``NoAdvertise`` - Don't advertise routes to any peer. + ``NoExport`` - Don't export to next AS. + ``GShut`` - Graceful Shutdown (GSHUT) withdraw routes before terminating BGP connection. + """ + + INTERNET = "Internet" + LOCAL_AS = "LocalAS" + NO_ADVERTISE = "NoAdvertise" + NO_EXPORT = "NoExport" + G_SHUT = "GShut" diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_models_py3.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_models_py3.py new file mode 100644 index 000000000000..931883d3195a --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_models_py3.py @@ -0,0 +1,8762 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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 +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AccessControlList(TrackedResource): + """The AccessControlList resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar address_family: IP address family. Example: ipv4 | ipv6. Required. Known values are: + "ipv4" and "ipv6". + :vartype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :ivar conditions: Access Control List conditions. Required. + :vartype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPropertiesConditionsItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "address_family": {"required": True}, + "conditions": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "address_family": {"key": "properties.addressFamily", "type": "str"}, + "conditions": {"key": "properties.conditions", "type": "[AccessControlListPropertiesConditionsItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + address_family: Union[str, "_models.AddressFamily"], + conditions: List["_models.AccessControlListPropertiesConditionsItem"], + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword address_family: IP address family. Example: ipv4 | ipv6. Required. Known values are: + "ipv4" and "ipv6". + :paramtype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :keyword conditions: Access Control List conditions. Required. + :paramtype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPropertiesConditionsItem] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.address_family = address_family + self.conditions = conditions + self.provisioning_state = None + + +class AccessControlListPatch(_serialization.Model): + """The AccessControlList patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar address_family: IP address family. Example: ipv4 | ipv6. Known values are: "ipv4" and + "ipv6". + :vartype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :ivar conditions: Access Control List conditions. + :vartype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPatchPropertiesConditionsItem] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "address_family": {"key": "properties.addressFamily", "type": "str"}, + "conditions": {"key": "properties.conditions", "type": "[AccessControlListPatchPropertiesConditionsItem]"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + address_family: Optional[Union[str, "_models.AddressFamily"]] = None, + conditions: Optional[List["_models.AccessControlListPatchPropertiesConditionsItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword address_family: IP address family. Example: ipv4 | ipv6. Known values are: "ipv4" and + "ipv6". + :paramtype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :keyword conditions: Access Control List conditions. + :paramtype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPatchPropertiesConditionsItem] + """ + super().__init__(**kwargs) + self.tags = tags + self.annotation = annotation + self.address_family = address_family + self.conditions = conditions + + +class AnnotationResource(_serialization.Model): + """Switch configuration entries require a description to discern between configuration groups. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(**kwargs) + self.annotation = annotation + + +class AccessControlListPatchProperties(AnnotationResource): + """AccessControlListPatchProperties define the patchable resource properties. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar address_family: IP address family. Example: ipv4 | ipv6. Known values are: "ipv4" and + "ipv6". + :vartype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :ivar conditions: Access Control List conditions. + :vartype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPatchPropertiesConditionsItem] + """ + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "address_family": {"key": "addressFamily", "type": "str"}, + "conditions": {"key": "conditions", "type": "[AccessControlListPatchPropertiesConditionsItem]"}, + } + + def __init__( + self, + *, + annotation: Optional[str] = None, + address_family: Optional[Union[str, "_models.AddressFamily"]] = None, + conditions: Optional[List["_models.AccessControlListPatchPropertiesConditionsItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword address_family: IP address family. Example: ipv4 | ipv6. Known values are: "ipv4" and + "ipv6". + :paramtype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :keyword conditions: Access Control List conditions. + :paramtype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPatchPropertiesConditionsItem] + """ + super().__init__(annotation=annotation, **kwargs) + self.address_family = address_family + self.conditions = conditions + + +class AccessControlListPatchPropertiesConditionsItem(AnnotationResource): + """Access Control List condition model. + + All required parameters must be populated in order to send to Azure. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar sequence_number: sequenceNumber of the Access Control List. Required. + :vartype sequence_number: int + :ivar action: action. Example: allow | deny. Required. Known values are: "allow" and "deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.ConditionActionType + :ivar destination_address: destinationAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. Required. + :vartype destination_address: str + :ivar destination_port: destinationPort. Example: any | 1253. Required. + :vartype destination_port: str + :ivar source_address: sourceAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. Required. + :vartype source_address: str + :ivar source_port: sourcePort. Example: any | 1253. Required. + :vartype source_port: str + :ivar protocol: TCP/IP protocol as defined in the list of IP protocol numbers. Example: 255 + (any) | 0 | 1. Required. + :vartype protocol: int + """ + + _validation = { + "sequence_number": {"required": True}, + "action": {"required": True}, + "destination_address": {"required": True}, + "destination_port": {"required": True}, + "source_address": {"required": True}, + "source_port": {"required": True}, + "protocol": {"required": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "sequence_number": {"key": "sequenceNumber", "type": "int"}, + "action": {"key": "action", "type": "str"}, + "destination_address": {"key": "destinationAddress", "type": "str"}, + "destination_port": {"key": "destinationPort", "type": "str"}, + "source_address": {"key": "sourceAddress", "type": "str"}, + "source_port": {"key": "sourcePort", "type": "str"}, + "protocol": {"key": "protocol", "type": "int"}, + } + + def __init__( + self, + *, + sequence_number: int, + action: Union[str, "_models.ConditionActionType"], + destination_address: str, + destination_port: str, + source_address: str, + source_port: str, + protocol: int, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword sequence_number: sequenceNumber of the Access Control List. Required. + :paramtype sequence_number: int + :keyword action: action. Example: allow | deny. Required. Known values are: "allow" and "deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.ConditionActionType + :keyword destination_address: destinationAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. + Required. + :paramtype destination_address: str + :keyword destination_port: destinationPort. Example: any | 1253. Required. + :paramtype destination_port: str + :keyword source_address: sourceAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. Required. + :paramtype source_address: str + :keyword source_port: sourcePort. Example: any | 1253. Required. + :paramtype source_port: str + :keyword protocol: TCP/IP protocol as defined in the list of IP protocol numbers. Example: 255 + (any) | 0 | 1. Required. + :paramtype protocol: int + """ + super().__init__(annotation=annotation, **kwargs) + self.sequence_number = sequence_number + self.action = action + self.destination_address = destination_address + self.destination_port = destination_port + self.source_address = source_address + self.source_port = source_port + self.protocol = protocol + + +class AccessControlListProperties(AnnotationResource): + """AccessControlListProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar address_family: IP address family. Example: ipv4 | ipv6. Required. Known values are: + "ipv4" and "ipv6". + :vartype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :ivar conditions: Access Control List conditions. Required. + :vartype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPropertiesConditionsItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "address_family": {"required": True}, + "conditions": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "address_family": {"key": "addressFamily", "type": "str"}, + "conditions": {"key": "conditions", "type": "[AccessControlListPropertiesConditionsItem]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + address_family: Union[str, "_models.AddressFamily"], + conditions: List["_models.AccessControlListPropertiesConditionsItem"], + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword address_family: IP address family. Example: ipv4 | ipv6. Required. Known values are: + "ipv4" and "ipv6". + :paramtype address_family: str or ~azure.mgmt.managednetworkfabric.models.AddressFamily + :keyword conditions: Access Control List conditions. Required. + :paramtype conditions: + list[~azure.mgmt.managednetworkfabric.models.AccessControlListPropertiesConditionsItem] + """ + super().__init__(annotation=annotation, **kwargs) + self.address_family = address_family + self.conditions = conditions + self.provisioning_state = None + + +class AccessControlListPropertiesConditionsItem(AnnotationResource): + """Access Control List condition model. + + All required parameters must be populated in order to send to Azure. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar sequence_number: sequenceNumber of the Access Control List. Required. + :vartype sequence_number: int + :ivar action: action. Example: allow | deny. Required. Known values are: "allow" and "deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.ConditionActionType + :ivar destination_address: destinationAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. Required. + :vartype destination_address: str + :ivar destination_port: destinationPort. Example: any | 1253. Required. + :vartype destination_port: str + :ivar source_address: sourceAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. Required. + :vartype source_address: str + :ivar source_port: sourcePort. Example: any | 1253. Required. + :vartype source_port: str + :ivar protocol: TCP/IP protocol as defined in the list of IP protocol numbers. Example: 255 + (any) | 0 | 1. Required. + :vartype protocol: int + """ + + _validation = { + "sequence_number": {"required": True}, + "action": {"required": True}, + "destination_address": {"required": True}, + "destination_port": {"required": True}, + "source_address": {"required": True}, + "source_port": {"required": True}, + "protocol": {"required": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "sequence_number": {"key": "sequenceNumber", "type": "int"}, + "action": {"key": "action", "type": "str"}, + "destination_address": {"key": "destinationAddress", "type": "str"}, + "destination_port": {"key": "destinationPort", "type": "str"}, + "source_address": {"key": "sourceAddress", "type": "str"}, + "source_port": {"key": "sourcePort", "type": "str"}, + "protocol": {"key": "protocol", "type": "int"}, + } + + def __init__( + self, + *, + sequence_number: int, + action: Union[str, "_models.ConditionActionType"], + destination_address: str, + destination_port: str, + source_address: str, + source_port: str, + protocol: int, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword sequence_number: sequenceNumber of the Access Control List. Required. + :paramtype sequence_number: int + :keyword action: action. Example: allow | deny. Required. Known values are: "allow" and "deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.ConditionActionType + :keyword destination_address: destinationAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. + Required. + :paramtype destination_address: str + :keyword destination_port: destinationPort. Example: any | 1253. Required. + :paramtype destination_port: str + :keyword source_address: sourceAddress. Example: any | 1.1.1.0/24 | 1.1.10.10. Required. + :paramtype source_address: str + :keyword source_port: sourcePort. Example: any | 1253. Required. + :paramtype source_port: str + :keyword protocol: TCP/IP protocol as defined in the list of IP protocol numbers. Example: 255 + (any) | 0 | 1. Required. + :paramtype protocol: int + """ + super().__init__(annotation=annotation, **kwargs) + self.sequence_number = sequence_number + self.action = action + self.destination_address = destination_address + self.destination_port = destination_port + self.source_address = source_address + self.source_port = source_port + self.protocol = protocol + + +class AccessControlListsListResult(_serialization.Model): + """List of AccessControlLists. + + :ivar value: List of AccessControlList resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.AccessControlList] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AccessControlList]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AccessControlList"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of AccessControlList resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.AccessControlList] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ARPProperties(_serialization.Model): + """Show ARP table entry properties. + + All required parameters must be populated in order to send to Azure. + + :ivar address: Ipv4 or Ipv6 address. Required. + :vartype address: str + :ivar age: Duration in seconds. Required. + :vartype age: str + :ivar mac_address: Hardware address. Required. + :vartype mac_address: str + :ivar interface: Layer 2 interface name. Required. + :vartype interface: str + :ivar state: ARP status. + :vartype state: str + """ + + _validation = { + "address": {"required": True}, + "age": {"required": True}, + "mac_address": {"required": True}, + "interface": {"required": True}, + } + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + "age": {"key": "age", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + "interface": {"key": "interface", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, *, address: str, age: str, mac_address: str, interface: str, state: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword address: Ipv4 or Ipv6 address. Required. + :paramtype address: str + :keyword age: Duration in seconds. Required. + :paramtype age: str + :keyword mac_address: Hardware address. Required. + :paramtype mac_address: str + :keyword interface: Layer 2 interface name. Required. + :paramtype interface: str + :keyword state: ARP status. + :paramtype state: str + """ + super().__init__(**kwargs) + self.address = address + self.age = age + self.mac_address = mac_address + self.interface = interface + self.state = state + + +class BfdConfiguration(_serialization.Model): + """BFD configuration properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar administrative_state: Administrative state of the BfdConfiguration. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar interval: interval in milliseconds. Example: 300. + :vartype interval: int + :ivar multiplier: Multiplier for the Bfd Configuration. Example: 3. + :vartype multiplier: int + """ + + _validation = { + "administrative_state": {"readonly": True}, + "interval": {"readonly": True}, + "multiplier": {"readonly": True}, + } + + _attribute_map = { + "administrative_state": {"key": "administrativeState", "type": "str"}, + "interval": {"key": "interval", "type": "int"}, + "multiplier": {"key": "multiplier", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.administrative_state = None + self.interval = None + self.multiplier = None + + +class Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet( + _serialization.Model +): + """Route policy set manipulations. + + :ivar ip_community_ids: List of IPCommunity resource IDs. + :vartype ip_community_ids: list[str] + """ + + _attribute_map = { + "ip_community_ids": {"key": "ipCommunityIds", "type": "[str]"}, + } + + def __init__(self, *, ip_community_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_community_ids: List of IPCommunity resource IDs. + :paramtype ip_community_ids: list[str] + """ + super().__init__(**kwargs) + self.ip_community_ids = ip_community_ids + + +class Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties( + _serialization.Model +): + """IP Extended Community Properties. + + :ivar add: Route policy add manipulations. + :vartype add: + ~azure.mgmt.managednetworkfabric.models.Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd + :ivar delete: Route policy delete manipulations. + :vartype delete: + ~azure.mgmt.managednetworkfabric.models.Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete + :ivar set: Route policy set manipulations. + :vartype set: + ~azure.mgmt.managednetworkfabric.models.ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet + """ + + _attribute_map = { + "add": { + "key": "add", + "type": "Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd", + }, + "delete": { + "key": "delete", + "type": "Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete", + }, + "set": { + "key": "set", + "type": "ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet", + }, + } + + def __init__( + self, + *, + add: Optional[ + "_models.Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd" + ] = None, + delete: Optional[ + "_models.Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete" + ] = None, + set: Optional[ + "_models.ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword add: Route policy add manipulations. + :paramtype add: + ~azure.mgmt.managednetworkfabric.models.Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd + :keyword delete: Route policy delete manipulations. + :paramtype delete: + ~azure.mgmt.managednetworkfabric.models.Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete + :keyword set: Route policy set manipulations. + :paramtype set: + ~azure.mgmt.managednetworkfabric.models.ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet + """ + super().__init__(**kwargs) + self.add = add + self.delete = delete + self.set = set + + +class Components1X40N8RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesDelete( + _serialization.Model +): + """Route policy delete manipulations. + + :ivar ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :vartype ip_extended_community_ids: list[str] + """ + + _attribute_map = { + "ip_extended_community_ids": {"key": "ipExtendedCommunityIds", "type": "[str]"}, + } + + def __init__(self, *, ip_extended_community_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :paramtype ip_extended_community_ids: list[str] + """ + super().__init__(**kwargs) + self.ip_extended_community_ids = ip_extended_community_ids + + +class Components7D7R0BSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesAdd( + _serialization.Model +): + """Route policy add manipulations. + + :ivar ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :vartype ip_extended_community_ids: list[str] + """ + + _attribute_map = { + "ip_extended_community_ids": {"key": "ipExtendedCommunityIds", "type": "[str]"}, + } + + def __init__(self, *, ip_extended_community_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :paramtype ip_extended_community_ids: list[str] + """ + super().__init__(**kwargs) + self.ip_extended_community_ids = ip_extended_community_ids + + +class ComponentsRhkgy3SchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunitypropertiesPropertiesSet( + _serialization.Model +): + """Route policy set manipulations. + + :ivar ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :vartype ip_extended_community_ids: list[str] + """ + + _attribute_map = { + "ip_extended_community_ids": {"key": "ipExtendedCommunityIds", "type": "[str]"}, + } + + def __init__(self, *, ip_extended_community_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :paramtype ip_extended_community_ids: list[str] + """ + super().__init__(**kwargs) + self.ip_extended_community_ids = ip_extended_community_ids + + +class ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete( + _serialization.Model +): + """Route policy delete manipulations. + + :ivar ip_community_ids: List of IPCommunity resource IDs. + :vartype ip_community_ids: list[str] + """ + + _attribute_map = { + "ip_community_ids": {"key": "ipCommunityIds", "type": "[str]"}, + } + + def __init__(self, *, ip_community_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_community_ids: List of IPCommunity resource IDs. + :paramtype ip_community_ids: list[str] + """ + super().__init__(**kwargs) + self.ip_community_ids = ip_community_ids + + +class ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties( + _serialization.Model +): + """ipCommunity Properties. + + :ivar add: Route policy add manipulations. + :vartype add: ~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsProperties + :ivar delete: Route policy delete manipulations. + :vartype delete: + ~azure.mgmt.managednetworkfabric.models.ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete + :ivar set: Route policy set manipulations. + :vartype set: + ~azure.mgmt.managednetworkfabric.models.Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet + """ + + _attribute_map = { + "add": {"key": "add", "type": "RoutePolicyPropertiesStatementsProperties"}, + "delete": { + "key": "delete", + "type": "ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete", + }, + "set": { + "key": "set", + "type": "Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet", + }, + } + + def __init__( + self, + *, + add: Optional["_models.RoutePolicyPropertiesStatementsProperties"] = None, + delete: Optional[ + "_models.ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete" + ] = None, + set: Optional[ + "_models.Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword add: Route policy add manipulations. + :paramtype add: + ~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsProperties + :keyword delete: Route policy delete manipulations. + :paramtype delete: + ~azure.mgmt.managednetworkfabric.models.ComponentsTsen4NSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesDelete + :keyword set: Route policy set manipulations. + :paramtype set: + ~azure.mgmt.managednetworkfabric.models.Components161Cc9RSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunitypropertiesPropertiesSet + """ + super().__init__(**kwargs) + self.add = add + self.delete = delete + self.set = set + + +class EnableDisableOnResources(_serialization.Model): + """Update administrative state on list of resources. + + :ivar resource_ids: Network Fabrics or Network Rack resource Id. + :vartype resource_ids: list[str] + """ + + _attribute_map = { + "resource_ids": {"key": "resourceIds", "type": "[str]"}, + } + + def __init__(self, *, resource_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword resource_ids: Network Fabrics or Network Rack resource Id. + :paramtype resource_ids: list[str] + """ + super().__init__(**kwargs) + self.resource_ids = resource_ids + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.managednetworkfabric.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.managednetworkfabric.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.managednetworkfabric.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.managednetworkfabric.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExpressRouteConnectionInformation(_serialization.Model): + """The ExpressRoute circuit ID and the Auth Key are required for you to successfully deploy NFC + service. + + All required parameters must be populated in order to send to Azure. + + :ivar express_route_circuit_id: The express route circuit Azure resource ID, must be of type + Microsoft.Network/expressRouteCircuits/circuitName. The ExpressRoute Circuit is a mandatory + attribute. Required. + :vartype express_route_circuit_id: str + :ivar express_route_authorization_key: Authorization key for the circuit, must be of type + Microsoft.Network/expressRouteCircuits/authorizations. The Auth Key is a mandatory attribute. + Required. + :vartype express_route_authorization_key: str + """ + + _validation = { + "express_route_circuit_id": {"required": True}, + "express_route_authorization_key": {"required": True}, + } + + _attribute_map = { + "express_route_circuit_id": {"key": "expressRouteCircuitId", "type": "str"}, + "express_route_authorization_key": {"key": "expressRouteAuthorizationKey", "type": "str"}, + } + + def __init__(self, *, express_route_circuit_id: str, express_route_authorization_key: str, **kwargs: Any) -> None: + """ + :keyword express_route_circuit_id: The express route circuit Azure resource ID, must be of type + Microsoft.Network/expressRouteCircuits/circuitName. The ExpressRoute Circuit is a mandatory + attribute. Required. + :paramtype express_route_circuit_id: str + :keyword express_route_authorization_key: Authorization key for the circuit, must be of type + Microsoft.Network/expressRouteCircuits/authorizations. The Auth Key is a mandatory attribute. + Required. + :paramtype express_route_authorization_key: str + """ + super().__init__(**kwargs) + self.express_route_circuit_id = express_route_circuit_id + self.express_route_authorization_key = express_route_authorization_key + + +class ExpressRouteStatusDef(_serialization.Model): + """ExpressRouteStatus defines the resource properties. + + :ivar express_route_circuit_id: The express route circuit Azure resource ID, must be of type + Microsoft.Network/expressRouteCircuits/circuitName. + :vartype express_route_circuit_id: str + :ivar express_route_status: Express route connection state for the resource. Known values are: + "Connecting", "Connected", and "Disconnected". + :vartype express_route_status: str or + ~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionState + """ + + _attribute_map = { + "express_route_circuit_id": {"key": "expressRouteCircuitId", "type": "str"}, + "express_route_status": {"key": "expressRouteStatus", "type": "str"}, + } + + def __init__( + self, + *, + express_route_circuit_id: Optional[str] = None, + express_route_status: Optional[Union[str, "_models.ExpressRouteConnectionState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword express_route_circuit_id: The express route circuit Azure resource ID, must be of type + Microsoft.Network/expressRouteCircuits/circuitName. + :paramtype express_route_circuit_id: str + :keyword express_route_status: Express route connection state for the resource. Known values + are: "Connecting", "Connected", and "Disconnected". + :paramtype express_route_status: str or + ~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionState + """ + super().__init__(**kwargs) + self.express_route_circuit_id = express_route_circuit_id + self.express_route_status = express_route_status + + +class ExtendedLocation(_serialization.Model): + """The extended location. + + :ivar type: The extended location type. + :vartype type: str + :ivar name: The extended location name. + :vartype name: str + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword type: The extended location type. + :paramtype type: str + :keyword name: The extended location name. + :paramtype name: str + """ + super().__init__(**kwargs) + self.type = type + self.name = name + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class ExternalNetwork(ProxyResource): # pylint: disable=too-many-instance-attributes + """Defines the ExternalNetwork item. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar network_to_network_interconnect_id: Gets the networkToNetworkInterconnectId of the + resource. + :vartype network_to_network_interconnect_id: str + :ivar disabled_on_resources: List of resources the externalNetwork is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: AdministrativeState of the externalNetwork. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar peering_option: Peering option list. Required. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar option_b_properties: option B properties object. + :vartype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :ivar option_a_properties: option A properties object. + :vartype option_a_properties: + ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPropertiesOptionAProperties + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of exportRoutePolicy. + :vartype export_route_policy_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "network_to_network_interconnect_id": {"readonly": True}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "peering_option": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "network_to_network_interconnect_id": {"key": "properties.networkToNetworkInterconnectId", "type": "str"}, + "disabled_on_resources": {"key": "properties.disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "properties.administrativeState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "peering_option": {"key": "properties.peeringOption", "type": "str"}, + "option_b_properties": {"key": "properties.optionBProperties", "type": "OptionBProperties"}, + "option_a_properties": { + "key": "properties.optionAProperties", + "type": "ExternalNetworkPropertiesOptionAProperties", + }, + "import_route_policy_id": {"key": "properties.importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "properties.exportRoutePolicyId", "type": "str"}, + } + + def __init__( + self, + *, + peering_option: Union[str, "_models.PeeringOption"], + annotation: Optional[str] = None, + option_b_properties: Optional["_models.OptionBProperties"] = None, + option_a_properties: Optional["_models.ExternalNetworkPropertiesOptionAProperties"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword peering_option: Peering option list. Required. Known values are: "OptionA" and + "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_b_properties: option B properties object. + :paramtype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :keyword option_a_properties: option A properties object. + :paramtype option_a_properties: + ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPropertiesOptionAProperties + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of exportRoutePolicy. + :paramtype export_route_policy_id: str + """ + super().__init__(**kwargs) + self.annotation = annotation + self.network_to_network_interconnect_id = None + self.disabled_on_resources = None + self.administrative_state = None + self.provisioning_state = None + self.peering_option = peering_option + self.option_b_properties = option_b_properties + self.option_a_properties = option_a_properties + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + + +class ExternalNetworkPatch(_serialization.Model): + """The ExternalNetwork patch resource definition. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar peering_option: Peering option list. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar option_b_properties: option B properties object. + :vartype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :ivar option_a_properties: option A properties object. + :vartype option_a_properties: ~azure.mgmt.managednetworkfabric.models.Layer3OptionAProperties + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of exportRoutePolicy. + :vartype export_route_policy_id: str + """ + + _attribute_map = { + "annotation": {"key": "properties.annotation", "type": "str"}, + "peering_option": {"key": "properties.peeringOption", "type": "str"}, + "option_b_properties": {"key": "properties.optionBProperties", "type": "OptionBProperties"}, + "option_a_properties": {"key": "properties.optionAProperties", "type": "Layer3OptionAProperties"}, + "import_route_policy_id": {"key": "properties.importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "properties.exportRoutePolicyId", "type": "str"}, + } + + def __init__( + self, + *, + annotation: Optional[str] = None, + peering_option: Optional[Union[str, "_models.PeeringOption"]] = None, + option_b_properties: Optional["_models.OptionBProperties"] = None, + option_a_properties: Optional["_models.Layer3OptionAProperties"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword peering_option: Peering option list. Known values are: "OptionA" and "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_b_properties: option B properties object. + :paramtype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :keyword option_a_properties: option A properties object. + :paramtype option_a_properties: ~azure.mgmt.managednetworkfabric.models.Layer3OptionAProperties + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of exportRoutePolicy. + :paramtype export_route_policy_id: str + """ + super().__init__(**kwargs) + self.annotation = annotation + self.peering_option = peering_option + self.option_b_properties = option_b_properties + self.option_a_properties = option_a_properties + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + + +class ExternalNetworkPatchableProperties(_serialization.Model): + """The ExternalNetwork patchable properties. + + :ivar peering_option: Peering option list. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar option_b_properties: option B properties object. + :vartype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :ivar option_a_properties: option A properties object. + :vartype option_a_properties: ~azure.mgmt.managednetworkfabric.models.Layer3OptionAProperties + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of exportRoutePolicy. + :vartype export_route_policy_id: str + """ + + _attribute_map = { + "peering_option": {"key": "peeringOption", "type": "str"}, + "option_b_properties": {"key": "optionBProperties", "type": "OptionBProperties"}, + "option_a_properties": {"key": "optionAProperties", "type": "Layer3OptionAProperties"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + } + + def __init__( + self, + *, + peering_option: Optional[Union[str, "_models.PeeringOption"]] = None, + option_b_properties: Optional["_models.OptionBProperties"] = None, + option_a_properties: Optional["_models.Layer3OptionAProperties"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword peering_option: Peering option list. Known values are: "OptionA" and "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_b_properties: option B properties object. + :paramtype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :keyword option_a_properties: option A properties object. + :paramtype option_a_properties: ~azure.mgmt.managednetworkfabric.models.Layer3OptionAProperties + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of exportRoutePolicy. + :paramtype export_route_policy_id: str + """ + super().__init__(**kwargs) + self.peering_option = peering_option + self.option_b_properties = option_b_properties + self.option_a_properties = option_a_properties + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + + +class ExternalNetworkPatchProperties(AnnotationResource, ExternalNetworkPatchableProperties): + """External Network Patch properties. + + :ivar peering_option: Peering option list. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar option_b_properties: option B properties object. + :vartype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :ivar option_a_properties: option A properties object. + :vartype option_a_properties: ~azure.mgmt.managednetworkfabric.models.Layer3OptionAProperties + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of exportRoutePolicy. + :vartype export_route_policy_id: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _attribute_map = { + "peering_option": {"key": "peeringOption", "type": "str"}, + "option_b_properties": {"key": "optionBProperties", "type": "OptionBProperties"}, + "option_a_properties": {"key": "optionAProperties", "type": "Layer3OptionAProperties"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + "annotation": {"key": "annotation", "type": "str"}, + } + + def __init__( + self, + *, + peering_option: Optional[Union[str, "_models.PeeringOption"]] = None, + option_b_properties: Optional["_models.OptionBProperties"] = None, + option_a_properties: Optional["_models.Layer3OptionAProperties"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword peering_option: Peering option list. Known values are: "OptionA" and "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_b_properties: option B properties object. + :paramtype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :keyword option_a_properties: option A properties object. + :paramtype option_a_properties: ~azure.mgmt.managednetworkfabric.models.Layer3OptionAProperties + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of exportRoutePolicy. + :paramtype export_route_policy_id: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__( + annotation=annotation, + peering_option=peering_option, + option_b_properties=option_b_properties, + option_a_properties=option_a_properties, + import_route_policy_id=import_route_policy_id, + export_route_policy_id=export_route_policy_id, + **kwargs + ) + self.peering_option = peering_option + self.option_b_properties = option_b_properties + self.option_a_properties = option_a_properties + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + self.annotation = annotation + + +class ExternalNetworkProperties(AnnotationResource): + """External Network Properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar network_to_network_interconnect_id: Gets the networkToNetworkInterconnectId of the + resource. + :vartype network_to_network_interconnect_id: str + :ivar disabled_on_resources: List of resources the externalNetwork is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: AdministrativeState of the externalNetwork. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar peering_option: Peering option list. Required. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar option_b_properties: option B properties object. + :vartype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :ivar option_a_properties: option A properties object. + :vartype option_a_properties: + ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPropertiesOptionAProperties + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of exportRoutePolicy. + :vartype export_route_policy_id: str + """ + + _validation = { + "network_to_network_interconnect_id": {"readonly": True}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "peering_option": {"required": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "network_to_network_interconnect_id": {"key": "networkToNetworkInterconnectId", "type": "str"}, + "disabled_on_resources": {"key": "disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "administrativeState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "peering_option": {"key": "peeringOption", "type": "str"}, + "option_b_properties": {"key": "optionBProperties", "type": "OptionBProperties"}, + "option_a_properties": {"key": "optionAProperties", "type": "ExternalNetworkPropertiesOptionAProperties"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + } + + def __init__( + self, + *, + peering_option: Union[str, "_models.PeeringOption"], + annotation: Optional[str] = None, + option_b_properties: Optional["_models.OptionBProperties"] = None, + option_a_properties: Optional["_models.ExternalNetworkPropertiesOptionAProperties"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword peering_option: Peering option list. Required. Known values are: "OptionA" and + "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_b_properties: option B properties object. + :paramtype option_b_properties: ~azure.mgmt.managednetworkfabric.models.OptionBProperties + :keyword option_a_properties: option A properties object. + :paramtype option_a_properties: + ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPropertiesOptionAProperties + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of exportRoutePolicy. + :paramtype export_route_policy_id: str + """ + super().__init__(annotation=annotation, **kwargs) + self.network_to_network_interconnect_id = None + self.disabled_on_resources = None + self.administrative_state = None + self.provisioning_state = None + self.peering_option = peering_option + self.option_b_properties = option_b_properties + self.option_a_properties = option_a_properties + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + + +class Layer3IpPrefixProperties(_serialization.Model): + """Layer 3 primary and secondary ip address prefixes. + + :ivar primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv4_prefix: str + :ivar primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv6_prefix: str + :ivar secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv4_prefix: str + :ivar secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv6_prefix: str + """ + + _attribute_map = { + "primary_ipv4_prefix": {"key": "primaryIpv4Prefix", "type": "str"}, + "primary_ipv6_prefix": {"key": "primaryIpv6Prefix", "type": "str"}, + "secondary_ipv4_prefix": {"key": "secondaryIpv4Prefix", "type": "str"}, + "secondary_ipv6_prefix": {"key": "secondaryIpv6Prefix", "type": "str"}, + } + + def __init__( + self, + *, + primary_ipv4_prefix: Optional[str] = None, + primary_ipv6_prefix: Optional[str] = None, + secondary_ipv4_prefix: Optional[str] = None, + secondary_ipv6_prefix: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv4_prefix: str + :keyword primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv6_prefix: str + :keyword secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv4_prefix: str + :keyword secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv6_prefix: str + """ + super().__init__(**kwargs) + self.primary_ipv4_prefix = primary_ipv4_prefix + self.primary_ipv6_prefix = primary_ipv6_prefix + self.secondary_ipv4_prefix = secondary_ipv4_prefix + self.secondary_ipv6_prefix = secondary_ipv6_prefix + + +class Layer3OptionAProperties(Layer3IpPrefixProperties): + """Peering optionA properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv4_prefix: str + :ivar primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv6_prefix: str + :ivar secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv4_prefix: str + :ivar secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv6_prefix: str + :ivar mtu: MTU to use for option A peering. + :vartype mtu: int + :ivar vlan_id: Vlan identifier. Example : 501. + :vartype vlan_id: int + :ivar fabric_asn: Fabric ASN number. Example 65001. + :vartype fabric_asn: int + :ivar peer_asn: Peer ASN number.Example : 28. + :vartype peer_asn: int + :ivar bfd_configuration: BFD configuration properties. + :vartype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + "vlan_id": {"maximum": 4095, "minimum": 501}, + "fabric_asn": {"readonly": True, "maximum": 65535, "minimum": 1}, + "peer_asn": {"maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "primary_ipv4_prefix": {"key": "primaryIpv4Prefix", "type": "str"}, + "primary_ipv6_prefix": {"key": "primaryIpv6Prefix", "type": "str"}, + "secondary_ipv4_prefix": {"key": "secondaryIpv4Prefix", "type": "str"}, + "secondary_ipv6_prefix": {"key": "secondaryIpv6Prefix", "type": "str"}, + "mtu": {"key": "mtu", "type": "int"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + "fabric_asn": {"key": "fabricASN", "type": "int"}, + "peer_asn": {"key": "peerASN", "type": "int"}, + "bfd_configuration": {"key": "bfdConfiguration", "type": "BfdConfiguration"}, + } + + def __init__( + self, + *, + primary_ipv4_prefix: Optional[str] = None, + primary_ipv6_prefix: Optional[str] = None, + secondary_ipv4_prefix: Optional[str] = None, + secondary_ipv6_prefix: Optional[str] = None, + mtu: int = 1500, + vlan_id: Optional[int] = None, + peer_asn: Optional[int] = None, + bfd_configuration: Optional["_models.BfdConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv4_prefix: str + :keyword primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv6_prefix: str + :keyword secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv4_prefix: str + :keyword secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv6_prefix: str + :keyword mtu: MTU to use for option A peering. + :paramtype mtu: int + :keyword vlan_id: Vlan identifier. Example : 501. + :paramtype vlan_id: int + :keyword peer_asn: Peer ASN number.Example : 28. + :paramtype peer_asn: int + :keyword bfd_configuration: BFD configuration properties. + :paramtype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + """ + super().__init__( + primary_ipv4_prefix=primary_ipv4_prefix, + primary_ipv6_prefix=primary_ipv6_prefix, + secondary_ipv4_prefix=secondary_ipv4_prefix, + secondary_ipv6_prefix=secondary_ipv6_prefix, + **kwargs + ) + self.mtu = mtu + self.vlan_id = vlan_id + self.fabric_asn = None + self.peer_asn = peer_asn + self.bfd_configuration = bfd_configuration + + +class ExternalNetworkPropertiesOptionAProperties(Layer3OptionAProperties): + """option A properties object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv4_prefix: str + :ivar primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv6_prefix: str + :ivar secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv4_prefix: str + :ivar secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv6_prefix: str + :ivar mtu: MTU to use for option A peering. + :vartype mtu: int + :ivar vlan_id: Vlan identifier. Example : 501. + :vartype vlan_id: int + :ivar fabric_asn: Fabric ASN number. Example 65001. + :vartype fabric_asn: int + :ivar peer_asn: Peer ASN number.Example : 28. + :vartype peer_asn: int + :ivar bfd_configuration: BFD configuration properties. + :vartype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + "vlan_id": {"maximum": 4095, "minimum": 501}, + "fabric_asn": {"readonly": True, "maximum": 65535, "minimum": 1}, + "peer_asn": {"maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "primary_ipv4_prefix": {"key": "primaryIpv4Prefix", "type": "str"}, + "primary_ipv6_prefix": {"key": "primaryIpv6Prefix", "type": "str"}, + "secondary_ipv4_prefix": {"key": "secondaryIpv4Prefix", "type": "str"}, + "secondary_ipv6_prefix": {"key": "secondaryIpv6Prefix", "type": "str"}, + "mtu": {"key": "mtu", "type": "int"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + "fabric_asn": {"key": "fabricASN", "type": "int"}, + "peer_asn": {"key": "peerASN", "type": "int"}, + "bfd_configuration": {"key": "bfdConfiguration", "type": "BfdConfiguration"}, + } + + def __init__( + self, + *, + primary_ipv4_prefix: Optional[str] = None, + primary_ipv6_prefix: Optional[str] = None, + secondary_ipv4_prefix: Optional[str] = None, + secondary_ipv6_prefix: Optional[str] = None, + mtu: int = 1500, + vlan_id: Optional[int] = None, + peer_asn: Optional[int] = None, + bfd_configuration: Optional["_models.BfdConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv4_prefix: str + :keyword primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv6_prefix: str + :keyword secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv4_prefix: str + :keyword secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv6_prefix: str + :keyword mtu: MTU to use for option A peering. + :paramtype mtu: int + :keyword vlan_id: Vlan identifier. Example : 501. + :paramtype vlan_id: int + :keyword peer_asn: Peer ASN number.Example : 28. + :paramtype peer_asn: int + :keyword bfd_configuration: BFD configuration properties. + :paramtype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + """ + super().__init__( + primary_ipv4_prefix=primary_ipv4_prefix, + primary_ipv6_prefix=primary_ipv6_prefix, + secondary_ipv4_prefix=secondary_ipv4_prefix, + secondary_ipv6_prefix=secondary_ipv6_prefix, + mtu=mtu, + vlan_id=vlan_id, + peer_asn=peer_asn, + bfd_configuration=bfd_configuration, + **kwargs + ) + + +class ExternalNetworksList(_serialization.Model): + """List of ExternalNetworks. + + :ivar value: List of ExternalNetworks resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExternalNetwork]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ExternalNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of ExternalNetworks resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GetDeviceStatusProperties(_serialization.Model): + """Get Device status response properties. + + All required parameters must be populated in order to send to Azure. + + :ivar operational_status: Primary or Secondary power end. Required. Known values are: "Booted", + "BootPrompt", and "Ztp". + :vartype operational_status: str or ~azure.mgmt.managednetworkfabric.models.OperationalStatus + :ivar power_cycle_state: On or Off power cycle state. Required. Known values are: "On" and + "Off". + :vartype power_cycle_state: str or ~azure.mgmt.managednetworkfabric.models.PowerCycleState + :ivar serial_number: The serial number of the device. Required. + :vartype serial_number: str + """ + + _validation = { + "operational_status": {"required": True}, + "power_cycle_state": {"required": True}, + "serial_number": {"required": True}, + } + + _attribute_map = { + "operational_status": {"key": "operationalStatus", "type": "str"}, + "power_cycle_state": {"key": "powerCycleState", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + } + + def __init__( + self, + *, + operational_status: Union[str, "_models.OperationalStatus"], + power_cycle_state: Union[str, "_models.PowerCycleState"], + serial_number: str, + **kwargs: Any + ) -> None: + """ + :keyword operational_status: Primary or Secondary power end. Required. Known values are: + "Booted", "BootPrompt", and "Ztp". + :paramtype operational_status: str or ~azure.mgmt.managednetworkfabric.models.OperationalStatus + :keyword power_cycle_state: On or Off power cycle state. Required. Known values are: "On" and + "Off". + :paramtype power_cycle_state: str or ~azure.mgmt.managednetworkfabric.models.PowerCycleState + :keyword serial_number: The serial number of the device. Required. + :paramtype serial_number: str + """ + super().__init__(**kwargs) + self.operational_status = operational_status + self.power_cycle_state = power_cycle_state + self.serial_number = serial_number + + +class InterfaceStatus(_serialization.Model): + """Interface running status properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar administrative_state: The interface administrative state. Known values are: "Enabled" and + "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar operational_status: The interface operational status. + :vartype operational_status: str + :ivar phy_status: The physical status. + :vartype phy_status: str + :ivar transceiver_status: The interface transceiver type. Example: up or down. + :vartype transceiver_status: str + :ivar connected_to: Connected to ARM resource or external interface. + :vartype connected_to: str + """ + + _validation = { + "administrative_state": {"readonly": True}, + } + + _attribute_map = { + "administrative_state": {"key": "administrativeState", "type": "str"}, + "operational_status": {"key": "operationalStatus", "type": "str"}, + "phy_status": {"key": "phyStatus", "type": "str"}, + "transceiver_status": {"key": "transceiverStatus", "type": "str"}, + "connected_to": {"key": "connectedTo", "type": "str"}, + } + + def __init__( + self, + *, + operational_status: Optional[str] = None, + phy_status: Optional[str] = None, + transceiver_status: Optional[str] = None, + connected_to: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword operational_status: The interface operational status. + :paramtype operational_status: str + :keyword phy_status: The physical status. + :paramtype phy_status: str + :keyword transceiver_status: The interface transceiver type. Example: up or down. + :paramtype transceiver_status: str + :keyword connected_to: Connected to ARM resource or external interface. + :paramtype connected_to: str + """ + super().__init__(**kwargs) + self.administrative_state = None + self.operational_status = operational_status + self.phy_status = phy_status + self.transceiver_status = transceiver_status + self.connected_to = connected_to + + +class GetDynamicInterfaceMapsPropertiesItem(InterfaceStatus): + """Get Device static interface maps as per topology. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar administrative_state: The interface administrative state. Known values are: "Enabled" and + "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar operational_status: The interface operational status. + :vartype operational_status: str + :ivar phy_status: The physical status. + :vartype phy_status: str + :ivar transceiver_status: The interface transceiver type. Example: up or down. + :vartype transceiver_status: str + :ivar connected_to: Connected to ARM resource or external interface. + :vartype connected_to: str + :ivar name: The interface name. + :vartype name: str + """ + + _validation = { + "administrative_state": {"readonly": True}, + } + + _attribute_map = { + "administrative_state": {"key": "administrativeState", "type": "str"}, + "operational_status": {"key": "operationalStatus", "type": "str"}, + "phy_status": {"key": "phyStatus", "type": "str"}, + "transceiver_status": {"key": "transceiverStatus", "type": "str"}, + "connected_to": {"key": "connectedTo", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + operational_status: Optional[str] = None, + phy_status: Optional[str] = None, + transceiver_status: Optional[str] = None, + connected_to: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword operational_status: The interface operational status. + :paramtype operational_status: str + :keyword phy_status: The physical status. + :paramtype phy_status: str + :keyword transceiver_status: The interface transceiver type. Example: up or down. + :paramtype transceiver_status: str + :keyword connected_to: Connected to ARM resource or external interface. + :paramtype connected_to: str + :keyword name: The interface name. + :paramtype name: str + """ + super().__init__( + operational_status=operational_status, + phy_status=phy_status, + transceiver_status=transceiver_status, + connected_to=connected_to, + **kwargs + ) + self.name = name + + +class GetStaticInterfaceMapsPropertiesItem(_serialization.Model): + """Get Device static interface maps as per topology. + + :ivar name: The interface name. + :vartype name: str + :ivar description: The interface description. + :vartype description: str + :ivar identifier: The interface identifier. + :vartype identifier: str + :ivar interface_type: The interface type. Example: Ethernet. + :vartype interface_type: str + :ivar connector_type: The physical cable connector type. Example: Optical. + :vartype connector_type: str + :ivar connected_to: Connected to ARM resource or external interface. + :vartype connected_to: str + :ivar speed: The interface speed. Example: 100. + :vartype speed: float + :ivar channel_group_id: The port channel group id. + :vartype channel_group_id: float + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "identifier": {"key": "identifier", "type": "str"}, + "interface_type": {"key": "interfaceType", "type": "str"}, + "connector_type": {"key": "connectorType", "type": "str"}, + "connected_to": {"key": "connectedTo", "type": "str"}, + "speed": {"key": "speed", "type": "float"}, + "channel_group_id": {"key": "channelGroupId", "type": "float"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + identifier: Optional[str] = None, + interface_type: Optional[str] = None, + connector_type: Optional[str] = None, + connected_to: Optional[str] = None, + speed: Optional[float] = None, + channel_group_id: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The interface name. + :paramtype name: str + :keyword description: The interface description. + :paramtype description: str + :keyword identifier: The interface identifier. + :paramtype identifier: str + :keyword interface_type: The interface type. Example: Ethernet. + :paramtype interface_type: str + :keyword connector_type: The physical cable connector type. Example: Optical. + :paramtype connector_type: str + :keyword connected_to: Connected to ARM resource or external interface. + :paramtype connected_to: str + :keyword speed: The interface speed. Example: 100. + :paramtype speed: float + :keyword channel_group_id: The port channel group id. + :paramtype channel_group_id: float + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.identifier = identifier + self.interface_type = interface_type + self.connector_type = connector_type + self.connected_to = connected_to + self.speed = speed + self.channel_group_id = channel_group_id + + +class InternalNetwork(ProxyResource): # pylint: disable=too-many-instance-attributes + """Defines the InternalNetwork item. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar mtu: Maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :vartype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :ivar connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :vartype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :ivar static_route_configuration: staticRouteConfiguration model. + :vartype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :ivar bgp_configuration: BGP configuration properties. + :vartype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype export_route_policy_id: str + :ivar disabled_on_resources: List of resources the InternalNetwork is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: Administrative state of the InternalNetwork. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar bgp_disabled_on_resources: List of resources the BGP is disabled on. Can be either entire + NetworkFabric or NetworkRack. + :vartype bgp_disabled_on_resources: list[str] + :ivar bfd_disabled_on_resources: List of resources the BFD for BGP is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype bfd_disabled_on_resources: list[str] + :ivar bfd_for_static_routes_disabled_on_resources: List of resources the BFD of StaticRoutes is + disabled on. Can be either entire NetworkFabric or NetworkRack. + :vartype bfd_for_static_routes_disabled_on_resources: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar vlan_id: Vlan identifier. Example: 1001. Required. + :vartype vlan_id: int + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "mtu": {"maximum": 9000, "minimum": 1500}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "bgp_disabled_on_resources": {"readonly": True}, + "bfd_disabled_on_resources": {"readonly": True}, + "bfd_for_static_routes_disabled_on_resources": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "vlan_id": {"required": True, "maximum": 4095, "minimum": 100}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "mtu": {"key": "properties.mtu", "type": "int"}, + "connected_i_pv4_subnets": { + "key": "properties.connectedIPv4Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem]", + }, + "connected_i_pv6_subnets": { + "key": "properties.connectedIPv6Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem]", + }, + "static_route_configuration": { + "key": "properties.staticRouteConfiguration", + "type": "InternalNetworkPatchablePropertiesStaticRouteConfiguration", + }, + "bgp_configuration": { + "key": "properties.bgpConfiguration", + "type": "InternalNetworkPatchablePropertiesBgpConfiguration", + }, + "import_route_policy_id": {"key": "properties.importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "properties.exportRoutePolicyId", "type": "str"}, + "disabled_on_resources": {"key": "properties.disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "properties.administrativeState", "type": "str"}, + "bgp_disabled_on_resources": {"key": "properties.bgpDisabledOnResources", "type": "[str]"}, + "bfd_disabled_on_resources": {"key": "properties.bfdDisabledOnResources", "type": "[str]"}, + "bfd_for_static_routes_disabled_on_resources": { + "key": "properties.bfdForStaticRoutesDisabledOnResources", + "type": "[str]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vlan_id": {"key": "properties.vlanId", "type": "int"}, + } + + def __init__( + self, + *, + vlan_id: int, + annotation: Optional[str] = None, + mtu: int = 1500, + connected_i_pv4_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem"] + ] = None, + connected_i_pv6_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem"] + ] = None, + static_route_configuration: Optional[ + "_models.InternalNetworkPatchablePropertiesStaticRouteConfiguration" + ] = None, + bgp_configuration: Optional["_models.InternalNetworkPatchablePropertiesBgpConfiguration"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword mtu: Maximum transmission unit. Default value is 1500. + :paramtype mtu: int + :keyword connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :paramtype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :keyword connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :paramtype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :keyword static_route_configuration: staticRouteConfiguration model. + :paramtype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :keyword bgp_configuration: BGP configuration properties. + :paramtype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype export_route_policy_id: str + :keyword vlan_id: Vlan identifier. Example: 1001. Required. + :paramtype vlan_id: int + """ + super().__init__(**kwargs) + self.annotation = annotation + self.mtu = mtu + self.connected_i_pv4_subnets = connected_i_pv4_subnets + self.connected_i_pv6_subnets = connected_i_pv6_subnets + self.static_route_configuration = static_route_configuration + self.bgp_configuration = bgp_configuration + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + self.disabled_on_resources = None + self.administrative_state = None + self.bgp_disabled_on_resources = None + self.bfd_disabled_on_resources = None + self.bfd_for_static_routes_disabled_on_resources = None + self.provisioning_state = None + self.vlan_id = vlan_id + + +class InternalNetworkPatch(_serialization.Model): + """The InternalNetwork patch resource definition. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar mtu: Maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :vartype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :ivar connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :vartype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :ivar static_route_configuration: staticRouteConfiguration model. + :vartype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :ivar bgp_configuration: BGP configuration properties. + :vartype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype export_route_policy_id: str + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + } + + _attribute_map = { + "annotation": {"key": "properties.annotation", "type": "str"}, + "mtu": {"key": "properties.mtu", "type": "int"}, + "connected_i_pv4_subnets": { + "key": "properties.connectedIPv4Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem]", + }, + "connected_i_pv6_subnets": { + "key": "properties.connectedIPv6Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem]", + }, + "static_route_configuration": { + "key": "properties.staticRouteConfiguration", + "type": "InternalNetworkPatchablePropertiesStaticRouteConfiguration", + }, + "bgp_configuration": { + "key": "properties.bgpConfiguration", + "type": "InternalNetworkPatchablePropertiesBgpConfiguration", + }, + "import_route_policy_id": {"key": "properties.importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "properties.exportRoutePolicyId", "type": "str"}, + } + + def __init__( + self, + *, + annotation: Optional[str] = None, + mtu: int = 1500, + connected_i_pv4_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem"] + ] = None, + connected_i_pv6_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem"] + ] = None, + static_route_configuration: Optional[ + "_models.InternalNetworkPatchablePropertiesStaticRouteConfiguration" + ] = None, + bgp_configuration: Optional["_models.InternalNetworkPatchablePropertiesBgpConfiguration"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword mtu: Maximum transmission unit. Default value is 1500. + :paramtype mtu: int + :keyword connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :paramtype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :keyword connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :paramtype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :keyword static_route_configuration: staticRouteConfiguration model. + :paramtype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :keyword bgp_configuration: BGP configuration properties. + :paramtype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype export_route_policy_id: str + """ + super().__init__(**kwargs) + self.annotation = annotation + self.mtu = mtu + self.connected_i_pv4_subnets = connected_i_pv4_subnets + self.connected_i_pv6_subnets = connected_i_pv6_subnets + self.static_route_configuration = static_route_configuration + self.bgp_configuration = bgp_configuration + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + + +class InternalNetworkPatchableProperties(_serialization.Model): + """The ExternalNetwork patchable properties. + + :ivar mtu: Maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :vartype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :ivar connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :vartype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :ivar static_route_configuration: staticRouteConfiguration model. + :vartype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :ivar bgp_configuration: BGP configuration properties. + :vartype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype export_route_policy_id: str + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + } + + _attribute_map = { + "mtu": {"key": "mtu", "type": "int"}, + "connected_i_pv4_subnets": { + "key": "connectedIPv4Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem]", + }, + "connected_i_pv6_subnets": { + "key": "connectedIPv6Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem]", + }, + "static_route_configuration": { + "key": "staticRouteConfiguration", + "type": "InternalNetworkPatchablePropertiesStaticRouteConfiguration", + }, + "bgp_configuration": {"key": "bgpConfiguration", "type": "InternalNetworkPatchablePropertiesBgpConfiguration"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + } + + def __init__( + self, + *, + mtu: int = 1500, + connected_i_pv4_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem"] + ] = None, + connected_i_pv6_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem"] + ] = None, + static_route_configuration: Optional[ + "_models.InternalNetworkPatchablePropertiesStaticRouteConfiguration" + ] = None, + bgp_configuration: Optional["_models.InternalNetworkPatchablePropertiesBgpConfiguration"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mtu: Maximum transmission unit. Default value is 1500. + :paramtype mtu: int + :keyword connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :paramtype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :keyword connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :paramtype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :keyword static_route_configuration: staticRouteConfiguration model. + :paramtype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :keyword bgp_configuration: BGP configuration properties. + :paramtype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype export_route_policy_id: str + """ + super().__init__(**kwargs) + self.mtu = mtu + self.connected_i_pv4_subnets = connected_i_pv4_subnets + self.connected_i_pv6_subnets = connected_i_pv6_subnets + self.static_route_configuration = static_route_configuration + self.bgp_configuration = bgp_configuration + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + + +class InternalNetworkPatchablePropertiesBgpConfiguration( + AnnotationResource +): # pylint: disable=too-many-instance-attributes + """BGP configuration properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar bfd_configuration: BFD configuration properties. + :vartype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + :ivar default_route_originate: Originate a defaultRoute. Ex: "True" | "False". Known values + are: "True" and "False". + :vartype default_route_originate: str or + ~azure.mgmt.managednetworkfabric.models.BooleanEnumProperty + :ivar allow_as: Allows for routes to be received and processed even if the router detects its + own ASN in the AS-Path. 0 is disable, Possible values are 1-10, default is 2. + :vartype allow_as: int + :ivar allow_as_override: Enable Or Disable state. Known values are: "Enable" and "Disable". + :vartype allow_as_override: str or ~azure.mgmt.managednetworkfabric.models.AllowASOverride + :ivar fabric_asn: ASN of Network Fabric. Example: 65048. + :vartype fabric_asn: int + :ivar peer_asn: Peer ASN. Example: 65047. Required. + :vartype peer_asn: int + :ivar ipv4_listen_range_prefixes: BGP Ipv4 ListenRange. + :vartype ipv4_listen_range_prefixes: list[str] + :ivar ipv6_listen_range_prefixes: BGP Ipv6 ListenRange. + :vartype ipv6_listen_range_prefixes: list[str] + :ivar ipv4_neighbor_address: List with stringified ipv4NeighborAddresses. + :vartype ipv4_neighbor_address: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem] + :ivar ipv6_neighbor_address: List with stringified ipv6NeighborAddress. + :vartype ipv6_neighbor_address: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem] + """ + + _validation = { + "allow_as": {"maximum": 10, "minimum": 0}, + "fabric_asn": {"readonly": True}, + "peer_asn": {"required": True, "maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "bfd_configuration": {"key": "bfdConfiguration", "type": "BfdConfiguration"}, + "default_route_originate": {"key": "defaultRouteOriginate", "type": "str"}, + "allow_as": {"key": "allowAS", "type": "int"}, + "allow_as_override": {"key": "allowASOverride", "type": "str"}, + "fabric_asn": {"key": "fabricASN", "type": "int"}, + "peer_asn": {"key": "peerASN", "type": "int"}, + "ipv4_listen_range_prefixes": {"key": "ipv4ListenRangePrefixes", "type": "[str]"}, + "ipv6_listen_range_prefixes": {"key": "ipv6ListenRangePrefixes", "type": "[str]"}, + "ipv4_neighbor_address": { + "key": "ipv4NeighborAddress", + "type": "[InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem]", + }, + "ipv6_neighbor_address": { + "key": "ipv6NeighborAddress", + "type": "[InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem]", + }, + } + + def __init__( + self, + *, + peer_asn: int, + annotation: Optional[str] = None, + bfd_configuration: Optional["_models.BfdConfiguration"] = None, + default_route_originate: Optional[Union[str, "_models.BooleanEnumProperty"]] = None, + allow_as: int = 2, + allow_as_override: Optional[Union[str, "_models.AllowASOverride"]] = None, + ipv4_listen_range_prefixes: Optional[List[str]] = None, + ipv6_listen_range_prefixes: Optional[List[str]] = None, + ipv4_neighbor_address: Optional[ + List["_models.InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem"] + ] = None, + ipv6_neighbor_address: Optional[ + List["_models.InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword bfd_configuration: BFD configuration properties. + :paramtype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + :keyword default_route_originate: Originate a defaultRoute. Ex: "True" | "False". Known values + are: "True" and "False". + :paramtype default_route_originate: str or + ~azure.mgmt.managednetworkfabric.models.BooleanEnumProperty + :keyword allow_as: Allows for routes to be received and processed even if the router detects + its own ASN in the AS-Path. 0 is disable, Possible values are 1-10, default is 2. + :paramtype allow_as: int + :keyword allow_as_override: Enable Or Disable state. Known values are: "Enable" and "Disable". + :paramtype allow_as_override: str or ~azure.mgmt.managednetworkfabric.models.AllowASOverride + :keyword peer_asn: Peer ASN. Example: 65047. Required. + :paramtype peer_asn: int + :keyword ipv4_listen_range_prefixes: BGP Ipv4 ListenRange. + :paramtype ipv4_listen_range_prefixes: list[str] + :keyword ipv6_listen_range_prefixes: BGP Ipv6 ListenRange. + :paramtype ipv6_listen_range_prefixes: list[str] + :keyword ipv4_neighbor_address: List with stringified ipv4NeighborAddresses. + :paramtype ipv4_neighbor_address: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem] + :keyword ipv6_neighbor_address: List with stringified ipv6NeighborAddress. + :paramtype ipv6_neighbor_address: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem] + """ + super().__init__(annotation=annotation, **kwargs) + self.bfd_configuration = bfd_configuration + self.default_route_originate = default_route_originate + self.allow_as = allow_as + self.allow_as_override = allow_as_override + self.fabric_asn = None + self.peer_asn = peer_asn + self.ipv4_listen_range_prefixes = ipv4_listen_range_prefixes + self.ipv6_listen_range_prefixes = ipv6_listen_range_prefixes + self.ipv4_neighbor_address = ipv4_neighbor_address + self.ipv6_neighbor_address = ipv6_neighbor_address + + +class InternalNetworkPatchablePropertiesBgpConfigurationIpv4NeighborAddressItem(_serialization.Model): + """ipv4NeighborAddress model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: IP Address of the IPv4NeighborAddress. + :vartype address: str + :ivar operational_state: operationalState of the IPv4NeighborAddress. + :vartype operational_state: str + """ + + _validation = { + "operational_state": {"readonly": True}, + } + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + "operational_state": {"key": "operationalState", "type": "str"}, + } + + def __init__(self, *, address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address: IP Address of the IPv4NeighborAddress. + :paramtype address: str + """ + super().__init__(**kwargs) + self.address = address + self.operational_state = None + + +class InternalNetworkPatchablePropertiesBgpConfigurationIpv6NeighborAddressItem(_serialization.Model): + """ipv6NeighborAddress model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: ip address of the ipv6NeighborAddress. + :vartype address: str + :ivar operational_state: operationalState of the ipv6NeighborAddress. + :vartype operational_state: str + """ + + _validation = { + "operational_state": {"readonly": True}, + } + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + "operational_state": {"key": "operationalState", "type": "str"}, + } + + def __init__(self, *, address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address: ip address of the ipv6NeighborAddress. + :paramtype address: str + """ + super().__init__(**kwargs) + self.address = address + self.operational_state = None + + +class InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem(AnnotationResource): + """connectedIPv4Subnet model. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar prefix: Ipv4 Prefix of the connectedIPv4Subnet. + :vartype prefix: str + """ + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "prefix": {"key": "prefix", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword prefix: Ipv4 Prefix of the connectedIPv4Subnet. + :paramtype prefix: str + """ + super().__init__(annotation=annotation, **kwargs) + self.prefix = prefix + + +class InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem(AnnotationResource): + """connectedIPv6Subnet model. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar prefix: Ipv6 Prefix of the connectedIPv6Subnet. + :vartype prefix: str + """ + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "prefix": {"key": "prefix", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword prefix: Ipv6 Prefix of the connectedIPv6Subnet. + :paramtype prefix: str + """ + super().__init__(annotation=annotation, **kwargs) + self.prefix = prefix + + +class InternalNetworkPatchablePropertiesStaticRouteConfiguration(_serialization.Model): + """staticRouteConfiguration model. + + :ivar bfd_configuration: BFD configuration properties. + :vartype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + :ivar ipv4_routes: List with object IPv4Routes. + :vartype ipv4_routes: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem] + :ivar ipv6_routes: List with object IPv6Routes. + :vartype ipv6_routes: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem] + """ + + _attribute_map = { + "bfd_configuration": {"key": "bfdConfiguration", "type": "BfdConfiguration"}, + "ipv4_routes": { + "key": "ipv4Routes", + "type": "[InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem]", + }, + "ipv6_routes": { + "key": "ipv6Routes", + "type": "[InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem]", + }, + } + + def __init__( + self, + *, + bfd_configuration: Optional["_models.BfdConfiguration"] = None, + ipv4_routes: Optional[ + List["_models.InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem"] + ] = None, + ipv6_routes: Optional[ + List["_models.InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword bfd_configuration: BFD configuration properties. + :paramtype bfd_configuration: ~azure.mgmt.managednetworkfabric.models.BfdConfiguration + :keyword ipv4_routes: List with object IPv4Routes. + :paramtype ipv4_routes: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem] + :keyword ipv6_routes: List with object IPv6Routes. + :paramtype ipv6_routes: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem] + """ + super().__init__(**kwargs) + self.bfd_configuration = bfd_configuration + self.ipv4_routes = ipv4_routes + self.ipv6_routes = ipv6_routes + + +class InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv4RoutesItem(_serialization.Model): + """staticIpv4Route model. + + All required parameters must be populated in order to send to Azure. + + :ivar prefix: IPv4 prefix of the staticIpv4Route. Required. + :vartype prefix: str + :ivar next_hop: List of next hop IPv4 addresses. Required. + :vartype next_hop: list[str] + """ + + _validation = { + "prefix": {"required": True}, + "next_hop": {"required": True}, + } + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + "next_hop": {"key": "nextHop", "type": "[str]"}, + } + + def __init__(self, *, prefix: str, next_hop: List[str], **kwargs: Any) -> None: + """ + :keyword prefix: IPv4 prefix of the staticIpv4Route. Required. + :paramtype prefix: str + :keyword next_hop: List of next hop IPv4 addresses. Required. + :paramtype next_hop: list[str] + """ + super().__init__(**kwargs) + self.prefix = prefix + self.next_hop = next_hop + + +class InternalNetworkPatchablePropertiesStaticRouteConfigurationIpv6RoutesItem(_serialization.Model): + """staticIPv6Route model. + + All required parameters must be populated in order to send to Azure. + + :ivar prefix: IPv6 prefix of the staticIPv6Route. Required. + :vartype prefix: str + :ivar next_hop: List of next hop IPv6 addresses. Required. + :vartype next_hop: list[str] + """ + + _validation = { + "prefix": {"required": True}, + "next_hop": {"required": True}, + } + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + "next_hop": {"key": "nextHop", "type": "[str]"}, + } + + def __init__(self, *, prefix: str, next_hop: List[str], **kwargs: Any) -> None: + """ + :keyword prefix: IPv6 prefix of the staticIPv6Route. Required. + :paramtype prefix: str + :keyword next_hop: List of next hop IPv6 addresses. Required. + :paramtype next_hop: list[str] + """ + super().__init__(**kwargs) + self.prefix = prefix + self.next_hop = next_hop + + +class InternalNetworkPatchProperties(AnnotationResource, InternalNetworkPatchableProperties): + """InternalNetwork Patch properties. + + :ivar mtu: Maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :vartype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :ivar connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :vartype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :ivar static_route_configuration: staticRouteConfiguration model. + :vartype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :ivar bgp_configuration: BGP configuration properties. + :vartype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype export_route_policy_id: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + } + + _attribute_map = { + "mtu": {"key": "mtu", "type": "int"}, + "connected_i_pv4_subnets": { + "key": "connectedIPv4Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem]", + }, + "connected_i_pv6_subnets": { + "key": "connectedIPv6Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem]", + }, + "static_route_configuration": { + "key": "staticRouteConfiguration", + "type": "InternalNetworkPatchablePropertiesStaticRouteConfiguration", + }, + "bgp_configuration": {"key": "bgpConfiguration", "type": "InternalNetworkPatchablePropertiesBgpConfiguration"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + "annotation": {"key": "annotation", "type": "str"}, + } + + def __init__( + self, + *, + mtu: int = 1500, + connected_i_pv4_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem"] + ] = None, + connected_i_pv6_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem"] + ] = None, + static_route_configuration: Optional[ + "_models.InternalNetworkPatchablePropertiesStaticRouteConfiguration" + ] = None, + bgp_configuration: Optional["_models.InternalNetworkPatchablePropertiesBgpConfiguration"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mtu: Maximum transmission unit. Default value is 1500. + :paramtype mtu: int + :keyword connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :paramtype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :keyword connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :paramtype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :keyword static_route_configuration: staticRouteConfiguration model. + :paramtype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :keyword bgp_configuration: BGP configuration properties. + :paramtype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype export_route_policy_id: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__( + annotation=annotation, + mtu=mtu, + connected_i_pv4_subnets=connected_i_pv4_subnets, + connected_i_pv6_subnets=connected_i_pv6_subnets, + static_route_configuration=static_route_configuration, + bgp_configuration=bgp_configuration, + import_route_policy_id=import_route_policy_id, + export_route_policy_id=export_route_policy_id, + **kwargs + ) + self.mtu = mtu + self.connected_i_pv4_subnets = connected_i_pv4_subnets + self.connected_i_pv6_subnets = connected_i_pv6_subnets + self.static_route_configuration = static_route_configuration + self.bgp_configuration = bgp_configuration + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + self.annotation = annotation + + +class InternalNetworkProperties( + AnnotationResource, InternalNetworkPatchableProperties +): # pylint: disable=too-many-instance-attributes + """Internal Network Properties. + + 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 mtu: Maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :vartype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :ivar connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :vartype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :ivar static_route_configuration: staticRouteConfiguration model. + :vartype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :ivar bgp_configuration: BGP configuration properties. + :vartype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :ivar import_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: ARM resource ID of importRoutePolicy. + :vartype export_route_policy_id: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar disabled_on_resources: List of resources the InternalNetwork is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: Administrative state of the InternalNetwork. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar bgp_disabled_on_resources: List of resources the BGP is disabled on. Can be either entire + NetworkFabric or NetworkRack. + :vartype bgp_disabled_on_resources: list[str] + :ivar bfd_disabled_on_resources: List of resources the BFD for BGP is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype bfd_disabled_on_resources: list[str] + :ivar bfd_for_static_routes_disabled_on_resources: List of resources the BFD of StaticRoutes is + disabled on. Can be either entire NetworkFabric or NetworkRack. + :vartype bfd_for_static_routes_disabled_on_resources: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar vlan_id: Vlan identifier. Example: 1001. Required. + :vartype vlan_id: int + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "bgp_disabled_on_resources": {"readonly": True}, + "bfd_disabled_on_resources": {"readonly": True}, + "bfd_for_static_routes_disabled_on_resources": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "vlan_id": {"required": True, "maximum": 4095, "minimum": 100}, + } + + _attribute_map = { + "mtu": {"key": "mtu", "type": "int"}, + "connected_i_pv4_subnets": { + "key": "connectedIPv4Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem]", + }, + "connected_i_pv6_subnets": { + "key": "connectedIPv6Subnets", + "type": "[InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem]", + }, + "static_route_configuration": { + "key": "staticRouteConfiguration", + "type": "InternalNetworkPatchablePropertiesStaticRouteConfiguration", + }, + "bgp_configuration": {"key": "bgpConfiguration", "type": "InternalNetworkPatchablePropertiesBgpConfiguration"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + "annotation": {"key": "annotation", "type": "str"}, + "disabled_on_resources": {"key": "disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "administrativeState", "type": "str"}, + "bgp_disabled_on_resources": {"key": "bgpDisabledOnResources", "type": "[str]"}, + "bfd_disabled_on_resources": {"key": "bfdDisabledOnResources", "type": "[str]"}, + "bfd_for_static_routes_disabled_on_resources": { + "key": "bfdForStaticRoutesDisabledOnResources", + "type": "[str]", + }, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + } + + def __init__( + self, + *, + vlan_id: int, + mtu: int = 1500, + connected_i_pv4_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem"] + ] = None, + connected_i_pv6_subnets: Optional[ + List["_models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem"] + ] = None, + static_route_configuration: Optional[ + "_models.InternalNetworkPatchablePropertiesStaticRouteConfiguration" + ] = None, + bgp_configuration: Optional["_models.InternalNetworkPatchablePropertiesBgpConfiguration"] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mtu: Maximum transmission unit. Default value is 1500. + :paramtype mtu: int + :keyword connected_i_pv4_subnets: List with object connectedIPv4Subnets. + :paramtype connected_i_pv4_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv4SubnetsItem] + :keyword connected_i_pv6_subnets: List with object connectedIPv6Subnets. + :paramtype connected_i_pv6_subnets: + list[~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesConnectedIPv6SubnetsItem] + :keyword static_route_configuration: staticRouteConfiguration model. + :paramtype static_route_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesStaticRouteConfiguration + :keyword bgp_configuration: BGP configuration properties. + :paramtype bgp_configuration: + ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatchablePropertiesBgpConfiguration + :keyword import_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: ARM resource ID of importRoutePolicy. + :paramtype export_route_policy_id: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword vlan_id: Vlan identifier. Example: 1001. Required. + :paramtype vlan_id: int + """ + super().__init__( + annotation=annotation, + mtu=mtu, + connected_i_pv4_subnets=connected_i_pv4_subnets, + connected_i_pv6_subnets=connected_i_pv6_subnets, + static_route_configuration=static_route_configuration, + bgp_configuration=bgp_configuration, + import_route_policy_id=import_route_policy_id, + export_route_policy_id=export_route_policy_id, + **kwargs + ) + self.mtu = mtu + self.connected_i_pv4_subnets = connected_i_pv4_subnets + self.connected_i_pv6_subnets = connected_i_pv6_subnets + self.static_route_configuration = static_route_configuration + self.bgp_configuration = bgp_configuration + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + self.disabled_on_resources = None + self.administrative_state = None + self.bgp_disabled_on_resources = None + self.bfd_disabled_on_resources = None + self.bfd_for_static_routes_disabled_on_resources = None + self.provisioning_state = None + self.vlan_id = vlan_id + self.annotation = annotation + + +class InternalNetworksList(_serialization.Model): + """List of InternalNetworks. + + :ivar value: List of InternalNetworks resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[InternalNetwork]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.InternalNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of InternalNetworks resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class IpCommunitiesListResult(_serialization.Model): + """List of IPCommunities. + + :ivar value: List of IpCommunity resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[IpCommunity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.IpCommunity"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of IpCommunity resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class IpCommunity(TrackedResource): # pylint: disable=too-many-instance-attributes + """The IpCommunity resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar action: Action to be taken on the configuration. Example: Permit | Deny. Known values + are: "Permit" and "Deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :ivar well_known_communities: Supported well known Community List. + :vartype well_known_communities: list[str or + ~azure.mgmt.managednetworkfabric.models.WellKnownCommunities] + :ivar community_members: List the communityMembers of IP Community . + :vartype community_members: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "well_known_communities": {"unique": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "action": {"key": "properties.action", "type": "str"}, + "well_known_communities": {"key": "properties.wellKnownCommunities", "type": "[str]"}, + "community_members": {"key": "properties.communityMembers", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + action: Optional[Union[str, "_models.CommunityActionTypes"]] = None, + well_known_communities: Optional[List[Union[str, "_models.WellKnownCommunities"]]] = None, + community_members: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword action: Action to be taken on the configuration. Example: Permit | Deny. Known values + are: "Permit" and "Deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :keyword well_known_communities: Supported well known Community List. + :paramtype well_known_communities: list[str or + ~azure.mgmt.managednetworkfabric.models.WellKnownCommunities] + :keyword community_members: List the communityMembers of IP Community . + :paramtype community_members: list[str] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.action = action + self.well_known_communities = well_known_communities + self.community_members = community_members + self.provisioning_state = None + + +class IpCommunityPatch(_serialization.Model): + """The IPCommunity patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class IpCommunityProperties(AnnotationResource): + """IpCommunityProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar action: Action to be taken on the configuration. Example: Permit | Deny. Required. Known + values are: "Permit" and "Deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :ivar well_known_communities: Supported well known Community List. + :vartype well_known_communities: list[str or + ~azure.mgmt.managednetworkfabric.models.WellKnownCommunities] + :ivar community_members: List the communityMembers of IP Community . Required. + :vartype community_members: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "action": {"required": True}, + "well_known_communities": {"unique": True}, + "community_members": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "well_known_communities": {"key": "wellKnownCommunities", "type": "[str]"}, + "community_members": {"key": "communityMembers", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + action: Union[str, "_models.CommunityActionTypes"], + community_members: List[str], + annotation: Optional[str] = None, + well_known_communities: Optional[List[Union[str, "_models.WellKnownCommunities"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword action: Action to be taken on the configuration. Example: Permit | Deny. Required. + Known values are: "Permit" and "Deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :keyword well_known_communities: Supported well known Community List. + :paramtype well_known_communities: list[str or + ~azure.mgmt.managednetworkfabric.models.WellKnownCommunities] + :keyword community_members: List the communityMembers of IP Community . Required. + :paramtype community_members: list[str] + """ + super().__init__(annotation=annotation, **kwargs) + self.action = action + self.well_known_communities = well_known_communities + self.community_members = community_members + self.provisioning_state = None + + +class IpExtendedCommunity(TrackedResource): + """The IpExtendedCommunity resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar action: Action to be taken on the configuration. Example: Permit | Deny. Known values + are: "Permit" and "Deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :ivar route_targets: Route Target List.The expected formats are ASN(plain):NN >> example + 4294967294:50, ASN.ASN:NN >> example 65533.65333:40, IP-address:NN >> example + 10.10.10.10:65535. The possible values of ASN,NN are in range of 0-65535, ASN(plain) is in + range of 0-4294967295. + :vartype route_targets: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "action": {"key": "properties.action", "type": "str"}, + "route_targets": {"key": "properties.routeTargets", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + action: Optional[Union[str, "_models.CommunityActionTypes"]] = None, + route_targets: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword action: Action to be taken on the configuration. Example: Permit | Deny. Known values + are: "Permit" and "Deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :keyword route_targets: Route Target List.The expected formats are ASN(plain):NN >> example + 4294967294:50, ASN.ASN:NN >> example 65533.65333:40, IP-address:NN >> example + 10.10.10.10:65535. The possible values of ASN,NN are in range of 0-65535, ASN(plain) is in + range of 0-4294967295. + :paramtype route_targets: list[str] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.action = action + self.route_targets = route_targets + self.provisioning_state = None + + +class IpExtendedCommunityListResult(_serialization.Model): + """List of IpExtendedCommunities. + + :ivar value: List of IpExtendedCommunities resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[IpExtendedCommunity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.IpExtendedCommunity"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of IpExtendedCommunities resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class IpExtendedCommunityPatch(_serialization.Model): + """The IpExtendedCommunities patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class IpExtendedCommunityProperties(AnnotationResource): + """IpExtendedCommunityProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar action: Action to be taken on the configuration. Example: Permit | Deny. Required. Known + values are: "Permit" and "Deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :ivar route_targets: Route Target List.The expected formats are ASN(plain):NN >> example + 4294967294:50, ASN.ASN:NN >> example 65533.65333:40, IP-address:NN >> example + 10.10.10.10:65535. The possible values of ASN,NN are in range of 0-65535, ASN(plain) is in + range of 0-4294967295. Required. + :vartype route_targets: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "action": {"required": True}, + "route_targets": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "route_targets": {"key": "routeTargets", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + action: Union[str, "_models.CommunityActionTypes"], + route_targets: List[str], + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword action: Action to be taken on the configuration. Example: Permit | Deny. Required. + Known values are: "Permit" and "Deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :keyword route_targets: Route Target List.The expected formats are ASN(plain):NN >> example + 4294967294:50, ASN.ASN:NN >> example 65533.65333:40, IP-address:NN >> example + 10.10.10.10:65535. The possible values of ASN,NN are in range of 0-65535, ASN(plain) is in + range of 0-4294967295. Required. + :paramtype route_targets: list[str] + """ + super().__init__(annotation=annotation, **kwargs) + self.action = action + self.route_targets = route_targets + self.provisioning_state = None + + +class IpPrefix(TrackedResource): + """The IPPrefix resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar ip_prefix_rules: IpPrefix contains the list of IP PrefixRules objects. Required. + :vartype ip_prefix_rules: + list[~azure.mgmt.managednetworkfabric.models.IpPrefixPropertiesIpPrefixRulesItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "ip_prefix_rules": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "ip_prefix_rules": {"key": "properties.ipPrefixRules", "type": "[IpPrefixPropertiesIpPrefixRulesItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + ip_prefix_rules: List["_models.IpPrefixPropertiesIpPrefixRulesItem"], + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword ip_prefix_rules: IpPrefix contains the list of IP PrefixRules objects. Required. + :paramtype ip_prefix_rules: + list[~azure.mgmt.managednetworkfabric.models.IpPrefixPropertiesIpPrefixRulesItem] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.ip_prefix_rules = ip_prefix_rules + self.provisioning_state = None + + +class IpPrefixesListResult(_serialization.Model): + """List of IpPrefixes. + + :ivar value: List of IPPrefix resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[IpPrefix]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.IpPrefix"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of IPPrefix resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class IpPrefixPatch(_serialization.Model): + """The IPPrefix patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class IpPrefixProperties(AnnotationResource): + """IpPrefixProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar ip_prefix_rules: IpPrefix contains the list of IP PrefixRules objects. Required. + :vartype ip_prefix_rules: + list[~azure.mgmt.managednetworkfabric.models.IpPrefixPropertiesIpPrefixRulesItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "ip_prefix_rules": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "ip_prefix_rules": {"key": "ipPrefixRules", "type": "[IpPrefixPropertiesIpPrefixRulesItem]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + ip_prefix_rules: List["_models.IpPrefixPropertiesIpPrefixRulesItem"], + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword ip_prefix_rules: IpPrefix contains the list of IP PrefixRules objects. Required. + :paramtype ip_prefix_rules: + list[~azure.mgmt.managednetworkfabric.models.IpPrefixPropertiesIpPrefixRulesItem] + """ + super().__init__(annotation=annotation, **kwargs) + self.ip_prefix_rules = ip_prefix_rules + self.provisioning_state = None + + +class IpPrefixPropertiesIpPrefixRulesItem(_serialization.Model): + """IpPrefixPropertiesIpPrefixRulesItem. + + All required parameters must be populated in order to send to Azure. + + :ivar action: Action to be taken on the configuration. Example: Permit | Deny. Required. Known + values are: "Permit" and "Deny". + :vartype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :ivar sequence_number: Sequence to insert to/delete from existing route. Prefix lists are + evaluated starting with the lowest sequence number and continue down the list until a match is + made. Once a match is made, the permit or deny statement is applied to that network and the + rest of the list is ignored. Required. + :vartype sequence_number: int + :ivar network_prefix: Network Prefix specifying IPv4/IPv6 packets to be permitted or denied. + Example: 1.1.1.0/24 | 3FFE:FFFF:0:CD30::/126. Required. + :vartype network_prefix: str + :ivar condition: Specify prefix-list bounds. Known values are: "EqualTo", + "GreaterThanOrEqualTo", and "LesserThanOrEqualTo". + :vartype condition: str or ~azure.mgmt.managednetworkfabric.models.Condition + :ivar subnet_mask_length: SubnetMaskLength gives the minimum NetworkPrefix length to be + matched.Possible values for IPv4 are 1 - 32. Possible values of IPv6 are 1 - 128. + :vartype subnet_mask_length: int + """ + + _validation = { + "action": {"required": True}, + "sequence_number": {"required": True, "maximum": 4294967295, "minimum": 1}, + "network_prefix": {"required": True}, + "subnet_mask_length": {"maximum": 128, "minimum": 1}, + } + + _attribute_map = { + "action": {"key": "action", "type": "str"}, + "sequence_number": {"key": "sequenceNumber", "type": "int"}, + "network_prefix": {"key": "networkPrefix", "type": "str"}, + "condition": {"key": "condition", "type": "str"}, + "subnet_mask_length": {"key": "subnetMaskLength", "type": "int"}, + } + + def __init__( + self, + *, + action: Union[str, "_models.CommunityActionTypes"], + sequence_number: int, + network_prefix: str, + condition: Optional[Union[str, "_models.Condition"]] = None, + subnet_mask_length: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword action: Action to be taken on the configuration. Example: Permit | Deny. Required. + Known values are: "Permit" and "Deny". + :paramtype action: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :keyword sequence_number: Sequence to insert to/delete from existing route. Prefix lists are + evaluated starting with the lowest sequence number and continue down the list until a match is + made. Once a match is made, the permit or deny statement is applied to that network and the + rest of the list is ignored. Required. + :paramtype sequence_number: int + :keyword network_prefix: Network Prefix specifying IPv4/IPv6 packets to be permitted or denied. + Example: 1.1.1.0/24 | 3FFE:FFFF:0:CD30::/126. Required. + :paramtype network_prefix: str + :keyword condition: Specify prefix-list bounds. Known values are: "EqualTo", + "GreaterThanOrEqualTo", and "LesserThanOrEqualTo". + :paramtype condition: str or ~azure.mgmt.managednetworkfabric.models.Condition + :keyword subnet_mask_length: SubnetMaskLength gives the minimum NetworkPrefix length to be + matched.Possible values for IPv4 are 1 - 32. Possible values of IPv6 are 1 - 128. + :paramtype subnet_mask_length: int + """ + super().__init__(**kwargs) + self.action = action + self.sequence_number = sequence_number + self.network_prefix = network_prefix + self.condition = condition + self.subnet_mask_length = subnet_mask_length + + +class L2IsolationDomain(TrackedResource): # pylint: disable=too-many-instance-attributes + """The L2IsolationDomain resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar network_fabric_id: Network Fabric ARM resource id. + :vartype network_fabric_id: str + :ivar vlan_id: vlanId. Example: 501. + :vartype vlan_id: int + :ivar mtu: maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar disabled_on_resources: List of resources the L2 Isolation Domain is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: state. Example: Enabled | Disabled. It indicates administrative + state of the isolationDomain, whether it is enabled or disabled. If enabled, the configuration + is applied on the devices. If disabled, the configuration is removed from the devices. Known + values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "network_fabric_id": {"key": "properties.networkFabricId", "type": "str"}, + "vlan_id": {"key": "properties.vlanId", "type": "int"}, + "mtu": {"key": "properties.mtu", "type": "int"}, + "disabled_on_resources": {"key": "properties.disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "properties.administrativeState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + network_fabric_id: Optional[str] = None, + vlan_id: Optional[int] = None, + mtu: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_fabric_id: Network Fabric ARM resource id. + :paramtype network_fabric_id: str + :keyword vlan_id: vlanId. Example: 501. + :paramtype vlan_id: int + :keyword mtu: maximum transmission unit. Default value is 1500. + :paramtype mtu: int + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.network_fabric_id = network_fabric_id + self.vlan_id = vlan_id + self.mtu = mtu + self.disabled_on_resources = None + self.administrative_state = None + self.provisioning_state = None + + +class L2IsolationDomainPatch(_serialization.Model): + """The L2IsolationDomain patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar mtu: maximum transmission unit. Default value is 1500. + :vartype mtu: int + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "mtu": {"key": "properties.mtu", "type": "int"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + mtu: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword mtu: maximum transmission unit. Default value is 1500. + :paramtype mtu: int + """ + super().__init__(**kwargs) + self.tags = tags + self.annotation = annotation + self.mtu = mtu + + +class L2IsolationDomainPatchProperties(AnnotationResource): + """L2IsolationDomainPatchProperties define the patchable resource properties. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar mtu: maximum transmission unit. Default value is 1500. + :vartype mtu: int + """ + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "mtu": {"key": "mtu", "type": "int"}, + } + + def __init__(self, *, annotation: Optional[str] = None, mtu: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword mtu: maximum transmission unit. Default value is 1500. + :paramtype mtu: int + """ + super().__init__(annotation=annotation, **kwargs) + self.mtu = mtu + + +class L2IsolationDomainProperties(AnnotationResource): + """L2IsolationDomainProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar network_fabric_id: Network Fabric ARM resource id. Required. + :vartype network_fabric_id: str + :ivar vlan_id: vlanId. Example: 501. Required. + :vartype vlan_id: int + :ivar mtu: maximum transmission unit. Default value is 1500. + :vartype mtu: int + :ivar disabled_on_resources: List of resources the L2 Isolation Domain is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: state. Example: Enabled | Disabled. It indicates administrative + state of the isolationDomain, whether it is enabled or disabled. If enabled, the configuration + is applied on the devices. If disabled, the configuration is removed from the devices. Known + values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "network_fabric_id": {"required": True}, + "vlan_id": {"required": True}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "network_fabric_id": {"key": "networkFabricId", "type": "str"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + "mtu": {"key": "mtu", "type": "int"}, + "disabled_on_resources": {"key": "disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "administrativeState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + network_fabric_id: str, + vlan_id: int, + annotation: Optional[str] = None, + mtu: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_fabric_id: Network Fabric ARM resource id. Required. + :paramtype network_fabric_id: str + :keyword vlan_id: vlanId. Example: 501. Required. + :paramtype vlan_id: int + :keyword mtu: maximum transmission unit. Default value is 1500. + :paramtype mtu: int + """ + super().__init__(annotation=annotation, **kwargs) + self.network_fabric_id = network_fabric_id + self.vlan_id = vlan_id + self.mtu = mtu + self.disabled_on_resources = None + self.administrative_state = None + self.provisioning_state = None + + +class L2IsolationDomainsListResult(_serialization.Model): + """List of L2IsolationDomains. + + :ivar value: Displays list of L2IsolationDomain resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[L2IsolationDomain]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.L2IsolationDomain"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Displays list of L2IsolationDomain resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class L3IsolationDomain(TrackedResource): # pylint: disable=too-many-instance-attributes + """The L3IsolationDomain resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". Known + values are: "True" and "False". + :vartype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :ivar redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known values + are: "True" and "False". + :vartype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :ivar aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :vartype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :ivar description: L3 Isolation Domain description. + :vartype description: str + :ivar connected_subnet_route_policy: Connected Subnet RoutePolicy. + :vartype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + :ivar network_fabric_id: Network Fabric ARM resource id. + :vartype network_fabric_id: str + :ivar disabled_on_resources: List of resources the L3 Isolation Domain is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: Administrative state of the IsolationDomain. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar option_b_disabled_on_resources: List of resources the OptionB is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype option_b_disabled_on_resources: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "option_b_disabled_on_resources": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "redistribute_connected_subnets": {"key": "properties.redistributeConnectedSubnets", "type": "str"}, + "redistribute_static_routes": {"key": "properties.redistributeStaticRoutes", "type": "str"}, + "aggregate_route_configuration": { + "key": "properties.aggregateRouteConfiguration", + "type": "L3IsolationDomainPatchPropertiesAggregateRouteConfiguration", + }, + "description": {"key": "properties.description", "type": "str"}, + "connected_subnet_route_policy": { + "key": "properties.connectedSubnetRoutePolicy", + "type": "L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy", + }, + "network_fabric_id": {"key": "properties.networkFabricId", "type": "str"}, + "disabled_on_resources": {"key": "properties.disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "properties.administrativeState", "type": "str"}, + "option_b_disabled_on_resources": {"key": "properties.optionBDisabledOnResources", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + redistribute_connected_subnets: Union[str, "_models.RedistributeConnectedSubnets"] = "True", + redistribute_static_routes: Union[str, "_models.RedistributeStaticRoutes"] = "False", + aggregate_route_configuration: Optional[ + "_models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration" + ] = None, + description: Optional[str] = None, + connected_subnet_route_policy: Optional[ + "_models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy" + ] = None, + network_fabric_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". + Known values are: "True" and "False". + :paramtype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :keyword redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known + values are: "True" and "False". + :paramtype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :keyword aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :paramtype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :keyword description: L3 Isolation Domain description. + :paramtype description: str + :keyword connected_subnet_route_policy: Connected Subnet RoutePolicy. + :paramtype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + :keyword network_fabric_id: Network Fabric ARM resource id. + :paramtype network_fabric_id: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.redistribute_connected_subnets = redistribute_connected_subnets + self.redistribute_static_routes = redistribute_static_routes + self.aggregate_route_configuration = aggregate_route_configuration + self.description = description + self.connected_subnet_route_policy = connected_subnet_route_policy + self.network_fabric_id = network_fabric_id + self.disabled_on_resources = None + self.administrative_state = None + self.option_b_disabled_on_resources = None + self.provisioning_state = None + + +class L3IsolationDomainPatch(_serialization.Model): + """The L3IsolationDomain patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". Known + values are: "True" and "False". + :vartype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :ivar redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known values + are: "True" and "False". + :vartype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :ivar aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :vartype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :ivar description: L3 Isolation Domain description. + :vartype description: str + :ivar connected_subnet_route_policy: Connected Subnet RoutePolicy. + :vartype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "redistribute_connected_subnets": {"key": "properties.redistributeConnectedSubnets", "type": "str"}, + "redistribute_static_routes": {"key": "properties.redistributeStaticRoutes", "type": "str"}, + "aggregate_route_configuration": { + "key": "properties.aggregateRouteConfiguration", + "type": "L3IsolationDomainPatchPropertiesAggregateRouteConfiguration", + }, + "description": {"key": "properties.description", "type": "str"}, + "connected_subnet_route_policy": { + "key": "properties.connectedSubnetRoutePolicy", + "type": "L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy", + }, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + redistribute_connected_subnets: Union[str, "_models.RedistributeConnectedSubnets"] = "True", + redistribute_static_routes: Union[str, "_models.RedistributeStaticRoutes"] = "False", + aggregate_route_configuration: Optional[ + "_models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration" + ] = None, + description: Optional[str] = None, + connected_subnet_route_policy: Optional[ + "_models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". + Known values are: "True" and "False". + :paramtype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :keyword redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known + values are: "True" and "False". + :paramtype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :keyword aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :paramtype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :keyword description: L3 Isolation Domain description. + :paramtype description: str + :keyword connected_subnet_route_policy: Connected Subnet RoutePolicy. + :paramtype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + """ + super().__init__(**kwargs) + self.tags = tags + self.redistribute_connected_subnets = redistribute_connected_subnets + self.redistribute_static_routes = redistribute_static_routes + self.aggregate_route_configuration = aggregate_route_configuration + self.description = description + self.connected_subnet_route_policy = connected_subnet_route_policy + + +class L3IsolationDomainPatchProperties(_serialization.Model): + """L3IsolationDomainPatchProperties define the patch resource properties. + + :ivar redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". Known + values are: "True" and "False". + :vartype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :ivar redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known values + are: "True" and "False". + :vartype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :ivar aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :vartype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :ivar description: L3 Isolation Domain description. + :vartype description: str + :ivar connected_subnet_route_policy: Connected Subnet RoutePolicy. + :vartype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + """ + + _attribute_map = { + "redistribute_connected_subnets": {"key": "redistributeConnectedSubnets", "type": "str"}, + "redistribute_static_routes": {"key": "redistributeStaticRoutes", "type": "str"}, + "aggregate_route_configuration": { + "key": "aggregateRouteConfiguration", + "type": "L3IsolationDomainPatchPropertiesAggregateRouteConfiguration", + }, + "description": {"key": "description", "type": "str"}, + "connected_subnet_route_policy": { + "key": "connectedSubnetRoutePolicy", + "type": "L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy", + }, + } + + def __init__( + self, + *, + redistribute_connected_subnets: Union[str, "_models.RedistributeConnectedSubnets"] = "True", + redistribute_static_routes: Union[str, "_models.RedistributeStaticRoutes"] = "False", + aggregate_route_configuration: Optional[ + "_models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration" + ] = None, + description: Optional[str] = None, + connected_subnet_route_policy: Optional[ + "_models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". + Known values are: "True" and "False". + :paramtype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :keyword redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known + values are: "True" and "False". + :paramtype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :keyword aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :paramtype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :keyword description: L3 Isolation Domain description. + :paramtype description: str + :keyword connected_subnet_route_policy: Connected Subnet RoutePolicy. + :paramtype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + """ + super().__init__(**kwargs) + self.redistribute_connected_subnets = redistribute_connected_subnets + self.redistribute_static_routes = redistribute_static_routes + self.aggregate_route_configuration = aggregate_route_configuration + self.description = description + self.connected_subnet_route_policy = connected_subnet_route_policy + + +class L3IsolationDomainPatchPropertiesAggregateRouteConfiguration(_serialization.Model): + """List of Ipv4 and Ipv6 route configurations. + + :ivar ipv4_routes: List of Ipv4Route prefixes. + :vartype ipv4_routes: + list[~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem] + :ivar ipv6_routes: List of Ipv6Routes prefixes. + :vartype ipv6_routes: + list[~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem] + """ + + _attribute_map = { + "ipv4_routes": { + "key": "ipv4Routes", + "type": "[L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem]", + }, + "ipv6_routes": { + "key": "ipv6Routes", + "type": "[L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem]", + }, + } + + def __init__( + self, + *, + ipv4_routes: Optional[ + List["_models.L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem"] + ] = None, + ipv6_routes: Optional[ + List["_models.L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword ipv4_routes: List of Ipv4Route prefixes. + :paramtype ipv4_routes: + list[~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem] + :keyword ipv6_routes: List of Ipv6Routes prefixes. + :paramtype ipv6_routes: + list[~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem] + """ + super().__init__(**kwargs) + self.ipv4_routes = ipv4_routes + self.ipv6_routes = ipv6_routes + + +class L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv4RoutesItem(_serialization.Model): + """aggregateIpv4Route model. + + :ivar prefix: IPv4 Prefix of the aggregate Ipv4Route. + :vartype prefix: str + """ + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + } + + def __init__(self, *, prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword prefix: IPv4 Prefix of the aggregate Ipv4Route. + :paramtype prefix: str + """ + super().__init__(**kwargs) + self.prefix = prefix + + +class L3IsolationDomainPatchPropertiesAggregateRouteConfigurationIpv6RoutesItem(_serialization.Model): + """aggregateIpv6Route model. + + :ivar prefix: IPv6 Prefix of the aggregate IPv6 Route. + :vartype prefix: str + """ + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + } + + def __init__(self, *, prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword prefix: IPv6 Prefix of the aggregate IPv6 Route. + :paramtype prefix: str + """ + super().__init__(**kwargs) + self.prefix = prefix + + +class L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy(_serialization.Model): + """Connected Subnet RoutePolicy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar export_route_policy_id: exportRoutePolicyId value. + :vartype export_route_policy_id: str + :ivar administrative_state: Enabled/Disabled connected subnet route policy. Ex: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + """ + + _validation = { + "administrative_state": {"readonly": True}, + } + + _attribute_map = { + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + "administrative_state": {"key": "administrativeState", "type": "str"}, + } + + def __init__(self, *, export_route_policy_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword export_route_policy_id: exportRoutePolicyId value. + :paramtype export_route_policy_id: str + """ + super().__init__(**kwargs) + self.export_route_policy_id = export_route_policy_id + self.administrative_state = None + + +class L3IsolationDomainProperties( + AnnotationResource, L3IsolationDomainPatchProperties +): # pylint: disable=too-many-instance-attributes + """L3IsolationDomainProperties define the resource properties. + + 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 redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". Known + values are: "True" and "False". + :vartype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :ivar redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known values + are: "True" and "False". + :vartype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :ivar aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :vartype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :ivar description: L3 Isolation Domain description. + :vartype description: str + :ivar connected_subnet_route_policy: Connected Subnet RoutePolicy. + :vartype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar network_fabric_id: Network Fabric ARM resource id. Required. + :vartype network_fabric_id: str + :ivar disabled_on_resources: List of resources the L3 Isolation Domain is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype disabled_on_resources: list[str] + :ivar administrative_state: Administrative state of the IsolationDomain. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar option_b_disabled_on_resources: List of resources the OptionB is disabled on. Can be + either entire NetworkFabric or NetworkRack. + :vartype option_b_disabled_on_resources: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "network_fabric_id": {"required": True}, + "disabled_on_resources": {"readonly": True}, + "administrative_state": {"readonly": True}, + "option_b_disabled_on_resources": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "redistribute_connected_subnets": {"key": "redistributeConnectedSubnets", "type": "str"}, + "redistribute_static_routes": {"key": "redistributeStaticRoutes", "type": "str"}, + "aggregate_route_configuration": { + "key": "aggregateRouteConfiguration", + "type": "L3IsolationDomainPatchPropertiesAggregateRouteConfiguration", + }, + "description": {"key": "description", "type": "str"}, + "connected_subnet_route_policy": { + "key": "connectedSubnetRoutePolicy", + "type": "L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy", + }, + "annotation": {"key": "annotation", "type": "str"}, + "network_fabric_id": {"key": "networkFabricId", "type": "str"}, + "disabled_on_resources": {"key": "disabledOnResources", "type": "[str]"}, + "administrative_state": {"key": "administrativeState", "type": "str"}, + "option_b_disabled_on_resources": {"key": "optionBDisabledOnResources", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + network_fabric_id: str, + redistribute_connected_subnets: Union[str, "_models.RedistributeConnectedSubnets"] = "True", + redistribute_static_routes: Union[str, "_models.RedistributeStaticRoutes"] = "False", + aggregate_route_configuration: Optional[ + "_models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration" + ] = None, + description: Optional[str] = None, + connected_subnet_route_policy: Optional[ + "_models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy" + ] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword redistribute_connected_subnets: Advertise Connected Subnets. Ex: "True" | "False". + Known values are: "True" and "False". + :paramtype redistribute_connected_subnets: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeConnectedSubnets + :keyword redistribute_static_routes: Advertise Static Routes. Ex: "True" | "False". Known + values are: "True" and "False". + :paramtype redistribute_static_routes: str or + ~azure.mgmt.managednetworkfabric.models.RedistributeStaticRoutes + :keyword aggregate_route_configuration: List of Ipv4 and Ipv6 route configurations. + :paramtype aggregate_route_configuration: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesAggregateRouteConfiguration + :keyword description: L3 Isolation Domain description. + :paramtype description: str + :keyword connected_subnet_route_policy: Connected Subnet RoutePolicy. + :paramtype connected_subnet_route_policy: + ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_fabric_id: Network Fabric ARM resource id. Required. + :paramtype network_fabric_id: str + """ + super().__init__( + annotation=annotation, + redistribute_connected_subnets=redistribute_connected_subnets, + redistribute_static_routes=redistribute_static_routes, + aggregate_route_configuration=aggregate_route_configuration, + description=description, + connected_subnet_route_policy=connected_subnet_route_policy, + **kwargs + ) + self.redistribute_connected_subnets = redistribute_connected_subnets + self.redistribute_static_routes = redistribute_static_routes + self.aggregate_route_configuration = aggregate_route_configuration + self.description = description + self.connected_subnet_route_policy = connected_subnet_route_policy + self.network_fabric_id = network_fabric_id + self.disabled_on_resources = None + self.administrative_state = None + self.option_b_disabled_on_resources = None + self.provisioning_state = None + self.annotation = annotation + + +class L3IsolationDomainsListResult(_serialization.Model): + """List of L3IsolationDomains. + + :ivar value: List of L3IsolationDomain resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[L3IsolationDomain]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.L3IsolationDomain"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of L3IsolationDomain resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Layer2Configuration(_serialization.Model): + """layer2Configuration. + + 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 port_count: Number of ports connected between PE/CE. Maximum value depends on FabricSKU. + :vartype port_count: int + :ivar mtu: MTU of the packets between PE & CE. + :vartype mtu: int + :ivar interfaces: List of network device interfaces resource IDs. + :vartype interfaces: list[str] + """ + + _validation = { + "mtu": {"required": True, "maximum": 9000, "minimum": 1500}, + "interfaces": {"readonly": True}, + } + + _attribute_map = { + "port_count": {"key": "portCount", "type": "int"}, + "mtu": {"key": "mtu", "type": "int"}, + "interfaces": {"key": "interfaces", "type": "[str]"}, + } + + def __init__(self, *, mtu: int = 1500, port_count: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword port_count: Number of ports connected between PE/CE. Maximum value depends on + FabricSKU. + :paramtype port_count: int + :keyword mtu: MTU of the packets between PE & CE. + :paramtype mtu: int + """ + super().__init__(**kwargs) + self.port_count = port_count + self.mtu = mtu + self.interfaces = None + + +class Layer3Configuration(Layer3IpPrefixProperties): + """layer3Configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv4_prefix: str + :ivar primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv6_prefix: str + :ivar secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv4_prefix: str + :ivar secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv6_prefix: str + :ivar import_route_policy_id: importRoutePolicyId. + :vartype import_route_policy_id: str + :ivar export_route_policy_id: exportRoutePolicyId. + :vartype export_route_policy_id: str + :ivar peer_asn: ASN of PE devices for CE/PE connectivity.Example : 28. + :vartype peer_asn: int + :ivar vlan_id: VLAN for CE/PE Layer 3 connectivity.Example : 501. + :vartype vlan_id: int + :ivar fabric_asn: ASN of CE devices for CE/PE connectivity. + :vartype fabric_asn: int + """ + + _validation = { + "peer_asn": {"maximum": 65535, "minimum": 1}, + "vlan_id": {"maximum": 4095, "minimum": 501}, + "fabric_asn": {"readonly": True, "maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "primary_ipv4_prefix": {"key": "primaryIpv4Prefix", "type": "str"}, + "primary_ipv6_prefix": {"key": "primaryIpv6Prefix", "type": "str"}, + "secondary_ipv4_prefix": {"key": "secondaryIpv4Prefix", "type": "str"}, + "secondary_ipv6_prefix": {"key": "secondaryIpv6Prefix", "type": "str"}, + "import_route_policy_id": {"key": "importRoutePolicyId", "type": "str"}, + "export_route_policy_id": {"key": "exportRoutePolicyId", "type": "str"}, + "peer_asn": {"key": "peerASN", "type": "int"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + "fabric_asn": {"key": "fabricASN", "type": "int"}, + } + + def __init__( + self, + *, + primary_ipv4_prefix: Optional[str] = None, + primary_ipv6_prefix: Optional[str] = None, + secondary_ipv4_prefix: Optional[str] = None, + secondary_ipv6_prefix: Optional[str] = None, + import_route_policy_id: Optional[str] = None, + export_route_policy_id: Optional[str] = None, + peer_asn: Optional[int] = None, + vlan_id: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv4_prefix: str + :keyword primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv6_prefix: str + :keyword secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv4_prefix: str + :keyword secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv6_prefix: str + :keyword import_route_policy_id: importRoutePolicyId. + :paramtype import_route_policy_id: str + :keyword export_route_policy_id: exportRoutePolicyId. + :paramtype export_route_policy_id: str + :keyword peer_asn: ASN of PE devices for CE/PE connectivity.Example : 28. + :paramtype peer_asn: int + :keyword vlan_id: VLAN for CE/PE Layer 3 connectivity.Example : 501. + :paramtype vlan_id: int + """ + super().__init__( + primary_ipv4_prefix=primary_ipv4_prefix, + primary_ipv6_prefix=primary_ipv6_prefix, + secondary_ipv4_prefix=secondary_ipv4_prefix, + secondary_ipv6_prefix=secondary_ipv6_prefix, + **kwargs + ) + self.import_route_policy_id = import_route_policy_id + self.export_route_policy_id = export_route_policy_id + self.peer_asn = peer_asn + self.vlan_id = vlan_id + self.fabric_asn = None + + +class NetworkDevice(TrackedResource): # pylint: disable=too-many-instance-attributes + """The NetworkDevice resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar host_name: The host Name of the device. + :vartype host_name: str + :ivar serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :vartype serial_number: str + :ivar version: Current version of the device as defined in SKU. + :vartype version: str + :ivar network_device_sku: Network Device SKU name. + :vartype network_device_sku: str + :ivar network_device_role: networkDeviceRole is the device role: Example: CE | ToR. Known + values are: "CE", "ToR", "NPB", "TS", and "Management". + :vartype network_device_role: str or + ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRoleTypes + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar network_rack_id: Reference to network rack resource id. + :vartype network_rack_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "network_rack_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "serial_number": {"key": "properties.serialNumber", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "network_device_sku": {"key": "properties.networkDeviceSku", "type": "str"}, + "network_device_role": {"key": "properties.networkDeviceRole", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "network_rack_id": {"key": "properties.networkRackId", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + host_name: Optional[str] = None, + serial_number: Optional[str] = None, + network_device_sku: Optional[str] = None, + network_device_role: Optional[Union[str, "_models.NetworkDeviceRoleTypes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword host_name: The host Name of the device. + :paramtype host_name: str + :keyword serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :paramtype serial_number: str + :keyword network_device_sku: Network Device SKU name. + :paramtype network_device_sku: str + :keyword network_device_role: networkDeviceRole is the device role: Example: CE | ToR. Known + values are: "CE", "ToR", "NPB", "TS", and "Management". + :paramtype network_device_role: str or + ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRoleTypes + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.host_name = host_name + self.serial_number = serial_number + self.version = None + self.network_device_sku = network_device_sku + self.network_device_role = network_device_role + self.provisioning_state = None + self.network_rack_id = None + + +class NetworkDevicePatchableProperties(_serialization.Model): + """Network Device updatable properties. + + :ivar host_name: The host Name of the device. + :vartype host_name: str + :ivar serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :vartype serial_number: str + """ + + _attribute_map = { + "host_name": {"key": "hostName", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + } + + def __init__(self, *, host_name: Optional[str] = None, serial_number: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword host_name: The host Name of the device. + :paramtype host_name: str + :keyword serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :paramtype serial_number: str + """ + super().__init__(**kwargs) + self.host_name = host_name + self.serial_number = serial_number + + +class NetworkDevicePatchParameters(_serialization.Model): + """The NetworkDevicePatchParameters resource definition. + + :ivar tags: Azure resource tags that will replace the existing ones. + :vartype tags: dict[str, str] + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar host_name: The host Name of the device. + :vartype host_name: str + :ivar serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :vartype serial_number: str + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "serial_number": {"key": "properties.serialNumber", "type": "str"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + host_name: Optional[str] = None, + serial_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Azure resource tags that will replace the existing ones. + :paramtype tags: dict[str, str] + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword host_name: The host Name of the device. + :paramtype host_name: str + :keyword serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :paramtype serial_number: str + """ + super().__init__(**kwargs) + self.tags = tags + self.annotation = annotation + self.host_name = host_name + self.serial_number = serial_number + + +class NetworkDevicePatchParametersProperties(AnnotationResource, NetworkDevicePatchableProperties): + """Network Device Patch properties. + + :ivar host_name: The host Name of the device. + :vartype host_name: str + :ivar serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :vartype serial_number: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _attribute_map = { + "host_name": {"key": "hostName", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "annotation": {"key": "annotation", "type": "str"}, + } + + def __init__( + self, + *, + host_name: Optional[str] = None, + serial_number: Optional[str] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_name: The host Name of the device. + :paramtype host_name: str + :keyword serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :paramtype serial_number: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(annotation=annotation, host_name=host_name, serial_number=serial_number, **kwargs) + self.host_name = host_name + self.serial_number = serial_number + self.annotation = annotation + + +class NetworkDeviceProperties(AnnotationResource, NetworkDevicePatchableProperties): + """NetworkDeviceProperties define the resource properties. + + 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 host_name: The host Name of the device. + :vartype host_name: str + :ivar serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :vartype serial_number: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar version: Current version of the device as defined in SKU. + :vartype version: str + :ivar network_device_sku: Network Device SKU name. Required. + :vartype network_device_sku: str + :ivar network_device_role: networkDeviceRole is the device role: Example: CE | ToR. Required. + Known values are: "CE", "ToR", "NPB", "TS", and "Management". + :vartype network_device_role: str or + ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRoleTypes + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar network_rack_id: Reference to network rack resource id. + :vartype network_rack_id: str + """ + + _validation = { + "version": {"readonly": True}, + "network_device_sku": {"required": True}, + "network_device_role": {"required": True}, + "provisioning_state": {"readonly": True}, + "network_rack_id": {"readonly": True}, + } + + _attribute_map = { + "host_name": {"key": "hostName", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "annotation": {"key": "annotation", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "network_device_sku": {"key": "networkDeviceSku", "type": "str"}, + "network_device_role": {"key": "networkDeviceRole", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "network_rack_id": {"key": "networkRackId", "type": "str"}, + } + + def __init__( + self, + *, + network_device_sku: str, + network_device_role: Union[str, "_models.NetworkDeviceRoleTypes"], + host_name: Optional[str] = None, + serial_number: Optional[str] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_name: The host Name of the device. + :paramtype host_name: str + :keyword serial_number: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. + Example: Arista;DCS-7280DR3-24;12.05;JPE21116969. + :paramtype serial_number: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_device_sku: Network Device SKU name. Required. + :paramtype network_device_sku: str + :keyword network_device_role: networkDeviceRole is the device role: Example: CE | ToR. + Required. Known values are: "CE", "ToR", "NPB", "TS", and "Management". + :paramtype network_device_role: str or + ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRoleTypes + """ + super().__init__(annotation=annotation, host_name=host_name, serial_number=serial_number, **kwargs) + self.host_name = host_name + self.serial_number = serial_number + self.version = None + self.network_device_sku = network_device_sku + self.network_device_role = network_device_role + self.provisioning_state = None + self.network_rack_id = None + self.annotation = annotation + + +class NetworkDeviceSku(ProxyResource): # pylint: disable=too-many-instance-attributes + """The NetworkDeviceSku resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar model: Model of the network device. Required. + :vartype model: str + :ivar manufacturer: Manufacturer of the network device. + :vartype manufacturer: str + :ivar supported_versions: List of network device interfaces. + :vartype supported_versions: + list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesSupportedVersionsItem] + :ivar limits: Network device limits. + :vartype limits: ~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesLimits + :ivar supported_role_types: Available roles for the network device. + :vartype supported_role_types: list[str or + ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRoleName] + :ivar interfaces: List of network device interfaces. + :vartype interfaces: + list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesInterfacesItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "model": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "model": {"key": "properties.model", "type": "str"}, + "manufacturer": {"key": "properties.manufacturer", "type": "str"}, + "supported_versions": { + "key": "properties.supportedVersions", + "type": "[NetworkDeviceSkuPropertiesSupportedVersionsItem]", + }, + "limits": {"key": "properties.limits", "type": "NetworkDeviceSkuPropertiesLimits"}, + "supported_role_types": {"key": "properties.supportedRoleTypes", "type": "[str]"}, + "interfaces": {"key": "properties.interfaces", "type": "[NetworkDeviceSkuPropertiesInterfacesItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + model: str, + manufacturer: Optional[str] = None, + supported_versions: Optional[List["_models.NetworkDeviceSkuPropertiesSupportedVersionsItem"]] = None, + limits: Optional["_models.NetworkDeviceSkuPropertiesLimits"] = None, + supported_role_types: Optional[List[Union[str, "_models.NetworkDeviceRoleName"]]] = None, + interfaces: Optional[List["_models.NetworkDeviceSkuPropertiesInterfacesItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword model: Model of the network device. Required. + :paramtype model: str + :keyword manufacturer: Manufacturer of the network device. + :paramtype manufacturer: str + :keyword supported_versions: List of network device interfaces. + :paramtype supported_versions: + list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesSupportedVersionsItem] + :keyword limits: Network device limits. + :paramtype limits: ~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesLimits + :keyword supported_role_types: Available roles for the network device. + :paramtype supported_role_types: list[str or + ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRoleName] + :keyword interfaces: List of network device interfaces. + :paramtype interfaces: + list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesInterfacesItem] + """ + super().__init__(**kwargs) + self.model = model + self.manufacturer = manufacturer + self.supported_versions = supported_versions + self.limits = limits + self.supported_role_types = supported_role_types + self.interfaces = interfaces + self.provisioning_state = None + + +class NetworkDeviceSkuPropertiesInterfacesItem(_serialization.Model): + """Network device interface properties. + + :ivar identifier: Interface identifier. Example: HundredGigE0/0. + :vartype identifier: str + :ivar interface_type: Interface type. + :vartype interface_type: str + :ivar supported_connector_types: List of supported connector types. + :vartype supported_connector_types: + list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem] + """ + + _attribute_map = { + "identifier": {"key": "identifier", "type": "str"}, + "interface_type": {"key": "interfaceType", "type": "str"}, + "supported_connector_types": { + "key": "supportedConnectorTypes", + "type": "[NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem]", + }, + } + + def __init__( + self, + *, + identifier: Optional[str] = None, + interface_type: Optional[str] = None, + supported_connector_types: Optional[ + List["_models.NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword identifier: Interface identifier. Example: HundredGigE0/0. + :paramtype identifier: str + :keyword interface_type: Interface type. + :paramtype interface_type: str + :keyword supported_connector_types: List of supported connector types. + :paramtype supported_connector_types: + list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem] + """ + super().__init__(**kwargs) + self.identifier = identifier + self.interface_type = interface_type + self.supported_connector_types = supported_connector_types + + +class NetworkDeviceSkuPropertiesInterfacesPropertiesItemsItem(_serialization.Model): + """Supported connector properties. + + :ivar connector_type: Connector type. Example: Optical. + :vartype connector_type: str + :ivar max_speed_in_mbps: Maximum speed of the connector in Mbps. + :vartype max_speed_in_mbps: int + """ + + _attribute_map = { + "connector_type": {"key": "connectorType", "type": "str"}, + "max_speed_in_mbps": {"key": "maxSpeedInMbps", "type": "int"}, + } + + def __init__( + self, *, connector_type: Optional[str] = None, max_speed_in_mbps: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword connector_type: Connector type. Example: Optical. + :paramtype connector_type: str + :keyword max_speed_in_mbps: Maximum speed of the connector in Mbps. + :paramtype max_speed_in_mbps: int + """ + super().__init__(**kwargs) + self.connector_type = connector_type + self.max_speed_in_mbps = max_speed_in_mbps + + +class NetworkDeviceSkuPropertiesLimits(_serialization.Model): + """Network device limits. + + :ivar physical_interface_count: Maximum number of physical interfaces. + :vartype physical_interface_count: int + :ivar max_sub_interfaces: Maximum number of sub-interfaces. + :vartype max_sub_interfaces: int + :ivar max_tunnel_interfaces: Maximum number of tunnel interfaces. + :vartype max_tunnel_interfaces: int + :ivar max_virtual_router_functions: Maximum number of virtual router functions. + :vartype max_virtual_router_functions: int + :ivar max_border_gateway_protocol_peers: Maximum number of Border Gateway Protocol (BGP) peers. + :vartype max_border_gateway_protocol_peers: int + :ivar max_bidirectional_forwarding_detection_peers: Maximum number of Bidirectional Forwarding + Detection (BFD) peers. + :vartype max_bidirectional_forwarding_detection_peers: int + """ + + _attribute_map = { + "physical_interface_count": {"key": "physicalInterfaceCount", "type": "int"}, + "max_sub_interfaces": {"key": "maxSubInterfaces", "type": "int"}, + "max_tunnel_interfaces": {"key": "maxTunnelInterfaces", "type": "int"}, + "max_virtual_router_functions": {"key": "maxVirtualRouterFunctions", "type": "int"}, + "max_border_gateway_protocol_peers": {"key": "maxBorderGatewayProtocolPeers", "type": "int"}, + "max_bidirectional_forwarding_detection_peers": { + "key": "maxBidirectionalForwardingDetectionPeers", + "type": "int", + }, + } + + def __init__( + self, + *, + physical_interface_count: Optional[int] = None, + max_sub_interfaces: Optional[int] = None, + max_tunnel_interfaces: Optional[int] = None, + max_virtual_router_functions: Optional[int] = None, + max_border_gateway_protocol_peers: Optional[int] = None, + max_bidirectional_forwarding_detection_peers: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword physical_interface_count: Maximum number of physical interfaces. + :paramtype physical_interface_count: int + :keyword max_sub_interfaces: Maximum number of sub-interfaces. + :paramtype max_sub_interfaces: int + :keyword max_tunnel_interfaces: Maximum number of tunnel interfaces. + :paramtype max_tunnel_interfaces: int + :keyword max_virtual_router_functions: Maximum number of virtual router functions. + :paramtype max_virtual_router_functions: int + :keyword max_border_gateway_protocol_peers: Maximum number of Border Gateway Protocol (BGP) + peers. + :paramtype max_border_gateway_protocol_peers: int + :keyword max_bidirectional_forwarding_detection_peers: Maximum number of Bidirectional + Forwarding Detection (BFD) peers. + :paramtype max_bidirectional_forwarding_detection_peers: int + """ + super().__init__(**kwargs) + self.physical_interface_count = physical_interface_count + self.max_sub_interfaces = max_sub_interfaces + self.max_tunnel_interfaces = max_tunnel_interfaces + self.max_virtual_router_functions = max_virtual_router_functions + self.max_border_gateway_protocol_peers = max_border_gateway_protocol_peers + self.max_bidirectional_forwarding_detection_peers = max_bidirectional_forwarding_detection_peers + + +class NetworkDeviceSkuPropertiesSupportedVersionsItem(_serialization.Model): + """Network device interface properties. + + :ivar version: Operating system and firmware combined versions. + :vartype version: str + :ivar vendor_os_version: Operating system version. + :vartype vendor_os_version: str + :ivar vendor_firmware_version: Firmware version. + :vartype vendor_firmware_version: str + :ivar is_current: If the current version is in use. Known values are: "true" and "false". + :vartype is_current: str or ~azure.mgmt.managednetworkfabric.models.IsCurrentVersion + :ivar is_test: If the current version is a test version. Known values are: "true" and "false". + :vartype is_test: str or ~azure.mgmt.managednetworkfabric.models.IsTestVersion + """ + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "vendor_os_version": {"key": "vendorOsVersion", "type": "str"}, + "vendor_firmware_version": {"key": "vendorFirmwareVersion", "type": "str"}, + "is_current": {"key": "isCurrent", "type": "str"}, + "is_test": {"key": "isTest", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + vendor_os_version: Optional[str] = None, + vendor_firmware_version: Optional[str] = None, + is_current: Optional[Union[str, "_models.IsCurrentVersion"]] = None, + is_test: Optional[Union[str, "_models.IsTestVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Operating system and firmware combined versions. + :paramtype version: str + :keyword vendor_os_version: Operating system version. + :paramtype vendor_os_version: str + :keyword vendor_firmware_version: Firmware version. + :paramtype vendor_firmware_version: str + :keyword is_current: If the current version is in use. Known values are: "true" and "false". + :paramtype is_current: str or ~azure.mgmt.managednetworkfabric.models.IsCurrentVersion + :keyword is_test: If the current version is a test version. Known values are: "true" and + "false". + :paramtype is_test: str or ~azure.mgmt.managednetworkfabric.models.IsTestVersion + """ + super().__init__(**kwargs) + self.version = version + self.vendor_os_version = vendor_os_version + self.vendor_firmware_version = vendor_firmware_version + self.is_current = is_current + self.is_test = is_test + + +class NetworkDeviceSkusListResult(_serialization.Model): + """List of NetworkDeviceSkus. + + :ivar value: List of NetworkDeviceSku resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSku] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkDeviceSku]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkDeviceSku"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkDeviceSku resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSku] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkDevicesListResult(_serialization.Model): + """List of NetworkDevices. + + :ivar value: List of NetworkDevice resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkDevice]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkDevice"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkDevice resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkFabric(TrackedResource): # pylint: disable=too-many-instance-attributes + """The NetworkFabric resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar racks: List of NetworkRack resource IDs under the Network Fabric. The number of racks + allowed depends on the Network Fabric SKU. + :vartype racks: list[str] + :ivar l2_isolation_domains: List of L2IsolationDomain resource IDs under the Network Fabric. + :vartype l2_isolation_domains: list[str] + :ivar l3_isolation_domains: List of L3IsolationDomain resource IDs under the Network Fabric. + :vartype l3_isolation_domains: list[str] + :ivar network_fabric_sku: Supported Network Fabric SKU.Example: Compute / Aggregate racks. Once + the user chooses a particular SKU, only supported racks can be added to the Network Fabric. The + SKU determines whether it is a single / multi rack Network Fabric. + :vartype network_fabric_sku: str + :ivar rack_count: Number of racks associated to Network Fabric.Possible values are from 2-8. + :vartype rack_count: int + :ivar server_count_per_rack: Number of servers.Possible values are from 1-16. + :vartype server_count_per_rack: int + :ivar ipv4_prefix: IPv4Prefix for Management Network. Example: 10.1.0.0/19. + :vartype ipv4_prefix: str + :ivar ipv6_prefix: IPv6Prefix for Management Network. Example: 3FFE:FFFF:0:CD40::/59. + :vartype ipv6_prefix: str + :ivar router_id: Router Id of CE to be used for MP-BGP between PE and CE. + :vartype router_id: str + :ivar fabric_asn: ASN of CE devices for CE/PE connectivity. + :vartype fabric_asn: int + :ivar network_fabric_controller_id: Azure resource ID for the NetworkFabricController the + NetworkFabric belongs. + :vartype network_fabric_controller_id: str + :ivar terminal_server_configuration: Network and credentials configuration currently applied to + terminal server. + :vartype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesTerminalServerConfiguration + :ivar management_network_configuration: Configuration to be used to setup the management + network. + :vartype management_network_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfiguration + :ivar operational_state: Gets the operational state of the resource. Known values are: + "Provisioning", "Provisioned", "ErrorProvisioning", "Deprovisioning", "Deprovisioned", + "ErrorDeprovisioning", and "DeferredControl". + :vartype operational_state: str or + ~azure.mgmt.managednetworkfabric.models.NetworkFabricOperationalState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "racks": {"readonly": True}, + "l2_isolation_domains": {"readonly": True}, + "l3_isolation_domains": {"readonly": True}, + "rack_count": {"maximum": 8, "minimum": 2}, + "server_count_per_rack": {"maximum": 16, "minimum": 1}, + "router_id": {"readonly": True}, + "fabric_asn": {"maximum": 65535, "minimum": 1}, + "operational_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "racks": {"key": "properties.racks", "type": "[str]"}, + "l2_isolation_domains": {"key": "properties.l2IsolationDomains", "type": "[str]"}, + "l3_isolation_domains": {"key": "properties.l3IsolationDomains", "type": "[str]"}, + "network_fabric_sku": {"key": "properties.networkFabricSku", "type": "str"}, + "rack_count": {"key": "properties.rackCount", "type": "int"}, + "server_count_per_rack": {"key": "properties.serverCountPerRack", "type": "int"}, + "ipv4_prefix": {"key": "properties.ipv4Prefix", "type": "str"}, + "ipv6_prefix": {"key": "properties.ipv6Prefix", "type": "str"}, + "router_id": {"key": "properties.routerId", "type": "str"}, + "fabric_asn": {"key": "properties.fabricASN", "type": "int"}, + "network_fabric_controller_id": {"key": "properties.networkFabricControllerId", "type": "str"}, + "terminal_server_configuration": { + "key": "properties.terminalServerConfiguration", + "type": "NetworkFabricPropertiesTerminalServerConfiguration", + }, + "management_network_configuration": { + "key": "properties.managementNetworkConfiguration", + "type": "NetworkFabricPropertiesManagementNetworkConfiguration", + }, + "operational_state": {"key": "properties.operationalState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + network_fabric_sku: Optional[str] = None, + rack_count: Optional[int] = None, + server_count_per_rack: Optional[int] = None, + ipv4_prefix: Optional[str] = None, + ipv6_prefix: Optional[str] = None, + fabric_asn: Optional[int] = None, + network_fabric_controller_id: Optional[str] = None, + terminal_server_configuration: Optional["_models.NetworkFabricPropertiesTerminalServerConfiguration"] = None, + management_network_configuration: Optional[ + "_models.NetworkFabricPropertiesManagementNetworkConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_fabric_sku: Supported Network Fabric SKU.Example: Compute / Aggregate racks. + Once the user chooses a particular SKU, only supported racks can be added to the Network + Fabric. The SKU determines whether it is a single / multi rack Network Fabric. + :paramtype network_fabric_sku: str + :keyword rack_count: Number of racks associated to Network Fabric.Possible values are from 2-8. + :paramtype rack_count: int + :keyword server_count_per_rack: Number of servers.Possible values are from 1-16. + :paramtype server_count_per_rack: int + :keyword ipv4_prefix: IPv4Prefix for Management Network. Example: 10.1.0.0/19. + :paramtype ipv4_prefix: str + :keyword ipv6_prefix: IPv6Prefix for Management Network. Example: 3FFE:FFFF:0:CD40::/59. + :paramtype ipv6_prefix: str + :keyword fabric_asn: ASN of CE devices for CE/PE connectivity. + :paramtype fabric_asn: int + :keyword network_fabric_controller_id: Azure resource ID for the NetworkFabricController the + NetworkFabric belongs. + :paramtype network_fabric_controller_id: str + :keyword terminal_server_configuration: Network and credentials configuration currently applied + to terminal server. + :paramtype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesTerminalServerConfiguration + :keyword management_network_configuration: Configuration to be used to setup the management + network. + :paramtype management_network_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfiguration + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.racks = None + self.l2_isolation_domains = None + self.l3_isolation_domains = None + self.network_fabric_sku = network_fabric_sku + self.rack_count = rack_count + self.server_count_per_rack = server_count_per_rack + self.ipv4_prefix = ipv4_prefix + self.ipv6_prefix = ipv6_prefix + self.router_id = None + self.fabric_asn = fabric_asn + self.network_fabric_controller_id = network_fabric_controller_id + self.terminal_server_configuration = terminal_server_configuration + self.management_network_configuration = management_network_configuration + self.operational_state = None + self.provisioning_state = None + + +class NetworkFabricController(TrackedResource): # pylint: disable=too-many-instance-attributes + """The NetworkFabricController resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :vartype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :ivar workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :vartype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :ivar infrastructure_services: InfrastructureServices IP ranges. + :vartype infrastructure_services: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesInfrastructureServices + :ivar workload_services: WorkloadServices IP ranges. + :vartype workload_services: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesWorkloadServices + :ivar managed_resource_group_configuration: Managed Resource Group configuration properties. + :vartype managed_resource_group_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesManagedResourceGroupConfiguration + :ivar network_fabric_ids: The NF-ID will be an input parameter used by the NF to link and get + associated with the parent NFC Service. + :vartype network_fabric_ids: list[str] + :ivar workload_management_network: A workload management network is required for all the tenant + (workload) traffic. This traffic is only dedicated for Tenant workloads which are required to + access internet or any other MSFT/Public endpoints. + :vartype workload_management_network: bool + :ivar ipv4_address_space: IPv4 Network Fabric Controller Address Space. + :vartype ipv4_address_space: str + :ivar ipv6_address_space: IPv6 Network Fabric Controller Address Space. + :vartype ipv6_address_space: str + :ivar operational_state: The Operational Status would always be NULL. Look only in to the + Provisioning state for the latest status. Known values are: "Configuring", "Succeeded", and + "Failed". + :vartype operational_state: str or + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerOperationalState + :ivar provisioning_state: Provides you the latest status of the NFC service, whether it is + Accepted, updating, Succeeded or Failed. During this process, the states keep changing based on + the status of NFC provisioning. Known values are: "Succeeded", "Updating", "Canceled", + "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "infrastructure_services": {"readonly": True}, + "workload_services": {"readonly": True}, + "network_fabric_ids": {"readonly": True}, + "workload_management_network": {"readonly": True}, + "operational_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "infrastructure_express_route_connections": { + "key": "properties.infrastructureExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + "workload_express_route_connections": { + "key": "properties.workloadExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + "infrastructure_services": { + "key": "properties.infrastructureServices", + "type": "NetworkFabricControllerPropertiesInfrastructureServices", + }, + "workload_services": { + "key": "properties.workloadServices", + "type": "NetworkFabricControllerPropertiesWorkloadServices", + }, + "managed_resource_group_configuration": { + "key": "properties.managedResourceGroupConfiguration", + "type": "NetworkFabricControllerPropertiesManagedResourceGroupConfiguration", + }, + "network_fabric_ids": {"key": "properties.networkFabricIds", "type": "[str]"}, + "workload_management_network": {"key": "properties.workloadManagementNetwork", "type": "bool"}, + "ipv4_address_space": {"key": "properties.ipv4AddressSpace", "type": "str"}, + "ipv6_address_space": {"key": "properties.ipv6AddressSpace", "type": "str"}, + "operational_state": {"key": "properties.operationalState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + infrastructure_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + workload_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + managed_resource_group_configuration: Optional[ + "_models.NetworkFabricControllerPropertiesManagedResourceGroupConfiguration" + ] = None, + ipv4_address_space: Optional[str] = None, + ipv6_address_space: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :paramtype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :keyword workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :paramtype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :keyword managed_resource_group_configuration: Managed Resource Group configuration properties. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesManagedResourceGroupConfiguration + :keyword ipv4_address_space: IPv4 Network Fabric Controller Address Space. + :paramtype ipv4_address_space: str + :keyword ipv6_address_space: IPv6 Network Fabric Controller Address Space. + :paramtype ipv6_address_space: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.infrastructure_express_route_connections = infrastructure_express_route_connections + self.workload_express_route_connections = workload_express_route_connections + self.infrastructure_services = None + self.workload_services = None + self.managed_resource_group_configuration = managed_resource_group_configuration + self.network_fabric_ids = None + self.workload_management_network = None + self.ipv4_address_space = ipv4_address_space + self.ipv6_address_space = ipv6_address_space + self.operational_state = None + self.provisioning_state = None + + +class NetworkFabricControllerPatch(_serialization.Model): + """The NetworkFabricControllerPatch payload definition. + + :ivar tags: Azure resource tags that will replace the existing ones. + :vartype tags: dict[str, str] + :ivar infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :vartype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :ivar workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :vartype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "infrastructure_express_route_connections": { + "key": "properties.infrastructureExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + "workload_express_route_connections": { + "key": "properties.workloadExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + infrastructure_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + workload_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Azure resource tags that will replace the existing ones. + :paramtype tags: dict[str, str] + :keyword infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :paramtype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :keyword workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :paramtype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + """ + super().__init__(**kwargs) + self.tags = tags + self.infrastructure_express_route_connections = infrastructure_express_route_connections + self.workload_express_route_connections = workload_express_route_connections + + +class NetworkFabricControllerPatchableProperties(_serialization.Model): + """Network Fabric Controller updatable properties. + + :ivar infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :vartype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :ivar workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :vartype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + """ + + _attribute_map = { + "infrastructure_express_route_connections": { + "key": "infrastructureExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + "workload_express_route_connections": { + "key": "workloadExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + } + + def __init__( + self, + *, + infrastructure_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + workload_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :paramtype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :keyword workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :paramtype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + """ + super().__init__(**kwargs) + self.infrastructure_express_route_connections = infrastructure_express_route_connections + self.workload_express_route_connections = workload_express_route_connections + + +class NetworkFabricControllerProperties( + AnnotationResource, NetworkFabricControllerPatchableProperties +): # pylint: disable=too-many-instance-attributes + """NetworkFabricControllerProperties define the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :vartype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :ivar workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :vartype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar infrastructure_services: InfrastructureServices IP ranges. + :vartype infrastructure_services: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesInfrastructureServices + :ivar workload_services: WorkloadServices IP ranges. + :vartype workload_services: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesWorkloadServices + :ivar managed_resource_group_configuration: Managed Resource Group configuration properties. + :vartype managed_resource_group_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesManagedResourceGroupConfiguration + :ivar network_fabric_ids: The NF-ID will be an input parameter used by the NF to link and get + associated with the parent NFC Service. + :vartype network_fabric_ids: list[str] + :ivar workload_management_network: A workload management network is required for all the tenant + (workload) traffic. This traffic is only dedicated for Tenant workloads which are required to + access internet or any other MSFT/Public endpoints. + :vartype workload_management_network: bool + :ivar ipv4_address_space: IPv4 Network Fabric Controller Address Space. + :vartype ipv4_address_space: str + :ivar ipv6_address_space: IPv6 Network Fabric Controller Address Space. + :vartype ipv6_address_space: str + :ivar operational_state: The Operational Status would always be NULL. Look only in to the + Provisioning state for the latest status. Known values are: "Configuring", "Succeeded", and + "Failed". + :vartype operational_state: str or + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerOperationalState + :ivar provisioning_state: Provides you the latest status of the NFC service, whether it is + Accepted, updating, Succeeded or Failed. During this process, the states keep changing based on + the status of NFC provisioning. Known values are: "Succeeded", "Updating", "Canceled", + "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "infrastructure_services": {"readonly": True}, + "workload_services": {"readonly": True}, + "network_fabric_ids": {"readonly": True}, + "workload_management_network": {"readonly": True}, + "operational_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "infrastructure_express_route_connections": { + "key": "infrastructureExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + "workload_express_route_connections": { + "key": "workloadExpressRouteConnections", + "type": "[ExpressRouteConnectionInformation]", + }, + "annotation": {"key": "annotation", "type": "str"}, + "infrastructure_services": { + "key": "infrastructureServices", + "type": "NetworkFabricControllerPropertiesInfrastructureServices", + }, + "workload_services": {"key": "workloadServices", "type": "NetworkFabricControllerPropertiesWorkloadServices"}, + "managed_resource_group_configuration": { + "key": "managedResourceGroupConfiguration", + "type": "NetworkFabricControllerPropertiesManagedResourceGroupConfiguration", + }, + "network_fabric_ids": {"key": "networkFabricIds", "type": "[str]"}, + "workload_management_network": {"key": "workloadManagementNetwork", "type": "bool"}, + "ipv4_address_space": {"key": "ipv4AddressSpace", "type": "str"}, + "ipv6_address_space": {"key": "ipv6AddressSpace", "type": "str"}, + "operational_state": {"key": "operationalState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + infrastructure_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + workload_express_route_connections: Optional[List["_models.ExpressRouteConnectionInformation"]] = None, + annotation: Optional[str] = None, + managed_resource_group_configuration: Optional[ + "_models.NetworkFabricControllerPropertiesManagedResourceGroupConfiguration" + ] = None, + ipv4_address_space: Optional[str] = None, + ipv6_address_space: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword infrastructure_express_route_connections: As part of an update, the Infrastructure + ExpressRoute CircuitID should be provided to create and Provision a NFC. This Express route is + dedicated for Infrastructure services. (This is a Mandatory attribute). + :paramtype infrastructure_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :keyword workload_express_route_connections: As part of an update, the workload ExpressRoute + CircuitID should be provided to create and Provision a NFC. This Express route is dedicated for + Workload services. (This is a Mandatory attribute). + :paramtype workload_express_route_connections: + list[~azure.mgmt.managednetworkfabric.models.ExpressRouteConnectionInformation] + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword managed_resource_group_configuration: Managed Resource Group configuration properties. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPropertiesManagedResourceGroupConfiguration + :keyword ipv4_address_space: IPv4 Network Fabric Controller Address Space. + :paramtype ipv4_address_space: str + :keyword ipv6_address_space: IPv6 Network Fabric Controller Address Space. + :paramtype ipv6_address_space: str + """ + super().__init__( + annotation=annotation, + infrastructure_express_route_connections=infrastructure_express_route_connections, + workload_express_route_connections=workload_express_route_connections, + **kwargs + ) + self.infrastructure_express_route_connections = infrastructure_express_route_connections + self.workload_express_route_connections = workload_express_route_connections + self.infrastructure_services = None + self.workload_services = None + self.managed_resource_group_configuration = managed_resource_group_configuration + self.network_fabric_ids = None + self.workload_management_network = None + self.ipv4_address_space = ipv4_address_space + self.ipv6_address_space = ipv6_address_space + self.operational_state = None + self.provisioning_state = None + self.annotation = annotation + + +class NetworkFabricControllerPropertiesInfrastructureServices(_serialization.Model): + """InfrastructureServices IP ranges. + + :ivar ipv4_address_spaces: The IPv4 Address space is optional, if the value is not defined at + the time of NFC creation, then the default value 10.0.0.0/19 is considered. The IPV4 address + subnet is an optional attribute. + :vartype ipv4_address_spaces: list[str] + :ivar ipv6_address_spaces: The IPv6 is not supported right now. + :vartype ipv6_address_spaces: list[str] + """ + + _attribute_map = { + "ipv4_address_spaces": {"key": "ipv4AddressSpaces", "type": "[str]"}, + "ipv6_address_spaces": {"key": "ipv6AddressSpaces", "type": "[str]"}, + } + + def __init__( + self, + *, + ipv4_address_spaces: Optional[List[str]] = None, + ipv6_address_spaces: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword ipv4_address_spaces: The IPv4 Address space is optional, if the value is not defined + at the time of NFC creation, then the default value 10.0.0.0/19 is considered. The IPV4 address + subnet is an optional attribute. + :paramtype ipv4_address_spaces: list[str] + :keyword ipv6_address_spaces: The IPv6 is not supported right now. + :paramtype ipv6_address_spaces: list[str] + """ + super().__init__(**kwargs) + self.ipv4_address_spaces = ipv4_address_spaces + self.ipv6_address_spaces = ipv6_address_spaces + + +class NetworkFabricControllerPropertiesManagedResourceGroupConfiguration(_serialization.Model): + """Managed Resource Group configuration properties. + + :ivar name: The NFC service will be hosted in a Managed resource group. + :vartype name: str + :ivar location: Managed resource group location. + :vartype location: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, location: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The NFC service will be hosted in a Managed resource group. + :paramtype name: str + :keyword location: Managed resource group location. + :paramtype location: str + """ + super().__init__(**kwargs) + self.name = name + self.location = location + + +class NetworkFabricControllerPropertiesWorkloadServices(_serialization.Model): + """WorkloadServices IP ranges. + + :ivar ipv4_address_spaces: The IPv4 Address space is optional, if the value is defined at the + time of NFC creation, then the default value 10.0.0.0/19 is considered. The IPV4 address subnet + is an optional attribute. + :vartype ipv4_address_spaces: list[str] + :ivar ipv6_address_spaces: The IPv6 is not supported right now. + :vartype ipv6_address_spaces: list[str] + """ + + _attribute_map = { + "ipv4_address_spaces": {"key": "ipv4AddressSpaces", "type": "[str]"}, + "ipv6_address_spaces": {"key": "ipv6AddressSpaces", "type": "[str]"}, + } + + def __init__( + self, + *, + ipv4_address_spaces: Optional[List[str]] = None, + ipv6_address_spaces: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword ipv4_address_spaces: The IPv4 Address space is optional, if the value is defined at + the time of NFC creation, then the default value 10.0.0.0/19 is considered. The IPV4 address + subnet is an optional attribute. + :paramtype ipv4_address_spaces: list[str] + :keyword ipv6_address_spaces: The IPv6 is not supported right now. + :paramtype ipv6_address_spaces: list[str] + """ + super().__init__(**kwargs) + self.ipv4_address_spaces = ipv4_address_spaces + self.ipv6_address_spaces = ipv6_address_spaces + + +class NetworkFabricControllersListResult(_serialization.Model): + """List of NetworkFabricControllers. + + :ivar value: List of NetworkFabricController resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkFabricController]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkFabricController"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkFabricController resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkFabricPatchableProperties(_serialization.Model): + """Network Fabric updatable properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar racks: List of NetworkRack resource IDs under the Network Fabric. The number of racks + allowed depends on the Network Fabric SKU. + :vartype racks: list[str] + :ivar l2_isolation_domains: List of L2IsolationDomain resource IDs under the Network Fabric. + :vartype l2_isolation_domains: list[str] + :ivar l3_isolation_domains: List of L3IsolationDomain resource IDs under the Network Fabric. + :vartype l3_isolation_domains: list[str] + """ + + _validation = { + "racks": {"readonly": True}, + "l2_isolation_domains": {"readonly": True}, + "l3_isolation_domains": {"readonly": True}, + } + + _attribute_map = { + "racks": {"key": "racks", "type": "[str]"}, + "l2_isolation_domains": {"key": "l2IsolationDomains", "type": "[str]"}, + "l3_isolation_domains": {"key": "l3IsolationDomains", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.racks = None + self.l2_isolation_domains = None + self.l3_isolation_domains = None + + +class NetworkFabricPatchParameters(_serialization.Model): + """The NetworkFabric resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: Azure resource tags that will replace the existing ones. + :vartype tags: dict[str, str] + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar terminal_server_configuration: Network and credentials configuration already applied to + terminal server. + :vartype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.TerminalServerPatchParametersTerminalServerConfiguration + :ivar racks: List of NetworkRack resource IDs under the Network Fabric. The number of racks + allowed depends on the Network Fabric SKU. + :vartype racks: list[str] + :ivar l2_isolation_domains: List of L2IsolationDomain resource IDs under the Network Fabric. + :vartype l2_isolation_domains: list[str] + :ivar l3_isolation_domains: List of L3IsolationDomain resource IDs under the Network Fabric. + :vartype l3_isolation_domains: list[str] + """ + + _validation = { + "racks": {"readonly": True}, + "l2_isolation_domains": {"readonly": True}, + "l3_isolation_domains": {"readonly": True}, + } + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "terminal_server_configuration": { + "key": "properties.terminalServerConfiguration", + "type": "TerminalServerPatchParametersTerminalServerConfiguration", + }, + "racks": {"key": "properties.racks", "type": "[str]"}, + "l2_isolation_domains": {"key": "properties.l2IsolationDomains", "type": "[str]"}, + "l3_isolation_domains": {"key": "properties.l3IsolationDomains", "type": "[str]"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + terminal_server_configuration: Optional[ + "_models.TerminalServerPatchParametersTerminalServerConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Azure resource tags that will replace the existing ones. + :paramtype tags: dict[str, str] + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword terminal_server_configuration: Network and credentials configuration already applied + to terminal server. + :paramtype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.TerminalServerPatchParametersTerminalServerConfiguration + """ + super().__init__(**kwargs) + self.tags = tags + self.annotation = annotation + self.terminal_server_configuration = terminal_server_configuration + self.racks = None + self.l2_isolation_domains = None + self.l3_isolation_domains = None + + +class TerminalServerPatchParameters(_serialization.Model): + """Terminal server patch parameters. + + :ivar terminal_server_configuration: Network and credentials configuration already applied to + terminal server. + :vartype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.TerminalServerPatchParametersTerminalServerConfiguration + """ + + _attribute_map = { + "terminal_server_configuration": { + "key": "terminalServerConfiguration", + "type": "TerminalServerPatchParametersTerminalServerConfiguration", + }, + } + + def __init__( + self, + *, + terminal_server_configuration: Optional[ + "_models.TerminalServerPatchParametersTerminalServerConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword terminal_server_configuration: Network and credentials configuration already applied + to terminal server. + :paramtype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.TerminalServerPatchParametersTerminalServerConfiguration + """ + super().__init__(**kwargs) + self.terminal_server_configuration = terminal_server_configuration + + +class NetworkFabricPatchParametersProperties( + AnnotationResource, TerminalServerPatchParameters, NetworkFabricPatchableProperties +): + """Network Fabric Patch properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar racks: List of NetworkRack resource IDs under the Network Fabric. The number of racks + allowed depends on the Network Fabric SKU. + :vartype racks: list[str] + :ivar l2_isolation_domains: List of L2IsolationDomain resource IDs under the Network Fabric. + :vartype l2_isolation_domains: list[str] + :ivar l3_isolation_domains: List of L3IsolationDomain resource IDs under the Network Fabric. + :vartype l3_isolation_domains: list[str] + :ivar terminal_server_configuration: Network and credentials configuration already applied to + terminal server. + :vartype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.TerminalServerPatchParametersTerminalServerConfiguration + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _validation = { + "racks": {"readonly": True}, + "l2_isolation_domains": {"readonly": True}, + "l3_isolation_domains": {"readonly": True}, + } + + _attribute_map = { + "racks": {"key": "racks", "type": "[str]"}, + "l2_isolation_domains": {"key": "l2IsolationDomains", "type": "[str]"}, + "l3_isolation_domains": {"key": "l3IsolationDomains", "type": "[str]"}, + "terminal_server_configuration": { + "key": "terminalServerConfiguration", + "type": "TerminalServerPatchParametersTerminalServerConfiguration", + }, + "annotation": {"key": "annotation", "type": "str"}, + } + + def __init__( + self, + *, + terminal_server_configuration: Optional[ + "_models.TerminalServerPatchParametersTerminalServerConfiguration" + ] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword terminal_server_configuration: Network and credentials configuration already applied + to terminal server. + :paramtype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.TerminalServerPatchParametersTerminalServerConfiguration + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(annotation=annotation, terminal_server_configuration=terminal_server_configuration, **kwargs) + self.racks = None + self.l2_isolation_domains = None + self.l3_isolation_domains = None + self.terminal_server_configuration = terminal_server_configuration + self.annotation = annotation + + +class NetworkFabricProperties( + AnnotationResource, NetworkFabricPatchableProperties +): # pylint: disable=too-many-instance-attributes + """NetworkFabricProperties - define the resource properties. + + 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 racks: List of NetworkRack resource IDs under the Network Fabric. The number of racks + allowed depends on the Network Fabric SKU. + :vartype racks: list[str] + :ivar l2_isolation_domains: List of L2IsolationDomain resource IDs under the Network Fabric. + :vartype l2_isolation_domains: list[str] + :ivar l3_isolation_domains: List of L3IsolationDomain resource IDs under the Network Fabric. + :vartype l3_isolation_domains: list[str] + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar network_fabric_sku: Supported Network Fabric SKU.Example: Compute / Aggregate racks. Once + the user chooses a particular SKU, only supported racks can be added to the Network Fabric. The + SKU determines whether it is a single / multi rack Network Fabric. Required. + :vartype network_fabric_sku: str + :ivar rack_count: Number of racks associated to Network Fabric.Possible values are from 2-8. + Required. + :vartype rack_count: int + :ivar server_count_per_rack: Number of servers.Possible values are from 1-16. Required. + :vartype server_count_per_rack: int + :ivar ipv4_prefix: IPv4Prefix for Management Network. Example: 10.1.0.0/19. + :vartype ipv4_prefix: str + :ivar ipv6_prefix: IPv6Prefix for Management Network. Example: 3FFE:FFFF:0:CD40::/59. + :vartype ipv6_prefix: str + :ivar router_id: Router Id of CE to be used for MP-BGP between PE and CE. + :vartype router_id: str + :ivar fabric_asn: ASN of CE devices for CE/PE connectivity. Required. + :vartype fabric_asn: int + :ivar network_fabric_controller_id: Azure resource ID for the NetworkFabricController the + NetworkFabric belongs. Required. + :vartype network_fabric_controller_id: str + :ivar terminal_server_configuration: Network and credentials configuration currently applied to + terminal server. Required. + :vartype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesTerminalServerConfiguration + :ivar management_network_configuration: Configuration to be used to setup the management + network. Required. + :vartype management_network_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfiguration + :ivar operational_state: Gets the operational state of the resource. Known values are: + "Provisioning", "Provisioned", "ErrorProvisioning", "Deprovisioning", "Deprovisioned", + "ErrorDeprovisioning", and "DeferredControl". + :vartype operational_state: str or + ~azure.mgmt.managednetworkfabric.models.NetworkFabricOperationalState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "racks": {"readonly": True}, + "l2_isolation_domains": {"readonly": True}, + "l3_isolation_domains": {"readonly": True}, + "network_fabric_sku": {"required": True}, + "rack_count": {"required": True, "maximum": 8, "minimum": 2}, + "server_count_per_rack": {"required": True, "maximum": 16, "minimum": 1}, + "router_id": {"readonly": True}, + "fabric_asn": {"required": True, "maximum": 65535, "minimum": 1}, + "network_fabric_controller_id": {"required": True}, + "terminal_server_configuration": {"required": True}, + "management_network_configuration": {"required": True}, + "operational_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "racks": {"key": "racks", "type": "[str]"}, + "l2_isolation_domains": {"key": "l2IsolationDomains", "type": "[str]"}, + "l3_isolation_domains": {"key": "l3IsolationDomains", "type": "[str]"}, + "annotation": {"key": "annotation", "type": "str"}, + "network_fabric_sku": {"key": "networkFabricSku", "type": "str"}, + "rack_count": {"key": "rackCount", "type": "int"}, + "server_count_per_rack": {"key": "serverCountPerRack", "type": "int"}, + "ipv4_prefix": {"key": "ipv4Prefix", "type": "str"}, + "ipv6_prefix": {"key": "ipv6Prefix", "type": "str"}, + "router_id": {"key": "routerId", "type": "str"}, + "fabric_asn": {"key": "fabricASN", "type": "int"}, + "network_fabric_controller_id": {"key": "networkFabricControllerId", "type": "str"}, + "terminal_server_configuration": { + "key": "terminalServerConfiguration", + "type": "NetworkFabricPropertiesTerminalServerConfiguration", + }, + "management_network_configuration": { + "key": "managementNetworkConfiguration", + "type": "NetworkFabricPropertiesManagementNetworkConfiguration", + }, + "operational_state": {"key": "operationalState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + network_fabric_sku: str, + rack_count: int, + server_count_per_rack: int, + fabric_asn: int, + network_fabric_controller_id: str, + terminal_server_configuration: "_models.NetworkFabricPropertiesTerminalServerConfiguration", + management_network_configuration: "_models.NetworkFabricPropertiesManagementNetworkConfiguration", + annotation: Optional[str] = None, + ipv4_prefix: Optional[str] = None, + ipv6_prefix: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_fabric_sku: Supported Network Fabric SKU.Example: Compute / Aggregate racks. + Once the user chooses a particular SKU, only supported racks can be added to the Network + Fabric. The SKU determines whether it is a single / multi rack Network Fabric. Required. + :paramtype network_fabric_sku: str + :keyword rack_count: Number of racks associated to Network Fabric.Possible values are from 2-8. + Required. + :paramtype rack_count: int + :keyword server_count_per_rack: Number of servers.Possible values are from 1-16. Required. + :paramtype server_count_per_rack: int + :keyword ipv4_prefix: IPv4Prefix for Management Network. Example: 10.1.0.0/19. + :paramtype ipv4_prefix: str + :keyword ipv6_prefix: IPv6Prefix for Management Network. Example: 3FFE:FFFF:0:CD40::/59. + :paramtype ipv6_prefix: str + :keyword fabric_asn: ASN of CE devices for CE/PE connectivity. Required. + :paramtype fabric_asn: int + :keyword network_fabric_controller_id: Azure resource ID for the NetworkFabricController the + NetworkFabric belongs. Required. + :paramtype network_fabric_controller_id: str + :keyword terminal_server_configuration: Network and credentials configuration currently applied + to terminal server. Required. + :paramtype terminal_server_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesTerminalServerConfiguration + :keyword management_network_configuration: Configuration to be used to setup the management + network. Required. + :paramtype management_network_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfiguration + """ + super().__init__(annotation=annotation, **kwargs) + self.racks = None + self.l2_isolation_domains = None + self.l3_isolation_domains = None + self.network_fabric_sku = network_fabric_sku + self.rack_count = rack_count + self.server_count_per_rack = server_count_per_rack + self.ipv4_prefix = ipv4_prefix + self.ipv6_prefix = ipv6_prefix + self.router_id = None + self.fabric_asn = fabric_asn + self.network_fabric_controller_id = network_fabric_controller_id + self.terminal_server_configuration = terminal_server_configuration + self.management_network_configuration = management_network_configuration + self.operational_state = None + self.provisioning_state = None + self.annotation = annotation + + +class NetworkFabricPropertiesManagementNetworkConfiguration(_serialization.Model): + """Configuration to be used to setup the management network. + + All required parameters must be populated in order to send to Azure. + + :ivar infrastructure_vpn_configuration: Configuration for infrastructure vpn. Required. + :vartype infrastructure_vpn_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration + :ivar workload_vpn_configuration: Configuration for workload vpn. Required. + :vartype workload_vpn_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration + """ + + _validation = { + "infrastructure_vpn_configuration": {"required": True}, + "workload_vpn_configuration": {"required": True}, + } + + _attribute_map = { + "infrastructure_vpn_configuration": { + "key": "infrastructureVpnConfiguration", + "type": "NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration", + }, + "workload_vpn_configuration": { + "key": "workloadVpnConfiguration", + "type": "NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration", + }, + } + + def __init__( + self, + *, + infrastructure_vpn_configuration: "_models.NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration", + workload_vpn_configuration: "_models.NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration", + **kwargs: Any + ) -> None: + """ + :keyword infrastructure_vpn_configuration: Configuration for infrastructure vpn. Required. + :paramtype infrastructure_vpn_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration + :keyword workload_vpn_configuration: Configuration for workload vpn. Required. + :paramtype workload_vpn_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration + """ + super().__init__(**kwargs) + self.infrastructure_vpn_configuration = infrastructure_vpn_configuration + self.workload_vpn_configuration = workload_vpn_configuration + + +class NetworkFabricPropertiesManagementNetworkConfigurationInfrastructureVpnConfiguration(_serialization.Model): + """Configuration for infrastructure vpn. + + 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 administrative_state: Indicates configuration state. Example: Enabled | Disabled. Known + values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar network_to_network_interconnect_id: Gets the networkToNetworkInterconnectId of the + resource. + :vartype network_to_network_interconnect_id: str + :ivar peering_option: Peering option list. Required. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar option_b_properties: option B properties. + :vartype option_b_properties: + ~azure.mgmt.managednetworkfabric.models.OptionBPropertiesAutoGenerated + :ivar option_a_properties: option A properties. + :vartype option_a_properties: ~azure.mgmt.managednetworkfabric.models.OptionAProperties + """ + + _validation = { + "administrative_state": {"readonly": True}, + "network_to_network_interconnect_id": {"readonly": True}, + "peering_option": {"required": True}, + } + + _attribute_map = { + "administrative_state": {"key": "administrativeState", "type": "str"}, + "network_to_network_interconnect_id": {"key": "networkToNetworkInterconnectId", "type": "str"}, + "peering_option": {"key": "peeringOption", "type": "str"}, + "option_b_properties": {"key": "optionBProperties", "type": "OptionBPropertiesAutoGenerated"}, + "option_a_properties": {"key": "optionAProperties", "type": "OptionAProperties"}, + } + + def __init__( + self, + *, + peering_option: Union[str, "_models.PeeringOption"], + option_b_properties: Optional["_models.OptionBPropertiesAutoGenerated"] = None, + option_a_properties: Optional["_models.OptionAProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword peering_option: Peering option list. Required. Known values are: "OptionA" and + "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_b_properties: option B properties. + :paramtype option_b_properties: + ~azure.mgmt.managednetworkfabric.models.OptionBPropertiesAutoGenerated + :keyword option_a_properties: option A properties. + :paramtype option_a_properties: ~azure.mgmt.managednetworkfabric.models.OptionAProperties + """ + super().__init__(**kwargs) + self.administrative_state = None + self.network_to_network_interconnect_id = None + self.peering_option = peering_option + self.option_b_properties = option_b_properties + self.option_a_properties = option_a_properties + + +class NetworkFabricPropertiesManagementNetworkConfigurationWorkloadVpnConfiguration(_serialization.Model): + """Configuration for workload vpn. + + 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 administrative_state: Indicates configuration state. Example: enabled | disabled. Known + values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar peering_option: Peering option list. Required. Known values are: "OptionA" and "OptionB". + :vartype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :ivar network_to_network_interconnect_id: Gets the networkToNetworkInterconnectId of the + resource. + :vartype network_to_network_interconnect_id: str + :ivar option_a_properties: option A properties object. + :vartype option_a_properties: ~azure.mgmt.managednetworkfabric.models.OptionAProperties + :ivar option_b_properties: option B properties object. + :vartype option_b_properties: + ~azure.mgmt.managednetworkfabric.models.OptionBPropertiesAutoGenerated + """ + + _validation = { + "administrative_state": {"readonly": True}, + "peering_option": {"required": True}, + "network_to_network_interconnect_id": {"readonly": True}, + } + + _attribute_map = { + "administrative_state": {"key": "administrativeState", "type": "str"}, + "peering_option": {"key": "peeringOption", "type": "str"}, + "network_to_network_interconnect_id": {"key": "networkToNetworkInterconnectId", "type": "str"}, + "option_a_properties": {"key": "optionAProperties", "type": "OptionAProperties"}, + "option_b_properties": {"key": "optionBProperties", "type": "OptionBPropertiesAutoGenerated"}, + } + + def __init__( + self, + *, + peering_option: Union[str, "_models.PeeringOption"], + option_a_properties: Optional["_models.OptionAProperties"] = None, + option_b_properties: Optional["_models.OptionBPropertiesAutoGenerated"] = None, + **kwargs: Any + ) -> None: + """ + :keyword peering_option: Peering option list. Required. Known values are: "OptionA" and + "OptionB". + :paramtype peering_option: str or ~azure.mgmt.managednetworkfabric.models.PeeringOption + :keyword option_a_properties: option A properties object. + :paramtype option_a_properties: ~azure.mgmt.managednetworkfabric.models.OptionAProperties + :keyword option_b_properties: option B properties object. + :paramtype option_b_properties: + ~azure.mgmt.managednetworkfabric.models.OptionBPropertiesAutoGenerated + """ + super().__init__(**kwargs) + self.administrative_state = None + self.peering_option = peering_option + self.network_to_network_interconnect_id = None + self.option_a_properties = option_a_properties + self.option_b_properties = option_b_properties + + +class TerminalServerPatchableProperties(_serialization.Model): + """Network and credential configuration currently applied on terminal server. + + :ivar username: Username for the terminal server connection. + :vartype username: str + :ivar password: Password for the terminal server connection. + :vartype password: str + :ivar serial_number: Serial Number of Terminal server. + :vartype serial_number: str + """ + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + password: Optional[str] = None, + serial_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword username: Username for the terminal server connection. + :paramtype username: str + :keyword password: Password for the terminal server connection. + :paramtype password: str + :keyword serial_number: Serial Number of Terminal server. + :paramtype serial_number: str + """ + super().__init__(**kwargs) + self.username = username + self.password = password + self.serial_number = serial_number + + +class NetworkFabricPropertiesTerminalServerConfiguration(Layer3IpPrefixProperties, TerminalServerPatchableProperties): + """Network and credentials configuration currently applied to terminal server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar username: Username for the terminal server connection. + :vartype username: str + :ivar password: Password for the terminal server connection. + :vartype password: str + :ivar serial_number: Serial Number of Terminal server. + :vartype serial_number: str + :ivar primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv4_prefix: str + :ivar primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv6_prefix: str + :ivar secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv4_prefix: str + :ivar secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv6_prefix: str + :ivar network_device_id: ARM Resource ID used for the NetworkDevice. + :vartype network_device_id: str + """ + + _validation = { + "network_device_id": {"readonly": True}, + } + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "primary_ipv4_prefix": {"key": "primaryIpv4Prefix", "type": "str"}, + "primary_ipv6_prefix": {"key": "primaryIpv6Prefix", "type": "str"}, + "secondary_ipv4_prefix": {"key": "secondaryIpv4Prefix", "type": "str"}, + "secondary_ipv6_prefix": {"key": "secondaryIpv6Prefix", "type": "str"}, + "network_device_id": {"key": "networkDeviceId", "type": "str"}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + password: Optional[str] = None, + serial_number: Optional[str] = None, + primary_ipv4_prefix: Optional[str] = None, + primary_ipv6_prefix: Optional[str] = None, + secondary_ipv4_prefix: Optional[str] = None, + secondary_ipv6_prefix: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword username: Username for the terminal server connection. + :paramtype username: str + :keyword password: Password for the terminal server connection. + :paramtype password: str + :keyword serial_number: Serial Number of Terminal server. + :paramtype serial_number: str + :keyword primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv4_prefix: str + :keyword primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv6_prefix: str + :keyword secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv4_prefix: str + :keyword secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv6_prefix: str + """ + super().__init__( + primary_ipv4_prefix=primary_ipv4_prefix, + primary_ipv6_prefix=primary_ipv6_prefix, + secondary_ipv4_prefix=secondary_ipv4_prefix, + secondary_ipv6_prefix=secondary_ipv6_prefix, + username=username, + password=password, + serial_number=serial_number, + **kwargs + ) + self.username = username + self.password = password + self.serial_number = serial_number + self.network_device_id = None + self.primary_ipv4_prefix = primary_ipv4_prefix + self.primary_ipv6_prefix = primary_ipv6_prefix + self.secondary_ipv4_prefix = secondary_ipv4_prefix + self.secondary_ipv6_prefix = secondary_ipv6_prefix + + +class NetworkFabricSku(ProxyResource): + """The NetworkFabricSku resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar type_properties_type: Type of Network Fabric Sku. + :vartype type_properties_type: str + :ivar max_compute_racks: Maximum number of compute racks available for this Network Fabric SKU. + :vartype max_compute_racks: int + :ivar min_supported_ver: Minimum supported version. + :vartype min_supported_ver: str + :ivar max_supported_ver: Maximum supported version. + :vartype max_supported_ver: str + :ivar details_uri: The URI gives full details of sku. + :vartype details_uri: str + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "type_properties_type": {"readonly": True}, + "min_supported_ver": {"readonly": True}, + "max_supported_ver": {"readonly": True}, + "details_uri": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "max_compute_racks": {"key": "properties.maxComputeRacks", "type": "int"}, + "min_supported_ver": {"key": "properties.minSupportedVer", "type": "str"}, + "max_supported_ver": {"key": "properties.maxSupportedVer", "type": "str"}, + "details_uri": {"key": "properties.detailsUri", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, max_compute_racks: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_compute_racks: Maximum number of compute racks available for this Network Fabric + SKU. + :paramtype max_compute_racks: int + """ + super().__init__(**kwargs) + self.type_properties_type = None + self.max_compute_racks = max_compute_racks + self.min_supported_ver = None + self.max_supported_ver = None + self.details_uri = None + self.provisioning_state = None + + +class NetworkFabricSkusListResult(_serialization.Model): + """List of NetworkFabricSkus. + + :ivar value: List of NetworkFabricSku resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkFabricSku] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkFabricSku]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkFabricSku"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkFabricSku resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkFabricSku] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkFabricsListResult(_serialization.Model): + """List of NetworkFabrics. + + :ivar value: List of NetworkFabric resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkFabric]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkFabric"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkFabric resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkInterface(ProxyResource): # pylint: disable=too-many-instance-attributes + """Defines the NetworkInterface resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar physical_identifier: physicalIdentifier of the network interface. + :vartype physical_identifier: str + :ivar administrative_state: administrativeState of the network interface. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar connected_to: The arm resource id of the interface or compute server its connected to. + :vartype connected_to: str + :ivar interface_type: The Interface Type. Example: Management/Data. Known values are: + "Management" and "Data". + :vartype interface_type: str or ~azure.mgmt.managednetworkfabric.models.InterfaceType + :ivar ipv4_address: ipv4Address. + :vartype ipv4_address: str + :ivar ipv6_address: ipv6Address. + :vartype ipv6_address: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "physical_identifier": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "connected_to": {"readonly": True}, + "interface_type": {"readonly": True}, + "ipv4_address": {"readonly": True}, + "ipv6_address": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "physical_identifier": {"key": "properties.physicalIdentifier", "type": "str"}, + "administrative_state": {"key": "properties.administrativeState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "connected_to": {"key": "properties.connectedTo", "type": "str"}, + "interface_type": {"key": "properties.interfaceType", "type": "str"}, + "ipv4_address": {"key": "properties.ipv4Address", "type": "str"}, + "ipv6_address": {"key": "properties.ipv6Address", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(**kwargs) + self.annotation = annotation + self.physical_identifier = None + self.administrative_state = None + self.provisioning_state = None + self.connected_to = None + self.interface_type = None + self.ipv4_address = None + self.ipv6_address = None + + +class NetworkInterfacePatch(_serialization.Model): + """The NetworkInterfacePatch resource definition. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _attribute_map = { + "annotation": {"key": "properties.annotation", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(**kwargs) + self.annotation = annotation + + +class NetworkInterfacePatchProperties(AnnotationResource): + """Network Interface Patch properties. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + """ + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(annotation=annotation, **kwargs) + + +class NetworkInterfaceProperties(AnnotationResource): + """NetworkInterfaceProperties define the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar physical_identifier: physicalIdentifier of the network interface. + :vartype physical_identifier: str + :ivar administrative_state: administrativeState of the network interface. Example: Enabled | + Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + :ivar connected_to: The arm resource id of the interface or compute server its connected to. + :vartype connected_to: str + :ivar interface_type: The Interface Type. Example: Management/Data. Known values are: + "Management" and "Data". + :vartype interface_type: str or ~azure.mgmt.managednetworkfabric.models.InterfaceType + :ivar ipv4_address: ipv4Address. + :vartype ipv4_address: str + :ivar ipv6_address: ipv6Address. + :vartype ipv6_address: str + """ + + _validation = { + "physical_identifier": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "connected_to": {"readonly": True}, + "interface_type": {"readonly": True}, + "ipv4_address": {"readonly": True}, + "ipv6_address": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "physical_identifier": {"key": "physicalIdentifier", "type": "str"}, + "administrative_state": {"key": "administrativeState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "connected_to": {"key": "connectedTo", "type": "str"}, + "interface_type": {"key": "interfaceType", "type": "str"}, + "ipv4_address": {"key": "ipv4Address", "type": "str"}, + "ipv6_address": {"key": "ipv6Address", "type": "str"}, + } + + def __init__(self, *, annotation: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + """ + super().__init__(annotation=annotation, **kwargs) + self.physical_identifier = None + self.administrative_state = None + self.provisioning_state = None + self.connected_to = None + self.interface_type = None + self.ipv4_address = None + self.ipv6_address = None + + +class NetworkInterfacesList(_serialization.Model): + """List of NetworkInterfaces. + + :ivar value: List of NetworkInterfaces resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkInterface]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkInterface"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkInterfaces resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkRack(TrackedResource): # pylint: disable=too-many-instance-attributes + """The NetworkRack resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar network_rack_sku: Network Rack SKU name. Required. + :vartype network_rack_sku: str + :ivar network_fabric_id: Network Fabric ARM resource id. Required. + :vartype network_fabric_id: str + :ivar network_devices: List of network device ARM resource ids. + :vartype network_devices: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "network_rack_sku": {"required": True}, + "network_fabric_id": {"required": True}, + "network_devices": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "network_rack_sku": {"key": "properties.networkRackSku", "type": "str"}, + "network_fabric_id": {"key": "properties.networkFabricId", "type": "str"}, + "network_devices": {"key": "properties.networkDevices", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + network_rack_sku: str, + network_fabric_id: str, + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_rack_sku: Network Rack SKU name. Required. + :paramtype network_rack_sku: str + :keyword network_fabric_id: Network Fabric ARM resource id. Required. + :paramtype network_fabric_id: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.network_rack_sku = network_rack_sku + self.network_fabric_id = network_fabric_id + self.network_devices = None + self.provisioning_state = None + + +class NetworkRackPatch(_serialization.Model): + """The NetworkRack patch resource definition. + + :ivar properties: Resource properties. + :vartype properties: JSON + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "object"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, *, properties: Optional[JSON] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Resource properties. + :paramtype properties: JSON + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.tags = tags + + +class NetworkRackProperties(AnnotationResource): + """NetworkRackProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar network_rack_sku: Network Rack SKU name. Required. + :vartype network_rack_sku: str + :ivar network_fabric_id: Network Fabric ARM resource id. Required. + :vartype network_fabric_id: str + :ivar network_devices: List of network device ARM resource ids. + :vartype network_devices: list[str] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "network_rack_sku": {"required": True}, + "network_fabric_id": {"required": True}, + "network_devices": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "network_rack_sku": {"key": "networkRackSku", "type": "str"}, + "network_fabric_id": {"key": "networkFabricId", "type": "str"}, + "network_devices": {"key": "networkDevices", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, *, network_rack_sku: str, network_fabric_id: str, annotation: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword network_rack_sku: Network Rack SKU name. Required. + :paramtype network_rack_sku: str + :keyword network_fabric_id: Network Fabric ARM resource id. Required. + :paramtype network_fabric_id: str + """ + super().__init__(annotation=annotation, **kwargs) + self.network_rack_sku = network_rack_sku + self.network_fabric_id = network_fabric_id + self.network_devices = None + self.provisioning_state = None + + +class NetworkRackSku(ProxyResource): + """The NetworkRackSku resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar role_name: The role of the Network Rack: Aggregate or Compute. Required. Known values + are: "ComputeRack" and "AggregateRack". + :vartype role_name: str or ~azure.mgmt.managednetworkfabric.models.NetworkRackRoleName + :ivar maximum_server_count: Maximum number of servers available for this SKU. + :vartype maximum_server_count: int + :ivar maximum_storage_count: Maximum number of storage devices available for this SKU. + :vartype maximum_storage_count: int + :ivar maximum_uplinks: Maximum number of network uplinks available for this SKU. + :vartype maximum_uplinks: int + :ivar network_devices: List of network device properties / role for the Network Rack. + :vartype network_devices: + list[~azure.mgmt.managednetworkfabric.models.NetworkRackSkuPropertiesNetworkDevicesItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "role_name": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "role_name": {"key": "properties.roleName", "type": "str"}, + "maximum_server_count": {"key": "properties.maximumServerCount", "type": "int"}, + "maximum_storage_count": {"key": "properties.maximumStorageCount", "type": "int"}, + "maximum_uplinks": {"key": "properties.maximumUplinks", "type": "int"}, + "network_devices": {"key": "properties.networkDevices", "type": "[NetworkRackSkuPropertiesNetworkDevicesItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + role_name: Union[str, "_models.NetworkRackRoleName"], + maximum_server_count: Optional[int] = None, + maximum_storage_count: Optional[int] = None, + maximum_uplinks: Optional[int] = None, + network_devices: Optional[List["_models.NetworkRackSkuPropertiesNetworkDevicesItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword role_name: The role of the Network Rack: Aggregate or Compute. Required. Known values + are: "ComputeRack" and "AggregateRack". + :paramtype role_name: str or ~azure.mgmt.managednetworkfabric.models.NetworkRackRoleName + :keyword maximum_server_count: Maximum number of servers available for this SKU. + :paramtype maximum_server_count: int + :keyword maximum_storage_count: Maximum number of storage devices available for this SKU. + :paramtype maximum_storage_count: int + :keyword maximum_uplinks: Maximum number of network uplinks available for this SKU. + :paramtype maximum_uplinks: int + :keyword network_devices: List of network device properties / role for the Network Rack. + :paramtype network_devices: + list[~azure.mgmt.managednetworkfabric.models.NetworkRackSkuPropertiesNetworkDevicesItem] + """ + super().__init__(**kwargs) + self.role_name = role_name + self.maximum_server_count = maximum_server_count + self.maximum_storage_count = maximum_storage_count + self.maximum_uplinks = maximum_uplinks + self.network_devices = network_devices + self.provisioning_state = None + + +class NetworkRackSkuPropertiesNetworkDevicesItem(_serialization.Model): + """Network device properties / role for the Network Rack. + + :ivar network_device_sku_name: Name of the associated Network Device SKU. + :vartype network_device_sku_name: str + :ivar role_type: Role for the network device. Known values are: "CE", "ToR", "NPB", "TS", and + "Management". + :vartype role_type: str or ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRackRoleType + :ivar rack_slot: Rack slot for the network device. + :vartype rack_slot: int + """ + + _attribute_map = { + "network_device_sku_name": {"key": "networkDeviceSkuName", "type": "str"}, + "role_type": {"key": "roleType", "type": "str"}, + "rack_slot": {"key": "rackSlot", "type": "int"}, + } + + def __init__( + self, + *, + network_device_sku_name: Optional[str] = None, + role_type: Optional[Union[str, "_models.NetworkDeviceRackRoleType"]] = None, + rack_slot: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_device_sku_name: Name of the associated Network Device SKU. + :paramtype network_device_sku_name: str + :keyword role_type: Role for the network device. Known values are: "CE", "ToR", "NPB", "TS", + and "Management". + :paramtype role_type: str or ~azure.mgmt.managednetworkfabric.models.NetworkDeviceRackRoleType + :keyword rack_slot: Rack slot for the network device. + :paramtype rack_slot: int + """ + super().__init__(**kwargs) + self.network_device_sku_name = network_device_sku_name + self.role_type = role_type + self.rack_slot = rack_slot + + +class NetworkRackSkusListResult(_serialization.Model): + """List of NetworkRackSkus. + + :ivar value: List of NetworkRackSku resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkRackSku] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkRackSku]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkRackSku"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkRackSku resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkRackSku] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkRacksListResult(_serialization.Model): + """List of NetworkRacks. + + :ivar value: List of NetworkRack resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkRack]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkRack"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkRack resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkToNetworkInterconnect(ProxyResource): # pylint: disable=too-many-instance-attributes + """The NetworkToNetworkInterconnect resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar nni_type: Type of NNI used. Example: CE | NPB. Known values are: "CE" and "NPB". + :vartype nni_type: str or ~azure.mgmt.managednetworkfabric.models.NniType + :ivar administrative_state: Gets the administrativeState of the resource. Example + -Enabled/Disabled. Known values are: "Enabled" and "Disabled". + :vartype administrative_state: str or + ~azure.mgmt.managednetworkfabric.models.EnabledDisabledState + :ivar is_management_type: Configuration to use NNI for Infrastructure Management. Example: + True/False. Known values are: "True" and "False". + :vartype is_management_type: str or ~azure.mgmt.managednetworkfabric.models.BooleanEnumProperty + :ivar use_option_b: Based on this parameter the layer2/layer3 is made as mandatory. Example: + True/False. Known values are: "True" and "False". + :vartype use_option_b: str or ~azure.mgmt.managednetworkfabric.models.BooleanEnumProperty + :ivar layer2_configuration: Common properties for Layer2Configuration. + :vartype layer2_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnectPropertiesLayer2Configuration + :ivar layer3_configuration: Common properties for Layer3Configuration. + :vartype layer3_configuration: ~azure.mgmt.managednetworkfabric.models.Layer3Configuration + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "administrative_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "nni_type": {"key": "properties.nniType", "type": "str"}, + "administrative_state": {"key": "properties.administrativeState", "type": "str"}, + "is_management_type": {"key": "properties.isManagementType", "type": "str"}, + "use_option_b": {"key": "properties.useOptionB", "type": "str"}, + "layer2_configuration": { + "key": "properties.layer2Configuration", + "type": "NetworkToNetworkInterconnectPropertiesLayer2Configuration", + }, + "layer3_configuration": {"key": "properties.layer3Configuration", "type": "Layer3Configuration"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + nni_type: Union[str, "_models.NniType"] = "CE", + is_management_type: Optional[Union[str, "_models.BooleanEnumProperty"]] = None, + use_option_b: Optional[Union[str, "_models.BooleanEnumProperty"]] = None, + layer2_configuration: Optional["_models.NetworkToNetworkInterconnectPropertiesLayer2Configuration"] = None, + layer3_configuration: Optional["_models.Layer3Configuration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword nni_type: Type of NNI used. Example: CE | NPB. Known values are: "CE" and "NPB". + :paramtype nni_type: str or ~azure.mgmt.managednetworkfabric.models.NniType + :keyword is_management_type: Configuration to use NNI for Infrastructure Management. Example: + True/False. Known values are: "True" and "False". + :paramtype is_management_type: str or + ~azure.mgmt.managednetworkfabric.models.BooleanEnumProperty + :keyword use_option_b: Based on this parameter the layer2/layer3 is made as mandatory. Example: + True/False. Known values are: "True" and "False". + :paramtype use_option_b: str or ~azure.mgmt.managednetworkfabric.models.BooleanEnumProperty + :keyword layer2_configuration: Common properties for Layer2Configuration. + :paramtype layer2_configuration: + ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnectPropertiesLayer2Configuration + :keyword layer3_configuration: Common properties for Layer3Configuration. + :paramtype layer3_configuration: ~azure.mgmt.managednetworkfabric.models.Layer3Configuration + """ + super().__init__(**kwargs) + self.nni_type = nni_type + self.administrative_state = None + self.is_management_type = is_management_type + self.use_option_b = use_option_b + self.layer2_configuration = layer2_configuration + self.layer3_configuration = layer3_configuration + self.provisioning_state = None + + +class NetworkToNetworkInterconnectPropertiesLayer2Configuration(Layer2Configuration): + """Common properties for Layer2Configuration. + + 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 port_count: Number of ports connected between PE/CE. Maximum value depends on FabricSKU. + :vartype port_count: int + :ivar mtu: MTU of the packets between PE & CE. + :vartype mtu: int + :ivar interfaces: List of network device interfaces resource IDs. + :vartype interfaces: list[str] + """ + + _validation = { + "mtu": {"required": True, "maximum": 9000, "minimum": 1500}, + "interfaces": {"readonly": True}, + } + + _attribute_map = { + "port_count": {"key": "portCount", "type": "int"}, + "mtu": {"key": "mtu", "type": "int"}, + "interfaces": {"key": "interfaces", "type": "[str]"}, + } + + def __init__(self, *, mtu: int = 1500, port_count: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword port_count: Number of ports connected between PE/CE. Maximum value depends on + FabricSKU. + :paramtype port_count: int + :keyword mtu: MTU of the packets between PE & CE. + :paramtype mtu: int + """ + super().__init__(port_count=port_count, mtu=mtu, **kwargs) + + +class NetworkToNetworkInterconnectsList(_serialization.Model): + """List of NetworkToNetworkInterconnects. + + :ivar value: List of NetworkToNetworkInterconnects resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkToNetworkInterconnect]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkToNetworkInterconnect"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of NetworkToNetworkInterconnects resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.managednetworkfabric.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.managednetworkfabric.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.managednetworkfabric.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + } + + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.managednetworkfabric.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OptionAProperties(Layer3IpPrefixProperties): + """Peering optionA properties. + + :ivar primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv4_prefix: str + :ivar primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype primary_ipv6_prefix: str + :ivar secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv4_prefix: str + :ivar secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :vartype secondary_ipv6_prefix: str + :ivar mtu: MTU to use for option A peering. + :vartype mtu: int + :ivar vlan_id: Vlan identifier. Example : 501. + :vartype vlan_id: int + :ivar peer_asn: Peer ASN number.Example : 28. + :vartype peer_asn: int + :ivar bfd_configuration: BFD Configuration properties. + :vartype bfd_configuration: + ~azure.mgmt.managednetworkfabric.models.OptionAPropertiesBfdConfiguration + """ + + _validation = { + "mtu": {"maximum": 9000, "minimum": 1500}, + "vlan_id": {"maximum": 4095, "minimum": 501}, + "peer_asn": {"maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "primary_ipv4_prefix": {"key": "primaryIpv4Prefix", "type": "str"}, + "primary_ipv6_prefix": {"key": "primaryIpv6Prefix", "type": "str"}, + "secondary_ipv4_prefix": {"key": "secondaryIpv4Prefix", "type": "str"}, + "secondary_ipv6_prefix": {"key": "secondaryIpv6Prefix", "type": "str"}, + "mtu": {"key": "mtu", "type": "int"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + "peer_asn": {"key": "peerASN", "type": "int"}, + "bfd_configuration": {"key": "bfdConfiguration", "type": "OptionAPropertiesBfdConfiguration"}, + } + + def __init__( + self, + *, + primary_ipv4_prefix: Optional[str] = None, + primary_ipv6_prefix: Optional[str] = None, + secondary_ipv4_prefix: Optional[str] = None, + secondary_ipv6_prefix: Optional[str] = None, + mtu: int = 1500, + vlan_id: Optional[int] = None, + peer_asn: Optional[int] = None, + bfd_configuration: Optional["_models.OptionAPropertiesBfdConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_ipv4_prefix: IPv4 Address Prefix of CE-PE interconnect links. Example: + 172.31.0.0/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv4_prefix: str + :keyword primary_ipv6_prefix: IPv6 Address Prefix of CE-PE interconnect links. Example: + 3FFE:FFFF:0:CD30::a0/126. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype primary_ipv6_prefix: str + :keyword secondary_ipv4_prefix: Secondary IPv4 Address Prefix of CE-PE interconnect links. + Example: 172.31.0.20/31. The values can be specified at the time of creation or can be updated + afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st and 3rd IPs + are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs are to be + configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv4_prefix: str + :keyword secondary_ipv6_prefix: Secondary IPv6 Address Prefix of CE-PE interconnect links. + Example: 3FFE:FFFF:0:CD30::a4/126. The values can be specified at the time of creation or can + be updated afterwards. Any update to the values post-provisioning may disrupt traffic. The 1st + and 3rd IPs are to be configured on CE1 and CE2 for Option B interfaces. The 2nd and 4th IPs + are to be configured on PE1 and PE2 for Option B interfaces. + :paramtype secondary_ipv6_prefix: str + :keyword mtu: MTU to use for option A peering. + :paramtype mtu: int + :keyword vlan_id: Vlan identifier. Example : 501. + :paramtype vlan_id: int + :keyword peer_asn: Peer ASN number.Example : 28. + :paramtype peer_asn: int + :keyword bfd_configuration: BFD Configuration properties. + :paramtype bfd_configuration: + ~azure.mgmt.managednetworkfabric.models.OptionAPropertiesBfdConfiguration + """ + super().__init__( + primary_ipv4_prefix=primary_ipv4_prefix, + primary_ipv6_prefix=primary_ipv6_prefix, + secondary_ipv4_prefix=secondary_ipv4_prefix, + secondary_ipv6_prefix=secondary_ipv6_prefix, + **kwargs + ) + self.mtu = mtu + self.vlan_id = vlan_id + self.peer_asn = peer_asn + self.bfd_configuration = bfd_configuration + + +class OptionAPropertiesBfdConfiguration(_serialization.Model): + """BFD Configuration properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar interval: interval in seconds. Example: 300. + :vartype interval: int + :ivar multiplier: multiplier. Example: 3. + :vartype multiplier: int + """ + + _validation = { + "interval": {"readonly": True}, + "multiplier": {"readonly": True}, + } + + _attribute_map = { + "interval": {"key": "interval", "type": "int"}, + "multiplier": {"key": "multiplier", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.interval = None + self.multiplier = None + + +class OptionBProperties(_serialization.Model): + """Option B configuration. + + :ivar import_route_targets: Route Targets to be applied for incoming routes into CE. + :vartype import_route_targets: list[str] + :ivar export_route_targets: Route Targets to be applied for outgoing routes from CE. + :vartype export_route_targets: list[str] + """ + + _attribute_map = { + "import_route_targets": {"key": "importRouteTargets", "type": "[str]"}, + "export_route_targets": {"key": "exportRouteTargets", "type": "[str]"}, + } + + def __init__( + self, + *, + import_route_targets: Optional[List[str]] = None, + export_route_targets: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword import_route_targets: Route Targets to be applied for incoming routes into CE. + :paramtype import_route_targets: list[str] + :keyword export_route_targets: Route Targets to be applied for outgoing routes from CE. + :paramtype export_route_targets: list[str] + """ + super().__init__(**kwargs) + self.import_route_targets = import_route_targets + self.export_route_targets = export_route_targets + + +class OptionBPropertiesAutoGenerated(_serialization.Model): + """Option B configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar import_route_targets: Route Targets to be applied for incoming routes into CE. Required. + :vartype import_route_targets: list[str] + :ivar export_route_targets: Route Targets to be applied for outgoing routes from CE. Required. + :vartype export_route_targets: list[str] + """ + + _validation = { + "import_route_targets": {"required": True}, + "export_route_targets": {"required": True}, + } + + _attribute_map = { + "import_route_targets": {"key": "importRouteTargets", "type": "[str]"}, + "export_route_targets": {"key": "exportRouteTargets", "type": "[str]"}, + } + + def __init__(self, *, import_route_targets: List[str], export_route_targets: List[str], **kwargs: Any) -> None: + """ + :keyword import_route_targets: Route Targets to be applied for incoming routes into CE. + Required. + :paramtype import_route_targets: list[str] + :keyword export_route_targets: Route Targets to be applied for outgoing routes from CE. + Required. + :paramtype export_route_targets: list[str] + """ + super().__init__(**kwargs) + self.import_route_targets = import_route_targets + self.export_route_targets = export_route_targets + + +class RoutePoliciesListResult(_serialization.Model): + """List of RoutePolicies. + + :ivar value: List of RoutePolicy resources. + :vartype value: list[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RoutePolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.RoutePolicy"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of RoutePolicy resources. + :paramtype value: list[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :keyword next_link: Url to follow for getting next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RoutePolicy(TrackedResource): + """The RoutePolicy resource definition. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.managednetworkfabric.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar statements: Route Policy statements. Required. + :vartype statements: + list[~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "statements": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "annotation": {"key": "properties.annotation", "type": "str"}, + "statements": {"key": "properties.statements", "type": "[RoutePolicyPropertiesStatementsItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + statements: List["_models.RoutePolicyPropertiesStatementsItem"], + tags: Optional[Dict[str, str]] = None, + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword statements: Route Policy statements. Required. + :paramtype statements: + list[~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItem] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.annotation = annotation + self.statements = statements + self.provisioning_state = None + + +class RoutePolicyPatch(_serialization.Model): + """The RoutePolicy patch resource definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class RoutePolicyProperties(AnnotationResource): + """RoutePolicyProperties define the resource properties. + + 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 annotation: Switch configuration description. + :vartype annotation: str + :ivar statements: Route Policy statements. Required. + :vartype statements: + list[~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItem] + :ivar provisioning_state: Gets the provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Canceled", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.managednetworkfabric.models.ProvisioningState + """ + + _validation = { + "statements": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "statements": {"key": "statements", "type": "[RoutePolicyPropertiesStatementsItem]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + statements: List["_models.RoutePolicyPropertiesStatementsItem"], + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword statements: Route Policy statements. Required. + :paramtype statements: + list[~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItem] + """ + super().__init__(annotation=annotation, **kwargs) + self.statements = statements + self.provisioning_state = None + + +class RoutePolicyPropertiesStatementsItem(AnnotationResource): + """Route Policy condition model. + + All required parameters must be populated in order to send to Azure. + + :ivar annotation: Switch configuration description. + :vartype annotation: str + :ivar sequence_number: Sequence to insert to/delete from existing route. Required. + :vartype sequence_number: int + :ivar condition: Route policy condition properties. Required. + :vartype condition: + ~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItemCondition + :ivar action: Route policy action properties. Required. + :vartype action: + ~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItemAction + """ + + _validation = { + "sequence_number": {"required": True, "maximum": 4294967295, "minimum": 1}, + "condition": {"required": True}, + "action": {"required": True}, + } + + _attribute_map = { + "annotation": {"key": "annotation", "type": "str"}, + "sequence_number": {"key": "sequenceNumber", "type": "int"}, + "condition": {"key": "condition", "type": "RoutePolicyPropertiesStatementsItemCondition"}, + "action": {"key": "action", "type": "RoutePolicyPropertiesStatementsItemAction"}, + } + + def __init__( + self, + *, + sequence_number: int, + condition: "_models.RoutePolicyPropertiesStatementsItemCondition", + action: "_models.RoutePolicyPropertiesStatementsItemAction", + annotation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword annotation: Switch configuration description. + :paramtype annotation: str + :keyword sequence_number: Sequence to insert to/delete from existing route. Required. + :paramtype sequence_number: int + :keyword condition: Route policy condition properties. Required. + :paramtype condition: + ~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItemCondition + :keyword action: Route policy action properties. Required. + :paramtype action: + ~azure.mgmt.managednetworkfabric.models.RoutePolicyPropertiesStatementsItemAction + """ + super().__init__(annotation=annotation, **kwargs) + self.sequence_number = sequence_number + self.condition = condition + self.action = action + + +class RoutePolicyPropertiesStatementsItemAction(_serialization.Model): + """Route policy action properties. + + All required parameters must be populated in order to send to Azure. + + :ivar local_preference: localPreference of the route policy. + :vartype local_preference: int + :ivar action_type: action. Example: Permit | Deny. Required. Known values are: "Permit" and + "Deny". + :vartype action_type: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :ivar ip_community_properties: ipCommunity Properties. + :vartype ip_community_properties: + ~azure.mgmt.managednetworkfabric.models.ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties + :ivar ip_extended_community_properties: IP Extended Community Properties. + :vartype ip_extended_community_properties: + ~azure.mgmt.managednetworkfabric.models.Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties + """ + + _validation = { + "local_preference": {"maximum": 4294967295, "minimum": 0}, + "action_type": {"required": True}, + } + + _attribute_map = { + "local_preference": {"key": "localPreference", "type": "int"}, + "action_type": {"key": "actionType", "type": "str"}, + "ip_community_properties": { + "key": "ipCommunityProperties", + "type": "ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties", + }, + "ip_extended_community_properties": { + "key": "ipExtendedCommunityProperties", + "type": "Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties", + }, + } + + def __init__( + self, + *, + action_type: Union[str, "_models.CommunityActionTypes"], + local_preference: Optional[int] = None, + ip_community_properties: Optional[ + "_models.ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties" + ] = None, + ip_extended_community_properties: Optional[ + "_models.Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword local_preference: localPreference of the route policy. + :paramtype local_preference: int + :keyword action_type: action. Example: Permit | Deny. Required. Known values are: "Permit" and + "Deny". + :paramtype action_type: str or ~azure.mgmt.managednetworkfabric.models.CommunityActionTypes + :keyword ip_community_properties: ipCommunity Properties. + :paramtype ip_community_properties: + ~azure.mgmt.managednetworkfabric.models.ComponentsUm13JfSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpcommunityproperties + :keyword ip_extended_community_properties: IP Extended Community Properties. + :paramtype ip_extended_community_properties: + ~azure.mgmt.managednetworkfabric.models.Components1Kfv65GSchemasRoutepolicypropertiesPropertiesStatementsItemsPropertiesActionPropertiesIpextendedcommunityproperties + """ + super().__init__(**kwargs) + self.local_preference = local_preference + self.action_type = action_type + self.ip_community_properties = ip_community_properties + self.ip_extended_community_properties = ip_extended_community_properties + + +class RoutePolicyPropertiesStatementsItemCondition(_serialization.Model): + """Route policy condition properties. + + :ivar ip_community_ids: List of IPCommunity resource IDs. + :vartype ip_community_ids: list[str] + :ivar ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :vartype ip_extended_community_ids: list[str] + :ivar ip_prefix_id: Arm Resource Id of IpPrefix. + :vartype ip_prefix_id: str + """ + + _attribute_map = { + "ip_community_ids": {"key": "ipCommunityIds", "type": "[str]"}, + "ip_extended_community_ids": {"key": "ipExtendedCommunityIds", "type": "[str]"}, + "ip_prefix_id": {"key": "ipPrefixId", "type": "str"}, + } + + def __init__( + self, + *, + ip_community_ids: Optional[List[str]] = None, + ip_extended_community_ids: Optional[List[str]] = None, + ip_prefix_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword ip_community_ids: List of IPCommunity resource IDs. + :paramtype ip_community_ids: list[str] + :keyword ip_extended_community_ids: List of IPExtendedCommunity resource IDs. + :paramtype ip_extended_community_ids: list[str] + :keyword ip_prefix_id: Arm Resource Id of IpPrefix. + :paramtype ip_prefix_id: str + """ + super().__init__(**kwargs) + self.ip_community_ids = ip_community_ids + self.ip_extended_community_ids = ip_extended_community_ids + self.ip_prefix_id = ip_prefix_id + + +class RoutePolicyPropertiesStatementsProperties(_serialization.Model): + """Route policy add manipulations. + + :ivar ip_community_ids: List of IPCommunity resource IDs. + :vartype ip_community_ids: list[str] + """ + + _attribute_map = { + "ip_community_ids": {"key": "ipCommunityIds", "type": "[str]"}, + } + + def __init__(self, *, ip_community_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_community_ids: List of IPCommunity resource IDs. + :paramtype ip_community_ids: list[str] + """ + super().__init__(**kwargs) + self.ip_community_ids = ip_community_ids + + +class SupportPackageProperties(_serialization.Model): + """Generate support package post action properties. + + All required parameters must be populated in order to send to Azure. + + :ivar support_package_url: The URL to fetch the generated support package from. Required. + :vartype support_package_url: str + """ + + _validation = { + "support_package_url": {"required": True}, + } + + _attribute_map = { + "support_package_url": {"key": "supportPackageURL", "type": "str"}, + } + + def __init__(self, *, support_package_url: str, **kwargs: Any) -> None: + """ + :keyword support_package_url: The URL to fetch the generated support package from. Required. + :paramtype support_package_url: str + """ + super().__init__(**kwargs) + self.support_package_url = support_package_url + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.managednetworkfabric.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.managednetworkfabric.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.managednetworkfabric.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.managednetworkfabric.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__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 TerminalServerPatchParametersTerminalServerConfiguration(TerminalServerPatchableProperties): + """Network and credentials configuration already applied to terminal server. + + :ivar username: Username for the terminal server connection. + :vartype username: str + :ivar password: Password for the terminal server connection. + :vartype password: str + :ivar serial_number: Serial Number of Terminal server. + :vartype serial_number: str + """ + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + password: Optional[str] = None, + serial_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword username: Username for the terminal server connection. + :paramtype username: str + :keyword password: Password for the terminal server connection. + :paramtype password: str + :keyword serial_number: Serial Number of Terminal server. + :paramtype serial_number: str + """ + super().__init__(username=username, password=password, serial_number=serial_number, **kwargs) + + +class UpdateAdministrativeState(EnableDisableOnResources): + """Update administrative state on list of resources. + + :ivar resource_ids: Network Fabrics or Network Rack resource Id. + :vartype resource_ids: list[str] + :ivar state: Administrative state. Known values are: "Enable" and "Disable". + :vartype state: str or ~azure.mgmt.managednetworkfabric.models.AdministrativeState + """ + + _attribute_map = { + "resource_ids": {"key": "resourceIds", "type": "[str]"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, + *, + resource_ids: Optional[List[str]] = None, + state: Optional[Union[str, "_models.AdministrativeState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_ids: Network Fabrics or Network Rack resource Id. + :paramtype resource_ids: list[str] + :keyword state: Administrative state. Known values are: "Enable" and "Disable". + :paramtype state: str or ~azure.mgmt.managednetworkfabric.models.AdministrativeState + """ + super().__init__(resource_ids=resource_ids, **kwargs) + self.state = state + + +class UpdatePowerCycleProperties(_serialization.Model): + """Update power cycle input properties. + + All required parameters must be populated in order to send to Azure. + + :ivar power_end: Primary or Secondary power end. Required. Known values are: "Primary" and + "Secondary". + :vartype power_end: str or ~azure.mgmt.managednetworkfabric.models.PowerEnd + :ivar state: On or Off toggle state. Required. Known values are: "On" and "Off". + :vartype state: str or ~azure.mgmt.managednetworkfabric.models.State + """ + + _validation = { + "power_end": {"required": True}, + "state": {"required": True}, + } + + _attribute_map = { + "power_end": {"key": "powerEnd", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, *, power_end: Union[str, "_models.PowerEnd"], state: Union[str, "_models.State"], **kwargs: Any + ) -> None: + """ + :keyword power_end: Primary or Secondary power end. Required. Known values are: "Primary" and + "Secondary". + :paramtype power_end: str or ~azure.mgmt.managednetworkfabric.models.PowerEnd + :keyword state: On or Off toggle state. Required. Known values are: "On" and "Off". + :paramtype state: str or ~azure.mgmt.managednetworkfabric.models.State + """ + super().__init__(**kwargs) + self.power_end = power_end + self.state = state + + +class UpdateVersionProperties(_serialization.Model): + """Generate support package post action properties. + + All required parameters must be populated in order to send to Azure. + + :ivar sku_version: The supported version defined in network device SKU. Required. + :vartype sku_version: str + """ + + _validation = { + "sku_version": {"required": True}, + } + + _attribute_map = { + "sku_version": {"key": "skuVersion", "type": "str"}, + } + + def __init__(self, *, sku_version: str, **kwargs: Any) -> None: + """ + :keyword sku_version: The supported version defined in network device SKU. Required. + :paramtype sku_version: str + """ + super().__init__(**kwargs) + self.sku_version = sku_version diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_patch.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/__init__.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/__init__.py new file mode 100644 index 000000000000..b9434cdbf195 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/__init__.py @@ -0,0 +1,55 @@ +# 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 ._access_control_lists_operations import AccessControlListsOperations +from ._ip_communities_operations import IpCommunitiesOperations +from ._ip_extended_communities_operations import IpExtendedCommunitiesOperations +from ._ip_prefixes_operations import IpPrefixesOperations +from ._l2_isolation_domains_operations import L2IsolationDomainsOperations +from ._l3_isolation_domains_operations import L3IsolationDomainsOperations +from ._internal_networks_operations import InternalNetworksOperations +from ._external_networks_operations import ExternalNetworksOperations +from ._network_device_skus_operations import NetworkDeviceSkusOperations +from ._network_devices_operations import NetworkDevicesOperations +from ._network_interfaces_operations import NetworkInterfacesOperations +from ._network_fabric_controllers_operations import NetworkFabricControllersOperations +from ._network_fabric_skus_operations import NetworkFabricSkusOperations +from ._network_fabrics_operations import NetworkFabricsOperations +from ._network_to_network_interconnects_operations import NetworkToNetworkInterconnectsOperations +from ._network_rack_skus_operations import NetworkRackSkusOperations +from ._network_racks_operations import NetworkRacksOperations +from ._operations import Operations +from ._route_policies_operations import RoutePoliciesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccessControlListsOperations", + "IpCommunitiesOperations", + "IpExtendedCommunitiesOperations", + "IpPrefixesOperations", + "L2IsolationDomainsOperations", + "L3IsolationDomainsOperations", + "InternalNetworksOperations", + "ExternalNetworksOperations", + "NetworkDeviceSkusOperations", + "NetworkDevicesOperations", + "NetworkInterfacesOperations", + "NetworkFabricControllersOperations", + "NetworkFabricSkusOperations", + "NetworkFabricsOperations", + "NetworkToNetworkInterconnectsOperations", + "NetworkRackSkusOperations", + "NetworkRacksOperations", + "Operations", + "RoutePoliciesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_access_control_lists_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_access_control_lists_operations.py new file mode 100644 index 000000000000..d909592964a5 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_access_control_lists_operations.py @@ -0,0 +1,850 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, access_control_list_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accessControlListName": _SERIALIZER.url("access_control_list_name", access_control_list_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, access_control_list_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accessControlListName": _SERIALIZER.url("access_control_list_name", access_control_list_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, access_control_list_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accessControlListName": _SERIALIZER.url("access_control_list_name", access_control_list_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, access_control_list_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accessControlListName": _SERIALIZER.url("access_control_list_name", access_control_list_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AccessControlListsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`access_control_lists` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create( + self, + resource_group_name: str, + access_control_list_name: str, + body: _models.AccessControlList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Create Access Control List. + + Implements Access Control List PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + access_control_list_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Create Access Control List. + + Implements Access Control List PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + access_control_list_name: str, + body: Union[_models.AccessControlList, IO], + **kwargs: Any + ) -> _models.AccessControlList: + """Create Access Control List. + + Implements Access Control List PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Request payload. Is either a AccessControlList type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessControlList] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AccessControlList") + + request = build_create_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessControlList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @distributed_trace + def get(self, resource_group_name: str, access_control_list_name: str, **kwargs: Any) -> _models.AccessControlList: + """Gets a Access Control List. + + Implements Access Control List GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessControlList] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessControlList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @overload + def update( + self, + resource_group_name: str, + access_control_list_name: str, + body: _models.AccessControlListPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Updates a Access Control List. + + API to update certain properties of the Access Control List resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Access Control List properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlListPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + access_control_list_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccessControlList: + """Updates a Access Control List. + + API to update certain properties of the Access Control List resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Access Control List properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + access_control_list_name: str, + body: Union[_models.AccessControlListPatch, IO], + **kwargs: Any + ) -> _models.AccessControlList: + """Updates a Access Control List. + + API to update certain properties of the Access Control List resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_name: str + :param body: Access Control List properties to update. Is either a AccessControlListPatch type + or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.AccessControlListPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessControlList or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.AccessControlList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccessControlList] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AccessControlListPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AccessControlList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, access_control_list_name: str, **kwargs: Any + ) -> None: + """Deletes a Access Control List. + + Implements Access Control List DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param access_control_list_name: Name of the Access Control List. Required. + :type access_control_list_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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + access_control_list_name=access_control_list_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AccessControlList"]: + """List AccessControlLists by resource group. + + Implements AccessControlLists list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccessControlList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.AccessControlList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessControlListsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AccessControlListsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AccessControlList"]: + """List AccessControlLists by subscription. + + Implements AccessControlLists list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccessControlList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.AccessControlList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccessControlListsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AccessControlListsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_external_networks_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_external_networks_operations.py new file mode 100644 index 000000000000..7e9e8f6e9186 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_external_networks_operations.py @@ -0,0 +1,2413 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_bgp_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBgpAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_bfd_for_bgp_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBfdForBgpAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_ipv6_neighbors_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearIpv6Neighbors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_arp_entries_request( + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearArpEntries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "externalNetworkName": _SERIALIZER.url("external_network_name", external_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ExternalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`external_networks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetwork, IO], + **kwargs: Any + ) -> _models.ExternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ExternalNetwork") + + request = build_create_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.ExternalNetwork, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExternalNetwork]: + """Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external + services. + + Creates ExternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExternalNetwork]: + """Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external + services. + + Creates ExternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetwork, IO], + **kwargs: Any + ) -> LROPoller[_models.ExternalNetwork]: + """Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external + services. + + Creates ExternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a ExternalNetwork type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetwork or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, l3_isolation_domain_name: str, external_network_name: str, **kwargs: Any + ) -> _models.ExternalNetwork: + """Retrieves details of ExternalNetwork. + + Implements ExternalNetworks GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExternalNetwork or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.ExternalNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + def _update_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetworkPatch, IO], + **kwargs: Any + ) -> _models.ExternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ExternalNetworkPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.ExternalNetworkPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExternalNetwork]: + """Updates a ExternalNetworks. + + API to update certain properties of the ExternalNetworks resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: ExternalNetwork properties to update. Only annotations are supported. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExternalNetwork]: + """Updates a ExternalNetworks. + + API to update certain properties of the ExternalNetworks resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: ExternalNetwork properties to update. Only annotations are supported. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.ExternalNetworkPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.ExternalNetwork]: + """Updates a ExternalNetworks. + + API to update certain properties of the ExternalNetworks resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: ExternalNetwork properties to update. Only annotations are supported. Is either a + ExternalNetworkPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.ExternalNetworkPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l3_isolation_domain_name: str, external_network_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, l3_isolation_domain_name: str, external_network_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a ExternalNetworks. + + Implements ExternalNetworks DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> Iterable["_models.ExternalNetwork"]: + """Executes list operation to display External Networks within an isolation domain. + + Implements External Networks list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExternalNetwork or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.ExternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExternalNetworksList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExternalNetworksList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks" + } + + def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateAdministrativeState" + } + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Executes update operation to enable or disable administrative State for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Executes update operation to enable or disable administrative State for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Executes update operation to enable or disable administrative State for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateAdministrativeState" + } + + def _update_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBgpAdministrativeState" + } + + @overload + def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes BGP state update operation to the underlying resources. + + Update BGP for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes BGP state update operation to the underlying resources. + + Update BGP for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Executes BGP state update operation to the underlying resources. + + Update BGP for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBgpAdministrativeState" + } + + def _update_bfd_for_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bfd_for_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bfd_for_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bfd_for_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBfdForBgpAdministrativeState" + } + + @overload + def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Execute BfdForBgp update operation to the underlying resources. + + Update BfdForBgp for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Execute BfdForBgp update operation to the underlying resources. + + Update BfdForBgp for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Execute BfdForBgp update operation to the underlying resources. + + Update BfdForBgp for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_bfd_for_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bfd_for_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBfdForBgpAdministrativeState" + } + + def _clear_ipv6_neighbors_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_ipv6_neighbors_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_ipv6_neighbors_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_ipv6_neighbors_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearIpv6Neighbors" + } + + @overload + def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes clearIpv6Neighbors table operation to the underlying resources. + + clearIpv6Neighbors for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes clearIpv6Neighbors table operation to the underlying resources. + + clearIpv6Neighbors for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Executes clearIpv6Neighbors table operation to the underlying resources. + + clearIpv6Neighbors for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_ipv6_neighbors_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_ipv6_neighbors.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearIpv6Neighbors" + } + + def _clear_arp_entries_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_entries_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_entries_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_entries_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearArpEntries" + } + + @overload + def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + clearArpEntries for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + clearArpEntries for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + external_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + clearArpEntries for externalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param external_network_name: Name of the ExternalNetwork. Required. + :type external_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_arp_entries_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + external_network_name=external_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_entries.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearArpEntries" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_internal_networks_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_internal_networks_operations.py new file mode 100644 index 000000000000..b834563f0cf7 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_internal_networks_operations.py @@ -0,0 +1,2690 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_bgp_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBgpAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_bfd_for_bgp_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForBgpAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_ipv6_neighbors_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearIpv6Neighbors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_arp_entries_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearArpEntries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_bfd_for_static_route_administrative_state_request( + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForStaticRouteAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + "internalNetworkName": _SERIALIZER.url("internal_network_name", internal_network_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class InternalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`internal_networks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetwork, IO], + **kwargs: Any + ) -> _models.InternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InternalNetwork") + + request = build_create_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.InternalNetwork, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InternalNetwork]: + """Creates InternalNetwork for Layer3 Isolation Domain for communication of compute within and + across racks. + + Creates InternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InternalNetwork]: + """Creates InternalNetwork for Layer3 Isolation Domain for communication of compute within and + across racks. + + Creates InternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetwork, IO], + **kwargs: Any + ) -> LROPoller[_models.InternalNetwork]: + """Creates InternalNetwork for Layer3 Isolation Domain for communication of compute within and + across racks. + + Creates InternalNetwork PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a InternalNetwork type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetwork or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, l3_isolation_domain_name: str, internal_network_name: str, **kwargs: Any + ) -> _models.InternalNetwork: + """Retrieves details of InternalNetworks using GET method. + + Gets a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InternalNetwork or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.InternalNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + def _update_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetworkPatch, IO], + **kwargs: Any + ) -> _models.InternalNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InternalNetworkPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("InternalNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.InternalNetworkPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InternalNetwork]: + """API to update certain properties of the InternalNetworks resources. + + Updates a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: InternalNetwork properties to update. Only annotations are supported. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InternalNetwork]: + """API to update certain properties of the InternalNetworks resources. + + Updates a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: InternalNetwork properties to update. Only annotations are supported. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.InternalNetworkPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.InternalNetwork]: + """API to update certain properties of the InternalNetworks resources. + + Updates a InternalNetworks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: InternalNetwork properties to update. Only annotations are supported. Is either a + InternalNetworkPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.InternalNetworkPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InternalNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InternalNetwork] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InternalNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l3_isolation_domain_name: str, internal_network_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, l3_isolation_domain_name: str, internal_network_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a InternalNetworks. + + Implements InternalNetworks DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> Iterable["_models.InternalNetwork"]: + """Executes list operation to display list of all internal networks. + + Displays InternalNetworks list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InternalNetwork or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.InternalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InternalNetworksList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("InternalNetworksList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks" + } + + def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateAdministrativeState" + } + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes the operation to the underlying resources. + + Update Administrative state of InternalNetworks on resources referred by their resource ids. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes the operation to the underlying resources. + + Update Administrative state of InternalNetworks on resources referred by their resource ids. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Executes the operation to the underlying resources. + + Update Administrative state of InternalNetworks on resources referred by their resource ids. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateAdministrativeState" + } + + def _update_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBgpAdministrativeState" + } + + @overload + def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes the operation to the underlying resources for updating BGP state on edge devices. + + Update BGP state for internalNetwork. Allowed only on edge devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes the operation to the underlying resources for updating BGP state on edge devices. + + Update BGP state for internalNetwork. Allowed only on edge devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Executes the operation to the underlying resources for updating BGP state on edge devices. + + Update BGP state for internalNetwork. Allowed only on edge devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBgpAdministrativeState" + } + + def _update_bfd_for_bgp_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bfd_for_bgp_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bfd_for_bgp_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bfd_for_bgp_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForBgpAdministrativeState" + } + + @overload + def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Update BfdForBgp for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Update BfdForBgp for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_bfd_for_bgp_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Update BfdForBgp for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_bfd_for_bgp_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bfd_for_bgp_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForBgpAdministrativeState" + } + + def _clear_ipv6_neighbors_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_ipv6_neighbors_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_ipv6_neighbors_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_ipv6_neighbors_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearIpv6Neighbors" + } + + @overload + def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + clearIpv6Neighbors for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + clearIpv6Neighbors for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_ipv6_neighbors( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + clearIpv6Neighbors for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_ipv6_neighbors_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_ipv6_neighbors.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearIpv6Neighbors" + } + + def _clear_arp_entries_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_entries_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_entries_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_entries_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearArpEntries" + } + + @overload + def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes clearArpEntries operation to the underlying resources. + + clearArpEntries for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes clearArpEntries operation to the underlying resources. + + clearArpEntries for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_arp_entries( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Executes clearArpEntries operation to the underlying resources. + + clearArpEntries for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_arp_entries_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_entries.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/clearArpEntries" + } + + def _update_bfd_for_static_route_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_bfd_for_static_route_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_bfd_for_static_route_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_bfd_for_static_route_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForStaticRouteAdministrativeState" + } + + @overload + def begin_update_bfd_for_static_route_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes update BfdForStaticRoutes operation to the underlying resources. + + Update BfdForStaticRoutes for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_bfd_for_static_route_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Executes update BfdForStaticRoutes operation to the underlying resources. + + Update BfdForStaticRoutes for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_bfd_for_static_route_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + internal_network_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Executes update BfdForStaticRoutes operation to the underlying resources. + + Update BfdForStaticRoutes for internalNetwork. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param internal_network_name: Name of the InternalNetwork. Required. + :type internal_network_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_bfd_for_static_route_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + internal_network_name=internal_network_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_bfd_for_static_route_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}/updateBfdForStaticRouteAdministrativeState" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_communities_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_communities_operations.py new file mode 100644 index 000000000000..e664ee8e4ec7 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_communities_operations.py @@ -0,0 +1,1074 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, ip_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipCommunityName": _SERIALIZER.url("ip_community_name", ip_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, ip_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipCommunityName": _SERIALIZER.url("ip_community_name", ip_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, ip_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipCommunityName": _SERIALIZER.url("ip_community_name", ip_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, ip_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipCommunityName": _SERIALIZER.url("ip_community_name", ip_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class IpCommunitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`ip_communities` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunity, IO], **kwargs: Any + ) -> _models.IpCommunity: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpCommunity") + + request = build_create_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + ip_community_name: str, + body: _models.IpCommunity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpCommunity]: + """Create an IP Community. + + Implements an IP Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + ip_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpCommunity]: + """Create an IP Community. + + Implements an IP Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunity, IO], **kwargs: Any + ) -> LROPoller[_models.IpCommunity]: + """Create an IP Community. + + Implements an IP Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: Request payload. Is either a IpCommunity type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunity or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @distributed_trace + def get(self, resource_group_name: str, ip_community_name: str, **kwargs: Any) -> _models.IpCommunity: + """Gets an IP Community. + + Implements an IP Community GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpCommunity or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.IpCommunity + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + def _update_initial( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunityPatch, IO], **kwargs: Any + ) -> Optional[_models.IpCommunity]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.IpCommunity]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpCommunityPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpCommunity", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + ip_community_name: str, + body: _models.IpCommunityPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpCommunity]: + """Updates an IP Community. + + API to update certain properties of the IP Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: IP Community properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunityPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + ip_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpCommunity]: + """Updates an IP Community. + + API to update certain properties of the IP Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: IP Community properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, ip_community_name: str, body: Union[_models.IpCommunityPatch, IO], **kwargs: Any + ) -> LROPoller[_models.IpCommunity]: + """Updates an IP Community. + + API to update certain properties of the IP Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :param body: IP Community properties to update. Is either a IpCommunityPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpCommunityPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpCommunity or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpCommunity] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_community_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ip_community_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes an IP Community. + + Implements IP Community DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_community_name: Name of the IP Community. Required. + :type ip_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_community_name=ip_community_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IpCommunity"]: + """List IpCommunities by resource group. + + Implements IpCommunities list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpCommunity or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpCommunitiesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpCommunitiesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IpCommunity"]: + """List IpCommunities by subscription. + + Implements IpCommunities list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpCommunity or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.IpCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpCommunitiesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpCommunitiesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_extended_communities_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_extended_communities_operations.py new file mode 100644 index 000000000000..2c9760b3726b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_extended_communities_operations.py @@ -0,0 +1,1102 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, ip_extended_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipExtendedCommunityName": _SERIALIZER.url("ip_extended_community_name", ip_extended_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, ip_extended_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipExtendedCommunityName": _SERIALIZER.url("ip_extended_community_name", ip_extended_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, ip_extended_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipExtendedCommunityName": _SERIALIZER.url("ip_extended_community_name", ip_extended_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, ip_extended_community_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipExtendedCommunityName": _SERIALIZER.url("ip_extended_community_name", ip_extended_community_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class IpExtendedCommunitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`ip_extended_communities` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunity, IO], + **kwargs: Any + ) -> _models.IpExtendedCommunity: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpExtendedCommunity") + + request = build_create_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: _models.IpExtendedCommunity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpExtendedCommunity]: + """Create an IP Extended Community. + + Implements IP Extended Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpExtendedCommunity]: + """Create an IP Extended Community. + + Implements IP Extended Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunity, IO], + **kwargs: Any + ) -> LROPoller[_models.IpExtendedCommunity]: + """Create an IP Extended Community. + + Implements IP Extended Community PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: Request payload. Is either a IpExtendedCommunity type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, ip_extended_community_name: str, **kwargs: Any + ) -> _models.IpExtendedCommunity: + """Gets an IP Extended Community. + + Implements IP Extended Community GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpExtendedCommunity or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + def _update_initial( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunityPatch, IO], + **kwargs: Any + ) -> Optional[_models.IpExtendedCommunity]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.IpExtendedCommunity]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpExtendedCommunityPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: _models.IpExtendedCommunityPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpExtendedCommunity]: + """Updates the IP Extended Community. + + API to update certain properties of the IP Extended Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: IP Extended Community properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunityPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpExtendedCommunity]: + """Updates the IP Extended Community. + + API to update certain properties of the IP Extended Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: IP Extended Community properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + ip_extended_community_name: str, + body: Union[_models.IpExtendedCommunityPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.IpExtendedCommunity]: + """Updates the IP Extended Community. + + API to update certain properties of the IP Extended Community resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :param body: IP Extended Community properties to update. Is either a IpExtendedCommunityPatch + type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpExtendedCommunityPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpExtendedCommunity or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpExtendedCommunity] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunity", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_extended_community_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ip_extended_community_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the IP Extended Community. + + Implements IP Extended Community DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_extended_community_name: Name of the IP Extended Community. Required. + :type ip_extended_community_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_extended_community_name=ip_extended_community_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.IpExtendedCommunity"]: + """List IpExtendedCommunities by resource group. + + Implements IpExtendedCommunities list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpExtendedCommunity or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpExtendedCommunityListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunityListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IpExtendedCommunity"]: + """List IpExtendedCommunities by subscription. + + Implements IpExtendedCommunities list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpExtendedCommunity or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.IpExtendedCommunity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpExtendedCommunityListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpExtendedCommunityListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_prefixes_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_prefixes_operations.py new file mode 100644 index 000000000000..f6962e194018 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_ip_prefixes_operations.py @@ -0,0 +1,1068 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, ip_prefix_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipPrefixName": _SERIALIZER.url("ip_prefix_name", ip_prefix_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, ip_prefix_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipPrefixName": _SERIALIZER.url("ip_prefix_name", ip_prefix_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, ip_prefix_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipPrefixName": _SERIALIZER.url("ip_prefix_name", ip_prefix_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, ip_prefix_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "ipPrefixName": _SERIALIZER.url("ip_prefix_name", ip_prefix_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class IpPrefixesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`ip_prefixes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefix, IO], **kwargs: Any + ) -> _models.IpPrefix: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpPrefix") + + request = build_create_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + ip_prefix_name: str, + body: _models.IpPrefix, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpPrefix]: + """Create an IP Prefix. + + Implements IP Prefix PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefix + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpPrefix or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + ip_prefix_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpPrefix]: + """Create an IP Prefix. + + Implements IP Prefix PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpPrefix or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefix, IO], **kwargs: Any + ) -> LROPoller[_models.IpPrefix]: + """Create an IP Prefix. + + Implements IP Prefix PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: Request payload. Is either a IpPrefix type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefix or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpPrefix or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @distributed_trace + def get(self, resource_group_name: str, ip_prefix_name: str, **kwargs: Any) -> _models.IpPrefix: + """Gets an IP Prefix. + + Implements IP Prefix GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.IpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + def _update_initial( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefixPatch, IO], **kwargs: Any + ) -> Optional[_models.IpPrefix]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.IpPrefix]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "IpPrefixPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("IpPrefix", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + ip_prefix_name: str, + body: _models.IpPrefixPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpPrefix]: + """Updates the IP Prefix. + + API to update certain properties of the IP Prefix resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: IP Prefix properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefixPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpPrefix or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + ip_prefix_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpPrefix]: + """Updates the IP Prefix. + + API to update certain properties of the IP Prefix resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: IP Prefix properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpPrefix or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, ip_prefix_name: str, body: Union[_models.IpPrefixPatch, IO], **kwargs: Any + ) -> LROPoller[_models.IpPrefix]: + """Updates the IP Prefix. + + API to update certain properties of the IP Prefix resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :param body: IP Prefix properties to update. Is either a IpPrefixPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.IpPrefixPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpPrefix or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpPrefix] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_prefix_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ip_prefix_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the IP Prefix. + + Implements IP Prefix DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ip_prefix_name: Name of the IP Prefix. Required. + :type ip_prefix_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_prefix_name=ip_prefix_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IpPrefix"]: + """List IpPrefixes by resource group. + + Implements IpPrefixes list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpPrefix or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpPrefixesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpPrefixesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.IpPrefix"]: + """List IpPrefixes by subscription. + + Implements IpPrefixes list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpPrefix or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.IpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.IpPrefixesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpPrefixesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l2_isolation_domains_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l2_isolation_domains_operations.py new file mode 100644 index 000000000000..18143d39e67d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l2_isolation_domains_operations.py @@ -0,0 +1,2032 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_administrative_state_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/updateAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_arp_table_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearArpTable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_neighbor_table_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearNeighborTable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_arp_entries_request( + resource_group_name: str, l2_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/getArpEntries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l2IsolationDomainName": _SERIALIZER.url("l2_isolation_domain_name", l2_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class L2IsolationDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`l2_isolation_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomain, IO], + **kwargs: Any + ) -> _models.L2IsolationDomain: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L2IsolationDomain") + + request = build_create_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.L2IsolationDomain, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L2IsolationDomain]: + """Create L2 Isolation Domain. + + Creates layer 2 network connectivity between compute nodes within a rack and across racks.The + configuration is applied on the devices only after the isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L2IsolationDomain]: + """Create L2 Isolation Domain. + + Creates layer 2 network connectivity between compute nodes within a rack and across racks.The + configuration is applied on the devices only after the isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomain, IO], + **kwargs: Any + ) -> LROPoller[_models.L2IsolationDomain]: + """Create L2 Isolation Domain. + + Creates layer 2 network connectivity between compute nodes within a rack and across racks.The + configuration is applied on the devices only after the isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a L2IsolationDomain type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomain or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @distributed_trace + def get(self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any) -> _models.L2IsolationDomain: + """Retrieves details of this L2 Isolation Domain. + + Implements L2 Isolation Domain GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: L2IsolationDomain or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + def _update_initial( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomainPatch, IO], + **kwargs: Any + ) -> Optional[_models.L2IsolationDomain]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.L2IsolationDomain]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L2IsolationDomainPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.L2IsolationDomainPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L2IsolationDomain]: + """Updates a L2 Isolation Domain. + + API to update certain properties of the L2 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: API to update certain properties of the L2 Isolation Domain resource.. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomainPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L2IsolationDomain]: + """Updates a L2 Isolation Domain. + + API to update certain properties of the L2 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: API to update certain properties of the L2 Isolation Domain resource.. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.L2IsolationDomainPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.L2IsolationDomain]: + """Updates a L2 Isolation Domain. + + API to update certain properties of the L2 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :param body: API to update certain properties of the L2 Isolation Domain resource.. Is either a + L2IsolationDomainPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L2IsolationDomainPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L2IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L2IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L2IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes named L2 Isolation Domain. + + Deletes layer 2 connectivity between compute nodes by managed by named L2 Isolation name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2 Isolation Domain. Required. + :type l2_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}" + } + + def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/updateAdministrativeState" + } + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Enables isolation domain across the fabric or on specified racks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Enables isolation domain across the fabric or on specified racks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_administrative_state( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Enables isolation domain across the fabric or on specified racks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/updateAdministrativeState" + } + + def _clear_arp_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_table_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearArpTable" + } + + @overload + def begin_clear_arp_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_arp_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_arp_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_arp_table_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearArpTable" + } + + def _clear_neighbor_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_neighbor_table_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_neighbor_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_neighbor_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearNeighborTable" + } + + @overload + def begin_clear_neighbor_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_neighbor_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_neighbor_table( + self, + resource_group_name: str, + l2_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_neighbor_table_initial( # type: ignore + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_neighbor_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/clearNeighborTable" + } + + def _get_arp_entries_initial( + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> Dict[str, _models.ARPProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Dict[str, _models.ARPProperties]] = kwargs.pop("cls", None) + + request = build_get_arp_entries_request( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_arp_entries_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("{ARPProperties}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_arp_entries_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/getArpEntries" + } + + @distributed_trace + def begin_get_arp_entries( + self, resource_group_name: str, l2_isolation_domain_name: str, **kwargs: Any + ) -> LROPoller[Dict[str, _models.ARPProperties]]: + """Implements the operation to the underlying resources. + + Clears IPv6 neighbors for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_isolation_domain_name: Name of the L2IsolationDomain. Required. + :type l2_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either dict mapping str to ARPProperties or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[dict[str, + ~azure.mgmt.managednetworkfabric.models.ARPProperties]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Dict[str, _models.ARPProperties]] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._get_arp_entries_initial( + resource_group_name=resource_group_name, + l2_isolation_domain_name=l2_isolation_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("{ARPProperties}", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_arp_entries.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}/getArpEntries" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.L2IsolationDomain"]: + """List L2IsolationDomains by resource group. + + Displays L2IsolationDomains list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L2IsolationDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L2IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("L2IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.L2IsolationDomain"]: + """List L2IsolationDomains by subscription. + + Displays L2IsolationDomains list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L2IsolationDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.L2IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L2IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("L2IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l3_isolation_domains_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l3_isolation_domains_operations.py new file mode 100644 index 000000000000..db6f525bf2df --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_l3_isolation_domains_operations.py @@ -0,0 +1,2132 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_administrative_state_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_option_b_administrative_state_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateOptionBAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_arp_table_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearArpTable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_neighbor_table_request( + resource_group_name: str, l3_isolation_domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearNeighborTable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "l3IsolationDomainName": _SERIALIZER.url("l3_isolation_domain_name", l3_isolation_domain_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class L3IsolationDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`l3_isolation_domains` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomain, IO], + **kwargs: Any + ) -> _models.L3IsolationDomain: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L3IsolationDomain") + + request = build_create_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.L3IsolationDomain, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L3IsolationDomain]: + """Create L3 Isolation Domain. + + Create isolation domain resources for layer 3 connectivity between compute nodes and for + communication with external services .This configuration is applied on the devices only after + the creation of networks is completed and isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L3IsolationDomain]: + """Create L3 Isolation Domain. + + Create isolation domain resources for layer 3 connectivity between compute nodes and for + communication with external services .This configuration is applied on the devices only after + the creation of networks is completed and isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomain, IO], + **kwargs: Any + ) -> LROPoller[_models.L3IsolationDomain]: + """Create L3 Isolation Domain. + + Create isolation domain resources for layer 3 connectivity between compute nodes and for + communication with external services .This configuration is applied on the devices only after + the creation of networks is completed and isolation domain is enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a L3IsolationDomain type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomain or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @distributed_trace + def get(self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any) -> _models.L3IsolationDomain: + """Gets a L3 Isolation Domain. + + Retrieves details of this L3 Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: L3IsolationDomain or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + def _update_initial( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomainPatch, IO], + **kwargs: Any + ) -> Optional[_models.L3IsolationDomain]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.L3IsolationDomain]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "L3IsolationDomainPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.L3IsolationDomainPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L3IsolationDomain]: + """Updates a L3 Isolation Domain. + + API to update certain properties of the L3 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: API to update certain properties of the L3 Isolation Domain resource. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.L3IsolationDomain]: + """Updates a L3 Isolation Domain. + + API to update certain properties of the L3 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: API to update certain properties of the L3 Isolation Domain resource. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.L3IsolationDomainPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.L3IsolationDomain]: + """Updates a L3 Isolation Domain. + + API to update certain properties of the L3 Isolation Domain resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :param body: API to update certain properties of the L3 Isolation Domain resource. Is either a + L3IsolationDomainPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.L3IsolationDomainPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either L3IsolationDomain or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.L3IsolationDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("L3IsolationDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, l3_isolation_domain_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a L3 Isolation Domain. + + Deletes layer 3 connectivity between compute nodes by managed by named L3 Isolation name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3 Isolation Domain. Required. + :type l3_isolation_domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.L3IsolationDomain"]: + """List L3IsolationDomains by resource group. + + Displays L3IsolationDomains list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L3IsolationDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L3IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("L3IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.L3IsolationDomain"]: + """List L3IsolationDomains by subscription. + + Displays L3IsolationDomains list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either L3IsolationDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.L3IsolationDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.L3IsolationDomainsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("L3IsolationDomainsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains" + } + + def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateAdministrativeState" + } + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """executes enable operation to the underlying resources. + + Enables racks for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """executes enable operation to the underlying resources. + + Enables racks for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """executes enable operation to the underlying resources. + + Enables racks for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateAdministrativeState" + } + + def _update_option_b_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_option_b_administrative_state_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_option_b_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_option_b_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateOptionBAdministrativeState" + } + + @overload + def begin_update_option_b_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update route targets on CE devices. List the CE network device ARM resource IDs in the request + body payload. + + Update administrative state of option B on CE devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_option_b_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Update route targets on CE devices. List the CE network device ARM resource IDs in the request + body payload. + + Update administrative state of option B on CE devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_option_b_administrative_state( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Update route targets on CE devices. List the CE network device ARM resource IDs in the request + body payload. + + Update administrative state of option B on CE devices. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_option_b_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_option_b_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/updateOptionBAdministrativeState" + } + + def _clear_arp_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_arp_table_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_arp_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearArpTable" + } + + @overload + def begin_clear_arp_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """executes clear ARP operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_arp_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """executes clear ARP operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_arp_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """executes clear ARP operation to the underlying resources. + + Clears ARP tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_arp_table_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearArpTable" + } + + def _clear_neighbor_table_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnableDisableOnResources") + + request = build_clear_neighbor_table_request( + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._clear_neighbor_table_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _clear_neighbor_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearNeighborTable" + } + + @overload + def begin_clear_neighbor_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: _models.EnableDisableOnResources, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """executes ipv6 clear neighbor tables operation to the underlying resources. + + Clears IPv6 neighbor tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clear_neighbor_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """executes ipv6 clear neighbor tables operation to the underlying resources. + + Clears IPv6 neighbor tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clear_neighbor_table( + self, + resource_group_name: str, + l3_isolation_domain_name: str, + body: Union[_models.EnableDisableOnResources, IO], + **kwargs: Any + ) -> LROPoller[None]: + """executes ipv6 clear neighbor tables operation to the underlying resources. + + Clears IPv6 neighbor tables for this Isolation Domain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_isolation_domain_name: Name of the L3IsolationDomain. Required. + :type l3_isolation_domain_name: str + :param body: Request payload. Is either a EnableDisableOnResources type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.EnableDisableOnResources or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clear_neighbor_table_initial( # type: ignore + resource_group_name=resource_group_name, + l3_isolation_domain_name=l3_isolation_domain_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_clear_neighbor_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/clearNeighborTable" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_device_skus_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_device_skus_operations.py new file mode 100644 index 000000000000..25da8a29b334 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_device_skus_operations.py @@ -0,0 +1,256 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(network_device_sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "networkDeviceSkuName": _SERIALIZER.url("network_device_sku_name", network_device_sku_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkDeviceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_device_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, network_device_sku_name: str, **kwargs: Any) -> _models.NetworkDeviceSku: + """Gets a Network Device Sku. + + Get Network Device SKU details. + + :param network_device_sku_name: Name of the Network Device Sku. Required. + :type network_device_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkDeviceSku or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkDeviceSku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDeviceSku] = kwargs.pop("cls", None) + + request = build_get_request( + network_device_sku_name=network_device_sku_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkDeviceSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkDeviceSku"]: + """List NetworkDeviceSkus by subscription. + + List Network Device SKUs for the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkDeviceSku or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkDeviceSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDeviceSkusListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkDeviceSkusListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_devices_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_devices_operations.py new file mode 100644 index 000000000000..f0c57ac84b87 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_devices_operations.py @@ -0,0 +1,2560 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reboot_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/reboot", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restore_config_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/restoreConfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_version_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updateVersion", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_support_package_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/generateSupportPackage", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_power_cycle_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updatePowerCycle", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_status_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_static_interface_maps_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStaticInterfaceMaps", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_dynamic_interface_maps_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getDynamicInterfaceMaps", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkDevicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_devices` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_group_name: str, network_device_name: str, body: Union[_models.NetworkDevice, IO], **kwargs: Any + ) -> _models.NetworkDevice: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkDevice") + + request = build_create_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_device_name: str, + body: _models.NetworkDevice, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkDevice]: + """Create Network Device. + + Create a Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevice + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkDevice]: + """Create Network Device. + + Create a Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, network_device_name: str, body: Union[_models.NetworkDevice, IO], **kwargs: Any + ) -> LROPoller[_models.NetworkDevice]: + """Create Network Device. + + Create a Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Request payload. Is either a NetworkDevice type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevice or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkDevice", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @distributed_trace + def get(self, resource_group_name: str, network_device_name: str, **kwargs: Any) -> _models.NetworkDevice: + """Gets a Network Device. + + Get the Network Device resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkDevice or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkDevice + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + def _update_initial( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.NetworkDevicePatchParameters, IO], + **kwargs: Any + ) -> Optional[_models.NetworkDevice]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkDevice]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkDevicePatchParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkDevice", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + network_device_name: str, + body: _models.NetworkDevicePatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkDevice]: + """Updates a Network Device. + + Update certain properties of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Network Device properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevicePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkDevice]: + """Updates a Network Device. + + Update certain properties of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Network Device properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.NetworkDevicePatchParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkDevice]: + """Updates a Network Device. + + Update certain properties of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :param body: Network Device properties to update. Is either a NetworkDevicePatchParameters type + or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkDevicePatchParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkDevice or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkDevice] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkDevice", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, network_device_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Network Device. + + Delete the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the Network Device. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkDevice"]: + """List NetworkDevices by resource group. + + List all the Network Device resources in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkDevice or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDevicesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkDevicesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkDevice"]: + """List NetworkDevices by subscription. + + List all the Network Device resources in a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkDevice or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkDevice] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkDevicesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkDevicesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices" + } + + def _reboot_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_reboot_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reboot_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _reboot_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/reboot" + } + + @distributed_trace + def begin_reboot(self, resource_group_name: str, network_device_name: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Reboot the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reboot_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reboot.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/reboot" + } + + def _restore_config_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restore_config_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restore_config_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restore_config_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/restoreConfig" + } + + @distributed_trace + def begin_restore_config( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Restores the configuration to last applied good configuration from Azure. + + Restore the configuration of the Network Device resource to last known good configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restore_config_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restore_config.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/restoreConfig" + } + + def _update_version_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdateVersionProperties, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateVersionProperties") + + request = build_update_version_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_version_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_version_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updateVersion" + } + + @overload + def begin_update_version( + self, + resource_group_name: str, + network_device_name: str, + body: _models.UpdateVersionProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements SKU version upgrade of network device. + + Update the SKU version of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateVersionProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_version( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements SKU version upgrade of network device. + + Update the SKU version of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_version( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdateVersionProperties, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements SKU version upgrade of network device. + + Update the SKU version of the Network Device resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Is either a UpdateVersionProperties type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateVersionProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_version_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_version.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updateVersion" + } + + def _generate_support_package_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> _models.SupportPackageProperties: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportPackageProperties] = kwargs.pop("cls", None) + + request = build_generate_support_package_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._generate_support_package_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SupportPackageProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_support_package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/generateSupportPackage" + } + + @distributed_trace + def begin_generate_support_package( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> LROPoller[_models.SupportPackageProperties]: + """Implements the operation to the underlying resources. + + Generate Support Package for the given Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SupportPackageProperties or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.SupportPackageProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportPackageProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_support_package_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SupportPackageProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_support_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/generateSupportPackage" + } + + def _update_power_cycle_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdatePowerCycleProperties, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdatePowerCycleProperties") + + request = build_update_power_cycle_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_power_cycle_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_power_cycle_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updatePowerCycle" + } + + @overload + def begin_update_power_cycle( + self, + resource_group_name: str, + network_device_name: str, + body: _models.UpdatePowerCycleProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Update PDU power cycle of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdatePowerCycleProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_power_cycle( + self, + resource_group_name: str, + network_device_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Update PDU power cycle of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_power_cycle( + self, + resource_group_name: str, + network_device_name: str, + body: Union[_models.UpdatePowerCycleProperties, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Update PDU power cycle of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param body: Request payload. Is either a UpdatePowerCycleProperties type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdatePowerCycleProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_power_cycle_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_power_cycle.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/updatePowerCycle" + } + + def _get_status_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> _models.GetDeviceStatusProperties: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GetDeviceStatusProperties] = kwargs.pop("cls", None) + + request = build_get_status_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_status_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("GetDeviceStatusProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStatus" + } + + @distributed_trace + def begin_get_status( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> LROPoller[_models.GetDeviceStatusProperties]: + """Gets the running status of the network device. + + Get the running status of the Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GetDeviceStatusProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.GetDeviceStatusProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GetDeviceStatusProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("GetDeviceStatusProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStatus" + } + + def _get_static_interface_maps_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> List[_models.GetStaticInterfaceMapsPropertiesItem]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetStaticInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + + request = build_get_static_interface_maps_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_static_interface_maps_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetStaticInterfaceMapsPropertiesItem]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_static_interface_maps_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStaticInterfaceMaps" + } + + @distributed_trace + def begin_get_static_interface_maps( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> LROPoller[List[_models.GetStaticInterfaceMapsPropertiesItem]]: + """Show the interface maps as per the topology. + + Get the static interface maps for the given Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either list of + GetStaticInterfaceMapsPropertiesItem or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.managednetworkfabric.models.GetStaticInterfaceMapsPropertiesItem]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetStaticInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._get_static_interface_maps_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetStaticInterfaceMapsPropertiesItem]", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_static_interface_maps.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getStaticInterfaceMaps" + } + + def _get_dynamic_interface_maps_initial( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> List[_models.GetDynamicInterfaceMapsPropertiesItem]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetDynamicInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + + request = build_get_dynamic_interface_maps_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_dynamic_interface_maps_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetDynamicInterfaceMapsPropertiesItem]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_dynamic_interface_maps_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getDynamicInterfaceMaps" + } + + @distributed_trace + def begin_get_dynamic_interface_maps( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> LROPoller[List[_models.GetDynamicInterfaceMapsPropertiesItem]]: + """Implements the operation to the underlying resources. + + Get the dynamic interface maps for the given Network Device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either list of + GetDynamicInterfaceMapsPropertiesItem or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.managednetworkfabric.models.GetDynamicInterfaceMapsPropertiesItem]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.GetDynamicInterfaceMapsPropertiesItem]] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._get_dynamic_interface_maps_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("[GetDynamicInterfaceMapsPropertiesItem]", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_dynamic_interface_maps.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/getDynamicInterfaceMaps" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_controllers_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_controllers_operations.py new file mode 100644 index 000000000000..fefb9afadd68 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_controllers_operations.py @@ -0,0 +1,1418 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, network_fabric_controller_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricControllerName": _SERIALIZER.url( + "network_fabric_controller_name", network_fabric_controller_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, network_fabric_controller_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricControllerName": _SERIALIZER.url( + "network_fabric_controller_name", network_fabric_controller_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, network_fabric_controller_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricControllerName": _SERIALIZER.url( + "network_fabric_controller_name", network_fabric_controller_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, network_fabric_controller_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricControllerName": _SERIALIZER.url( + "network_fabric_controller_name", network_fabric_controller_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_workload_management_network_request( + resource_group_name: str, network_fabric_controller_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/enableWorkloadManagementNetwork", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricControllerName": _SERIALIZER.url( + "network_fabric_controller_name", network_fabric_controller_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_workload_management_network_request( + resource_group_name: str, network_fabric_controller_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/disableWorkloadManagementNetwork", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricControllerName": _SERIALIZER.url( + "network_fabric_controller_name", network_fabric_controller_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkFabricControllersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_fabric_controllers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricController, IO], + **kwargs: Any + ) -> _models.NetworkFabricController: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabricController") + + request = build_create_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: _models.NetworkFabricController, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabricController]: + """Create Network fabric controller. + + Creates a Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricController + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabricController]: + """Create Network fabric controller. + + Creates a Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricController, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkFabricController]: + """Create Network fabric controller. + + Creates a Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Request payload. Is either a NetworkFabricController type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricController or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> _models.NetworkFabricController: + """Gets a Network Fabric Controller. + + Shows the provisioning status of Network Fabric Controller. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFabricController or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkFabricController + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + def _update_initial( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricControllerPatch, IO], + **kwargs: Any + ) -> Optional[_models.NetworkFabricController]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkFabricController]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabricControllerPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: _models.NetworkFabricControllerPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabricController]: + """Updates a Network Fabric Controller. + + Updates are currently not supported for the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Network Fabric Controller properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabricController]: + """Updates a Network Fabric Controller. + + Updates are currently not supported for the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Network Fabric Controller properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + network_fabric_controller_name: str, + body: Union[_models.NetworkFabricControllerPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkFabricController]: + """Updates a Network Fabric Controller. + + Updates are currently not supported for the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :param body: Network Fabric Controller properties to update. Is either a + NetworkFabricControllerPatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricControllerPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabricController] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabricController", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a Network Fabric Controller. + + Deletes the Network Fabric Controller resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the Network Fabric Controller. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkFabricController"]: + """List NetworkFabricControllers by resource group. + + Lists all the NetworkFabricControllers thats available in the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricControllersListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricControllersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkFabricController"]: + """List NetworkFabricControllers by subscription. + + Lists all the NetworkFabricControllers by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabricController or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabricController] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricControllersListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricControllersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers" + } + + def _enable_workload_management_network_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_enable_workload_management_network_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._enable_workload_management_network_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _enable_workload_management_network_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/enableWorkloadManagementNetwork" + } + + @distributed_trace + def begin_enable_workload_management_network( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Enables the workloadManagementNetwork (Tenant Network). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the networkFabricController. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._enable_workload_management_network_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable_workload_management_network.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/enableWorkloadManagementNetwork" + } + + def _disable_workload_management_network_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_disable_workload_management_network_request( + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_workload_management_network_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _disable_workload_management_network_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/disableWorkloadManagementNetwork" + } + + @distributed_trace + def begin_disable_workload_management_network( + self, resource_group_name: str, network_fabric_controller_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Disables the workloadManagementNetwork (Tenant Network). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_controller_name: Name of the networkFabricController. Required. + :type network_fabric_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._disable_workload_management_network_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_controller_name=network_fabric_controller_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable_workload_management_network.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}/disableWorkloadManagementNetwork" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_skus_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_skus_operations.py new file mode 100644 index 000000000000..67a2f933e755 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabric_skus_operations.py @@ -0,0 +1,256 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(network_fabric_sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "networkFabricSkuName": _SERIALIZER.url("network_fabric_sku_name", network_fabric_sku_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkFabricSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_fabric_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, network_fabric_sku_name: str, **kwargs: Any) -> _models.NetworkFabricSku: + """Gets a Network Fabric Sku. + + Implements Network Fabric Sku GET method. + + :param network_fabric_sku_name: Name of the Network Fabric Sku. Required. + :type network_fabric_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFabricSku or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkFabricSku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricSku] = kwargs.pop("cls", None) + + request = build_get_request( + network_fabric_sku_name=network_fabric_sku_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkFabricSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkFabricSku"]: + """List NetworkFabricSkus by subscription. + + Implements NetworkFabricSkus list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabricSku or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabricSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricSkusListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricSkusListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabrics_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabrics_operations.py new file mode 100644 index 000000000000..6ad601996f13 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_fabrics_operations.py @@ -0,0 +1,1382 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_provision_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/provision", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deprovision_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/deprovision", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkFabricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_fabrics` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_group_name: str, network_fabric_name: str, body: Union[_models.NetworkFabric, IO], **kwargs: Any + ) -> _models.NetworkFabric: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabric") + + request = build_create_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + body: _models.NetworkFabric, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabric]: + """Create Network Fabric. + + Create Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabric + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabric]: + """Create Network Fabric. + + Create Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, network_fabric_name: str, body: Union[_models.NetworkFabric, IO], **kwargs: Any + ) -> LROPoller[_models.NetworkFabric]: + """Create Network Fabric. + + Create Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Request payload. Is either a NetworkFabric type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabric or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabric", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @distributed_trace + def get(self, resource_group_name: str, network_fabric_name: str, **kwargs: Any) -> _models.NetworkFabric: + """Gets a Network Fabric. + + Get Network Fabric resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFabric or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkFabric + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + def _update_initial( + self, + resource_group_name: str, + network_fabric_name: str, + body: Union[_models.NetworkFabricPatchParameters, IO], + **kwargs: Any + ) -> Optional[_models.NetworkFabric]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkFabric]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkFabricPatchParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkFabric", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + network_fabric_name: str, + body: _models.NetworkFabricPatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabric]: + """Updates a Network Fabric. + + Update certain properties of the Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Network Fabric properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + network_fabric_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFabric]: + """Updates a Network Fabric. + + Update certain properties of the Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Network Fabric properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + network_fabric_name: str, + body: Union[_models.NetworkFabricPatchParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkFabric]: + """Updates a Network Fabric. + + Update certain properties of the Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :param body: Network Fabric properties to update. Is either a NetworkFabricPatchParameters type + or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkFabricPatchParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFabric or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkFabric] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkFabric", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, network_fabric_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Network Fabric. + + Delete Network Fabric resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the Network Fabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkFabric"]: + """List NetworkFabrics by resource group. + + List all the Network Fabric resources in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabric or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkFabric"]: + """List NetworkFabrics by subscription. + + List all the Network Fabric resources in the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFabric or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkFabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkFabricsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFabricsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics" + } + + def _provision_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_provision_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._provision_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _provision_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/provision" + } + + @distributed_trace + def begin_provision(self, resource_group_name: str, network_fabric_name: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Provisions the underlying resources in the given Network Fabric instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._provision_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_provision.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/provision" + } + + def _deprovision_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_deprovision_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._deprovision_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _deprovision_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/deprovision" + } + + @distributed_trace + def begin_deprovision(self, resource_group_name: str, network_fabric_name: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to the underlying resources. + + Deprovisions the underlying resources in the given Network Fabric instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._deprovision_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_deprovision.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/deprovision" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_interfaces_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_interfaces_operations.py new file mode 100644 index 000000000000..f75cbab00b40 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_interfaces_operations.py @@ -0,0 +1,1454 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, network_device_name: str, network_interface_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, network_device_name: str, network_interface_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, network_device_name: str, network_interface_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, network_device_name: str, network_interface_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, network_device_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_status_request( + resource_group_name: str, network_device_name: str, network_interface_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/getStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_administrative_state_request( + resource_group_name: str, network_device_name: str, network_interface_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/updateAdministrativeState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkDeviceName": _SERIALIZER.url("network_device_name", network_device_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkInterfacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_interfaces` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkInterface") + + request = build_create_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: _models.NetworkInterface, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Create NetworkInterface. + + Create a Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterface + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Create NetworkInterface. + + Create a Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Create NetworkInterface. + + Create a Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Is either a NetworkInterface type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterface or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterface", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> _models.NetworkInterface: + """Gets a NetworkInterface. + + Get the Network Interface resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + def _update_initial( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterfacePatch, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkInterfacePatch") + + request = build_update_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: _models.NetworkInterfacePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Updates a NetworkInterface. + + Update certain properties of the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :param body: NetworkInterface properties to update. Only tags are supported. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterfacePatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Updates a NetworkInterface. + + Update certain properties of the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :param body: NetworkInterface properties to update. Only tags are supported. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.NetworkInterfacePatch, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Updates a NetworkInterface. + + Update certain properties of the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :param body: NetworkInterface properties to update. Only tags are supported. Is either a + NetworkInterfacePatch type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkInterfacePatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterface", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a NetworkInterface. + + Delete the Network Interface resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterfaceName. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_device_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterface"]: + """List all Network Interfaces that are available using an Network Device. + + List all the Network Interface resources in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkInterfacesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfacesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces" + } + + def _get_status_initial( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> _models.InterfaceStatus: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InterfaceStatus] = kwargs.pop("cls", None) + + request = build_get_status_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_status_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("InterfaceStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/getStatus" + } + + @distributed_trace + def begin_get_status( + self, resource_group_name: str, network_device_name: str, network_interface_name: str, **kwargs: Any + ) -> LROPoller[_models.InterfaceStatus]: + """Implements the operation to the underlying resources. + + Get the running status of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either InterfaceStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.InterfaceStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InterfaceStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("InterfaceStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/getStatus" + } + + def _update_administrative_state_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateAdministrativeState") + + request = build_update_administrative_state_request( + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_administrative_state_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_administrative_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/updateAdministrativeState" + } + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: _models.UpdateAdministrativeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the admin state of the network interface. + + Update the admin state of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_administrative_state( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the admin state of the network interface. + + Update the admin state of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_administrative_state( + self, + resource_group_name: str, + network_device_name: str, + network_interface_name: str, + body: Union[_models.UpdateAdministrativeState, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Updates the admin state of the network interface. + + Update the admin state of the Network Interface. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_device_name: Name of the NetworkDevice. Required. + :type network_device_name: str + :param network_interface_name: Name of the NetworkInterface. Required. + :type network_interface_name: str + :param body: Request payload. Is either a UpdateAdministrativeState type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.UpdateAdministrativeState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_administrative_state_initial( # type: ignore + resource_group_name=resource_group_name, + network_device_name=network_device_name, + network_interface_name=network_interface_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_administrative_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}/updateAdministrativeState" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_rack_skus_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_rack_skus_operations.py new file mode 100644 index 000000000000..994f804ec868 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_rack_skus_operations.py @@ -0,0 +1,256 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(network_rack_sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRackSkus/{networkRackSkuName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "networkRackSkuName": _SERIALIZER.url("network_rack_sku_name", network_rack_sku_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRackSkus" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkRackSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_rack_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, network_rack_sku_name: str, **kwargs: Any) -> _models.NetworkRackSku: + """Gets a Network Rack Sku. + + Get Network Rack SKU resource. + + :param network_rack_sku_name: Name of the Network Rack Sku. Required. + :type network_rack_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRackSku or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkRackSku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRackSku] = kwargs.pop("cls", None) + + request = build_get_request( + network_rack_sku_name=network_rack_sku_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRackSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRackSkus/{networkRackSkuName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkRackSku"]: + """List NetworkRackSkus by subscription. + + List all Network Rack SKUs in the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRackSku or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkRackSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRackSkusListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRackSkusListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRackSkus" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_racks_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_racks_operations.py new file mode 100644 index 000000000000..f48fd7b07240 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_racks_operations.py @@ -0,0 +1,1063 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, network_rack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkRackName": _SERIALIZER.url("network_rack_name", network_rack_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, network_rack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkRackName": _SERIALIZER.url("network_rack_name", network_rack_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, network_rack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkRackName": _SERIALIZER.url("network_rack_name", network_rack_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, network_rack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkRackName": _SERIALIZER.url("network_rack_name", network_rack_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkRacksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_racks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRack, IO], **kwargs: Any + ) -> _models.NetworkRack: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkRack") + + request = build_create_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_rack_name: str, + body: _models.NetworkRack, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkRack]: + """Create Network Rack. + + Create Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRack + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_rack_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkRack]: + """Create Network Rack. + + Create Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRack, IO], **kwargs: Any + ) -> LROPoller[_models.NetworkRack]: + """Create Network Rack. + + Create Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Request payload. Is either a NetworkRack type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRack or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkRack", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @distributed_trace + def get(self, resource_group_name: str, network_rack_name: str, **kwargs: Any) -> _models.NetworkRack: + """Gets a Network Rack. + + Get Network Rack resource details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRack or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkRack + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + def _update_initial( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRackPatch, IO], **kwargs: Any + ) -> Optional[_models.NetworkRack]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NetworkRack]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkRackPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkRack", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + network_rack_name: str, + body: _models.NetworkRackPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkRack]: + """Updates a Network Rack. + + Update certain properties of the Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Network Rack properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRackPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + network_rack_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkRack]: + """Updates a Network Rack. + + Update certain properties of the Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Network Rack properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, network_rack_name: str, body: Union[_models.NetworkRackPatch, IO], **kwargs: Any + ) -> LROPoller[_models.NetworkRack]: + """Updates a Network Rack. + + Update certain properties of the Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :param body: Network Rack properties to update. Is either a NetworkRackPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkRackPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkRack or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkRack] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkRack", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_rack_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, network_rack_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Network Rack. + + Delete Network Rack resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_rack_name: Name of the Network Rack. Required. + :type network_rack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_rack_name=network_rack_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkRack"]: + """List NetworkRacks by resource group. + + List all Network Rack resources in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRack or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRacksListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRacksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkRack"]: + """List NetworkRacks by subscription. + + List all Network Rack resources in the given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRack or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkRack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkRacksListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkRacksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_to_network_interconnects_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_to_network_interconnects_operations.py new file mode 100644 index 000000000000..a6a91d79fb83 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_network_to_network_interconnects_operations.py @@ -0,0 +1,769 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + "networkToNetworkInterconnectName": _SERIALIZER.url( + "network_to_network_interconnect_name", network_to_network_interconnect_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + "networkToNetworkInterconnectName": _SERIALIZER.url( + "network_to_network_interconnect_name", network_to_network_interconnect_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + "networkToNetworkInterconnectName": _SERIALIZER.url( + "network_to_network_interconnect_name", network_to_network_interconnect_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, network_fabric_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFabricName": _SERIALIZER.url("network_fabric_name", network_fabric_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkToNetworkInterconnectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`network_to_network_interconnects` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: Union[_models.NetworkToNetworkInterconnect, IO], + **kwargs: Any + ) -> _models.NetworkToNetworkInterconnect: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkToNetworkInterconnect] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "NetworkToNetworkInterconnect") + + request = build_create_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: _models.NetworkToNetworkInterconnect, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkToNetworkInterconnect]: + """Configuration used to setup CE-PE connectivity. + + Configuration used to setup CE-PE connectivity PUT Method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkToNetworkInterconnect or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkToNetworkInterconnect]: + """Configuration used to setup CE-PE connectivity. + + Configuration used to setup CE-PE connectivity PUT Method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkToNetworkInterconnect or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + body: Union[_models.NetworkToNetworkInterconnect, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkToNetworkInterconnect]: + """Configuration used to setup CE-PE connectivity. + + Configuration used to setup CE-PE connectivity PUT Method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :param body: Request payload. Is either a NetworkToNetworkInterconnect type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkToNetworkInterconnect or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkToNetworkInterconnect] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + **kwargs: Any + ) -> _models.NetworkToNetworkInterconnect: + """Configuration used to setup CE-PE connectivity. + + Implements NetworkToNetworkInterconnects GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnect. + Required. + :type network_to_network_interconnect_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkToNetworkInterconnect or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkToNetworkInterconnect] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkToNetworkInterconnect", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + network_fabric_name: str, + network_to_network_interconnect_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a NetworkToNetworkInterconnects. + + Implements NetworkToNetworkInterconnects DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :param network_to_network_interconnect_name: Name of the NetworkToNetworkInterconnectName. + Required. + :type network_to_network_interconnect_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + network_to_network_interconnect_name=network_to_network_interconnect_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_fabric_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkToNetworkInterconnect"]: + """Executes list operation to display Network To Network Interconnects within a Network Fabric. + + Implements Network To Network Interconnects list by Network Fabric GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_fabric_name: Name of the NetworkFabric. Required. + :type network_fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkToNetworkInterconnect or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.NetworkToNetworkInterconnect] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkToNetworkInterconnectsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + network_fabric_name=network_fabric_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkToNetworkInterconnectsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_operations.py new file mode 100644 index 000000000000..7ab37d038c13 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ManagedNetworkFabric/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """Returns list of all operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.ManagedNetworkFabric/operations"} diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_patch.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_route_policies_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_route_policies_operations.py new file mode 100644 index 000000000000..ff67da58c1d4 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/operations/_route_policies_operations.py @@ -0,0 +1,1063 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, route_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "routePolicyName": _SERIALIZER.url("route_policy_name", route_policy_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, route_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "routePolicyName": _SERIALIZER.url("route_policy_name", route_policy_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, route_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "routePolicyName": _SERIALIZER.url("route_policy_name", route_policy_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, route_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "routePolicyName": _SERIALIZER.url("route_policy_name", route_policy_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RoutePoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.managednetworkfabric.AzureNetworkFabricManagementServiceAPI`'s + :attr:`route_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicy, IO], **kwargs: Any + ) -> _models.RoutePolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RoutePolicy") + + request = build_create_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + route_policy_name: str, + body: _models.RoutePolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RoutePolicy]: + """Create Route Policy. + + Implements Route Policy PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Request payload. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + route_policy_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RoutePolicy]: + """Create Route Policy. + + Implements Route Policy PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Request payload. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicy, IO], **kwargs: Any + ) -> LROPoller[_models.RoutePolicy]: + """Create Route Policy. + + Implements Route Policy PUT method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Request payload. Is either a RoutePolicy type or a IO type. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RoutePolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @distributed_trace + def get(self, resource_group_name: str, route_policy_name: str, **kwargs: Any) -> _models.RoutePolicy: + """Gets a Route Policy. + + Implements Route Policy GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoutePolicy or the result of cls(response) + :rtype: ~azure.mgmt.managednetworkfabric.models.RoutePolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + def _update_initial( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicyPatch, IO], **kwargs: Any + ) -> Optional[_models.RoutePolicy]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.RoutePolicy]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RoutePolicyPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("RoutePolicy", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + route_policy_name: str, + body: _models.RoutePolicyPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RoutePolicy]: + """Updates a Route Policy. + + API to update certain properties of the Route Policy resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Route Policy properties to update. Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicyPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + route_policy_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RoutePolicy]: + """Updates a Route Policy. + + API to update certain properties of the Route Policy resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Route Policy properties to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, route_policy_name: str, body: Union[_models.RoutePolicyPatch, IO], **kwargs: Any + ) -> LROPoller[_models.RoutePolicy]: + """Updates a Route Policy. + + API to update certain properties of the Route Policy resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :param body: Route Policy properties to update. Is either a RoutePolicyPatch type or a IO type. + Required. + :type body: ~azure.mgmt.managednetworkfabric.models.RoutePolicyPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RoutePolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutePolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RoutePolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_policy_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, route_policy_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Route Policy. + + Implements Route Policy DELETE method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param route_policy_name: Name of the Route Policy. Required. + :type route_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + route_policy_name=route_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RoutePolicy"]: + """List RoutePolicies by resource group. + + Implements RoutePolicies list by resource group GET method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoutePolicy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RoutePoliciesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RoutePoliciesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.RoutePolicy"]: + """List RoutePolicies by subscription. + + Implements RoutePolicies list by subscription GET method. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoutePolicy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.managednetworkfabric.models.RoutePolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RoutePoliciesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RoutePoliciesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies" + } diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/py.typed b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/azure/mgmt/managednetworkfabric/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_create_minimum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_create_minimum_set_gen.py new file mode 100644 index 000000000000..5a617ef6206f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_create_minimum_set_gen.py @@ -0,0 +1,58 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python access_control_lists_create_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.access_control_lists.create( + resource_group_name="resourceGroupName", + access_control_list_name="aclOne", + body={ + "location": "EastUs", + "properties": { + "addressFamily": "ipv4", + "conditions": [ + { + "action": "allow", + "destinationAddress": "1.1.1.1", + "destinationPort": "21", + "protocol": 6, + "sequenceNumber": 3, + "sourceAddress": "2.2.2.2", + "sourcePort": "65000", + } + ], + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/AccessControlLists_Create_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_delete_minimum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_delete_minimum_set_gen.py new file mode 100644 index 000000000000..f494c976f26e --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_delete_minimum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python access_control_lists_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.access_control_lists.delete( + resource_group_name="subscriptionId", + access_control_list_name="aclOne", + ) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/AccessControlLists_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_get_minimum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_get_minimum_set_gen.py new file mode 100644 index 000000000000..b334f7dca507 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_get_minimum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python access_control_lists_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.access_control_lists.get( + resource_group_name="resourceGroupName", + access_control_list_name="aclOne", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/AccessControlLists_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_resource_group_minimum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_resource_group_minimum_set_gen.py new file mode 100644 index 000000000000..1ef246c176ab --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_resource_group_minimum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python access_control_lists_list_by_resource_group_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.access_control_lists.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/AccessControlLists_ListByResourceGroup_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_subscription_minimum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_subscription_minimum_set_gen.py new file mode 100644 index 000000000000..33bf87ada4a6 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_list_by_subscription_minimum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python access_control_lists_list_by_subscription_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.access_control_lists.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/AccessControlLists_ListBySubscription_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_update_minimum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_update_minimum_set_gen.py new file mode 100644 index 000000000000..c4ba3f764362 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/access_control_lists_update_minimum_set_gen.py @@ -0,0 +1,57 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python access_control_lists_update_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.access_control_lists.update( + resource_group_name="resourceGroupName", + access_control_list_name="aclOne", + body={ + "properties": { + "addressFamily": "ipv4", + "conditions": [ + { + "action": "allow", + "destinationAddress": "1.1.1.2", + "destinationPort": "21", + "protocol": 6, + "sequenceNumber": 4, + "sourceAddress": "2.2.2.3", + "sourcePort": "65000", + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/AccessControlLists_Update_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_arp_entries_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_arp_entries_maximum_set_gen.py new file mode 100644 index 000000000000..80f07f406d13 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_arp_entries_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_clear_arp_entries_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.external_networks.begin_clear_arp_entries( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_clearArpEntries_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_ipv6_neighbors_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_ipv6_neighbors_maximum_set_gen.py new file mode 100644 index 000000000000..a873c6106ff6 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_clear_ipv6_neighbors_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_clear_ipv6_neighbors_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.external_networks.begin_clear_ipv6_neighbors( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_clearIpv6Neighbors_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_create_maximum_set_gen.py new file mode 100644 index 000000000000..aa828dfe9762 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_create_maximum_set_gen.py @@ -0,0 +1,60 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.external_networks.begin_create( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "properties": { + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName", + "importRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName", + "optionAProperties": { + "bfdConfiguration": {}, + "mtu": 1500, + "peerASN": 65047, + "primaryIpv4Prefix": "10.1.1.0/30", + "primaryIpv6Prefix": "3FFE:FFFF:0:CD30::a0/126", + "secondaryIpv4Prefix": "10.1.1.4/30", + "secondaryIpv6Prefix": "3FFE:FFFF:0:CD30::a4/126", + "vlanId": 1001, + }, + "optionBProperties": {"exportRouteTargets": ["65046:10039"], "importRouteTargets": ["65046:10039"]}, + "peeringOption": "OptionA", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_delete_maximum_set_gen.py new file mode 100644 index 000000000000..bcb7839425a7 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.external_networks.begin_delete( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_get_maximum_set_gen.py new file mode 100644 index 000000000000..0b889607281a --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_get_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.external_networks.get( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_list_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_list_maximum_set_gen.py new file mode 100644 index 000000000000..1a31cd3c5e14 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_list_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.external_networks.list( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..ec85be135499 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_update_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.external_networks.begin_update_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_updateAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..f28230625868 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.external_networks.begin_update_bfd_for_bgp_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_updateBfdForBgpAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bgp_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bgp_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..fd9f92220166 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_bgp_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_update_bgp_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.external_networks.begin_update_bgp_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_updateBgpAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_maximum_set_gen.py new file mode 100644 index 000000000000..a42bf37e858f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/external_networks_update_maximum_set_gen.py @@ -0,0 +1,61 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python external_networks_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.external_networks.begin_update( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + external_network_name="example-externalnetwork", + body={ + "properties": { + "annotation": "Lab 1", + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName", + "importRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName", + "optionAProperties": { + "bfdConfiguration": {}, + "mtu": 1500, + "peerASN": 65047, + "primaryIpv4Prefix": "10.1.1.0/30", + "primaryIpv6Prefix": "3FFE:FFFF:0:CD30::a0/126", + "secondaryIpv4Prefix": "10.1.1.4/30", + "secondaryIpv6Prefix": "3FFE:FFFF:0:CD30::a4/126", + "vlanId": 1001, + }, + "optionBProperties": {"exportRouteTargets": ["65046:10039"], "importRouteTargets": ["65046:10039"]}, + "peeringOption": "OptionA", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_arp_entries_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_arp_entries_maximum_set_gen.py new file mode 100644 index 000000000000..7864cf3d6060 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_arp_entries_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_clear_arp_entries_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_clear_arp_entries( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_clearArpEntries_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_ipv6_neighbors_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_ipv6_neighbors_maximum_set_gen.py new file mode 100644 index 000000000000..d6070556ba11 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_clear_ipv6_neighbors_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_clear_ipv6_neighbors_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_clear_ipv6_neighbors( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_clearIpv6Neighbors_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_create_maximum_set_gen.py new file mode 100644 index 000000000000..b58b88ec0223 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_create_maximum_set_gen.py @@ -0,0 +1,68 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.internal_networks.begin_create( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "properties": { + "bgpConfiguration": { + "allowAS": 1, + "allowASOverride": "Enable", + "bfdConfiguration": {}, + "defaultRouteOriginate": "True", + "ipv4ListenRangePrefixes": ["10.1.0.0/25"], + "ipv4NeighborAddress": [{"address": "10.1.0.0"}], + "ipv6ListenRangePrefixes": ["2fff::/66"], + "ipv6NeighborAddress": [{"address": "2fff::"}], + "peerASN": 6, + }, + "connectedIPv4Subnets": [{"prefix": "10.0.0.0/24"}], + "connectedIPv6Subnets": [{"prefix": "3FFE:FFFF:0:CD30::a0/29"}], + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName2", + "importRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName1", + "mtu": 1500, + "staticRouteConfiguration": { + "bfdConfiguration": {}, + "ipv4Routes": [{"nextHop": ["10.0.0.1"], "prefix": "10.1.0.0/24"}], + "ipv6Routes": [{"nextHop": ["2ffe::1"], "prefix": "2fff::/64"}], + }, + "vlanId": 501, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_delete_maximum_set_gen.py new file mode 100644 index 000000000000..c938017b423c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_delete( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_get_maximum_set_gen.py new file mode 100644 index 000000000000..b04c543501b1 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_get_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.internal_networks.get( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_list_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_list_maximum_set_gen.py new file mode 100644 index 000000000000..0cdd18c0c21b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_list_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.internal_networks.list( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..0cb0bbff2687 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_update_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_update_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/example-l3domain/internalNetworks/example-internalnetwork" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_updateAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..6a741444521e --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_update_bfd_for_bgp_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_update_bfd_for_bgp_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/example-l3domain/internalNetworks/example-internalnetwork" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_updateBfdForBgpAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_static_route_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_static_route_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..21ace9825132 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bfd_for_static_route_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_update_bfd_for_static_route_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_update_bfd_for_static_route_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/example-l3domain/internalNetworks/example-internalnetwork" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_updateBfdForStaticRouteAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bgp_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bgp_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..d079395eb1ca --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_bgp_administrative_state_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_update_bgp_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.internal_networks.begin_update_bgp_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/example-l3domain/internalNetworks/example-internalnetwork" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_updateBgpAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_maximum_set_gen.py new file mode 100644 index 000000000000..b425f2fb06dc --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/internal_networks_update_maximum_set_gen.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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python internal_networks_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.internal_networks.begin_update( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + internal_network_name="example-internalnetwork", + body={ + "properties": { + "bgpConfiguration": { + "allowAS": 1, + "allowASOverride": "Enable", + "bfdConfiguration": {}, + "defaultRouteOriginate": "True", + "ipv4ListenRangePrefixes": ["10.1.0.0/25"], + "ipv4NeighborAddress": [{"address": "10.1.0.0"}], + "ipv6ListenRangePrefixes": ["2fff::/66"], + "ipv6NeighborAddress": [{"address": "2fff::"}], + "peerASN": 6, + }, + "connectedIPv4Subnets": [{"prefix": "10.0.0.0/24"}], + "connectedIPv6Subnets": [{"prefix": "3FFE:FFFF:0:CD30::a0/29"}], + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName2", + "importRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName1", + "mtu": 1500, + "staticRouteConfiguration": { + "bfdConfiguration": {}, + "ipv4Routes": [{"nextHop": ["10.0.0.1"], "prefix": "10.1.0.0/24"}], + "ipv6Routes": [{"nextHop": ["2ffe::1"], "prefix": "2fff::/64"}], + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_create_maximum_set_gen.py new file mode 100644 index 000000000000..a16c13e64c34 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_create_maximum_set_gen.py @@ -0,0 +1,51 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_communities_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_communities.begin_create( + resource_group_name="rgIpCommunityLists", + ip_community_name="example-ipCommunity", + body={ + "location": "EastUS", + "properties": { + "action": "Permit", + "annotation": "annotationValue", + "communityMembers": ["1234:5678"], + "wellKnownCommunities": ["Internet", "LocalAS", "NoExport", "GShut"], + }, + "tags": {"key2814": ""}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpCommunities_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_delete_maximum_set_gen.py new file mode 100644 index 000000000000..be01e906bb46 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_communities_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.ip_communities.begin_delete( + resource_group_name="resourceGroupName", + ip_community_name="IpCommunityList1", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpCommunities_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_get_maximum_set_gen.py new file mode 100644 index 000000000000..f213b4491eca --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_communities_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_communities.get( + resource_group_name="resourceGroupName", + ip_community_name="example-ipCommunity", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpCommunities_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..cdd7a5947ed0 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_communities_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_communities.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpCommunities_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..1cb329fc6151 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_communities_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_communities.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpCommunities_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_update_maximum_set_gen.py new file mode 100644 index 000000000000..83cf6da93210 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_communities_update_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_communities_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_communities.begin_update( + resource_group_name="resourceGroupName", + ip_community_name="example-ipCommunity", + body={"tags": {"key2814": ""}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpCommunities_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_create_maximum_set_gen.py new file mode 100644 index 000000000000..7dd5239e22f9 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_create_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_extended_communities_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_extended_communities.begin_create( + resource_group_name="rgIpExtendedCommunityLists", + ip_extended_community_name="example_ipExtendedCommunity", + body={ + "location": "EastUs", + "properties": {"action": "Permit", "annotation": "annotationValue", "routeTargets": ["1234:5678"]}, + "tags": {"key5054": "key"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_delete_maximum_set_gen.py new file mode 100644 index 000000000000..9c0468ca7a3f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_extended_communities_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.ip_extended_communities.begin_delete( + resource_group_name="rgIpExtendedCommunityLists", + ip_extended_community_name="example_ipExtendedCommunity", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_get_maximum_set_gen.py new file mode 100644 index 000000000000..7812cc6da279 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_extended_communities_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_extended_communities.get( + resource_group_name="rgIpExtendedCommunityLists", + ip_extended_community_name="example_ipExtendedCommunity", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..1f8ab0e57e0c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_extended_communities_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_extended_communities.list_by_resource_group( + resource_group_name="rgIpExtendedCommunityLists", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..3671fd5c46bb --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_extended_communities_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_extended_communities.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_update_maximum_set_gen.py new file mode 100644 index 000000000000..b74d127beaba --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_extended_communities_update_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_extended_communities_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_extended_communities.begin_update( + resource_group_name="rgIpExtendedCommunityLists", + ip_extended_community_name="example_ipExtendedCommunity", + body={"tags": {"key5054": "key1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_create_maximum_set_gen.py new file mode 100644 index 000000000000..a9ccefb88a93 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_create_maximum_set_gen.py @@ -0,0 +1,57 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_prefixes_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_prefixes.begin_create( + resource_group_name="resourcegroupname", + ip_prefix_name="example-ipPrefix", + body={ + "location": "EastUS", + "properties": { + "annotation": "annotationValue", + "ipPrefixRules": [ + { + "action": "Permit", + "condition": "EqualTo", + "networkPrefix": "1.1.1.0/24", + "sequenceNumber": 12, + "subnetMaskLength": 28, + } + ], + }, + "tags": {"key6404": ""}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpPrefixes_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_delete_maximum_set_gen.py new file mode 100644 index 000000000000..1a36c24ca012 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_prefixes_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="xxxxxx", + ) + + client.ip_prefixes.begin_delete( + resource_group_name="rgIpPrefixLists", + ip_prefix_name="example-ipPrefix", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpPrefixes_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_get_maximum_set_gen.py new file mode 100644 index 000000000000..8103722e773b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_prefixes_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="xxxxxx", + ) + + response = client.ip_prefixes.get( + resource_group_name="resourcegroupname", + ip_prefix_name="example-ipPrefix", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpPrefixes_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..2b520c0810cb --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_prefixes_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_prefixes.list_by_resource_group( + resource_group_name="resourcegroupname", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpPrefixes_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..760c069cada4 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_prefixes_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_prefixes.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpPrefixes_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_update_maximum_set_gen.py new file mode 100644 index 000000000000..c42411598122 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/ip_prefixes_update_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python ip_prefixes_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.ip_prefixes.begin_update( + resource_group_name="resourcegroupname", + ip_prefix_name="example-ipPrefix", + body={"tags": {"key3127": "key"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpPrefixes_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_arp_table_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_arp_table_maximum_set_gen.py new file mode 100644 index 000000000000..bc5e52589cb4 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_arp_table_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_clear_arp_table_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l2_isolation_domains.begin_clear_arp_table( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="example-l2domain", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/example-l2domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_clearArpTable_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_neighbor_table_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_neighbor_table_maximum_set_gen.py new file mode 100644 index 000000000000..842eb3145ad1 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_clear_neighbor_table_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_clear_neighbor_table_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="qc", + ) + + client.l2_isolation_domains.begin_clear_neighbor_table( + resource_group_name="rgL2IsolationDomains", + l2_isolation_domain_name="oz", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/example-l2domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_clearNeighborTable_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_create_maximum_set_gen.py new file mode 100644 index 000000000000..68ed5faba700 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_create_maximum_set_gen.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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l2_isolation_domains.begin_create( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="example-l2domain", + body={ + "location": "eastus", + "properties": { + "mtu": 1500, + "networkFabricId": "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/networkFabrics/FabricName", + "vlanId": 501, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_delete_maximum_set_gen.py new file mode 100644 index 000000000000..6b8cbb5c2484 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l2_isolation_domains.begin_delete( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="example-l2domain", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_arp_entries_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_arp_entries_maximum_set_gen.py new file mode 100644 index 000000000000..91ddb369fc48 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_arp_entries_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_get_arp_entries_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l2_isolation_domains.begin_get_arp_entries( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="l2IsolationDomainName", + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_getArpEntries_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_maximum_set_gen.py new file mode 100644 index 000000000000..fa969397153e --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l2_isolation_domains.get( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="l2IsolationDomainName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..4a5a07769f93 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l2_isolation_domains.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..10f5f40e44af --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l2_isolation_domains.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..254f095c3e48 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_administrative_state_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_update_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l2_isolation_domains.begin_update_administrative_state( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="l2IsolationDomainName", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/example-l2domain" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_updateAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_maximum_set_gen.py new file mode 100644 index 000000000000..c47348218284 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l2_isolation_domains_update_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l2_isolation_domains_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l2_isolation_domains.begin_update( + resource_group_name="resourceGroupName", + l2_isolation_domain_name="l2IsolationDomainName", + body={"properties": {"mtu": 9000}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L2IsolationDomains_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_arp_table_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_arp_table_maximum_set_gen.py new file mode 100644 index 000000000000..956b7d0f7bc6 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_arp_table_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_clear_arp_table_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l3_isolation_domains.begin_clear_arp_table( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="l3IsolationDomainName", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ] + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_clearArpTable_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_neighbor_table_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_neighbor_table_maximum_set_gen.py new file mode 100644 index 000000000000..11622e609867 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_clear_neighbor_table_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_clear_neighbor_table_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l3_isolation_domains.begin_clear_neighbor_table( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + body={"resourceIds": ["wnaxqikneofcni"]}, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_clearNeighborTable_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_create_maximum_set_gen.py new file mode 100644 index 000000000000..5b4682df5030 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_create_maximum_set_gen.py @@ -0,0 +1,57 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l3_isolation_domains.begin_create( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + body={ + "location": "eastus", + "properties": { + "aggregateRouteConfiguration": { + "ipv4Routes": [{"prefix": "10.0.0.0/24"}], + "ipv6Routes": [{"prefix": "10.0.0.1"}], + }, + "connectedSubnetRoutePolicy": { + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName2" + }, + "description": "creating L3 isolation domain", + "networkFabricId": "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/networkFabrics/FabricName", + "redistributeConnectedSubnets": "True", + "redistributeStaticRoutes": "False", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_delete_maximum_set_gen.py new file mode 100644 index 000000000000..d56b208d488c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l3_isolation_domains.begin_delete( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_get_maximum_set_gen.py new file mode 100644 index 000000000000..7b4188838203 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l3_isolation_domains.get( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..d230048fcf9a --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l3_isolation_domains.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..1df6d70f7deb --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l3_isolation_domains.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..90548693308f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_administrative_state_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_update_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l3_isolation_domains.begin_update_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_updateAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_maximum_set_gen.py new file mode 100644 index 000000000000..f66ae485786f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_maximum_set_gen.py @@ -0,0 +1,55 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.l3_isolation_domains.begin_update( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + body={ + "properties": { + "aggregateRouteConfiguration": { + "ipv4Routes": [{"prefix": "10.0.0.0/24"}], + "ipv6Routes": [{"prefix": "3FFE:FFFF:0:CD30::a0/29"}], + }, + "connectedSubnetRoutePolicy": { + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName" + }, + "description": "creating L3 isolation domain", + "redistributeConnectedSubnets": "True", + "redistributeStaticRoutes": "False", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_option_badministrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_option_badministrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..f761a26d6c66 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/l3_isolation_domains_update_option_badministrative_state_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python l3_isolation_domains_update_option_badministrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.l3_isolation_domains.begin_update_option_b_administrative_state( + resource_group_name="resourceGroupName", + l3_isolation_domain_name="example-l3domain", + body={ + "resourceIds": [ + "/subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain" + ], + "state": "Enable", + }, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/L3IsolationDomains_updateOptionBAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/list_operations.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/list_operations.py new file mode 100644 index 000000000000..ac04ec7d40fd --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/list_operations.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python list_operations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ListOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_get_maximum_set_gen.py new file mode 100644 index 000000000000..74fd124ddac6 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_get_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_device_skus_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_device_skus.get( + network_device_sku_name="DefaultSku", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDeviceSkus_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..599f6df95fab --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_device_skus_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_device_skus_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_device_skus.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDeviceSkus_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_create_maximum_set_gen.py new file mode 100644 index 000000000000..ecd40a65ac22 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_create_maximum_set_gen.py @@ -0,0 +1,52 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.begin_create( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + body={ + "location": "eastus", + "properties": { + "annotation": "null", + "hostName": "networkDeviceName", + "networkDeviceRole": "CE", + "networkDeviceSku": "DefaultSku", + "serialNumber": "Arista;DCS-7280PR3-24;12.05;JPE21330382", + }, + "tags": {"keyID": "keyValue"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_delete_maximum_set_gen.py new file mode 100644 index 000000000000..3744360cbced --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_devices.begin_delete( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_generate_support_package_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_generate_support_package_maximum_set_gen.py new file mode 100644 index 000000000000..34205c130fe7 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_generate_support_package_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_generate_support_package_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.begin_generate_support_package( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_generateSupportPackage_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_dynamic_interface_maps_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_dynamic_interface_maps_maximum_set_gen.py new file mode 100644 index 000000000000..8f3a710c9958 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_dynamic_interface_maps_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_get_dynamic_interface_maps_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.begin_get_dynamic_interface_maps( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_getDynamicInterfaceMaps_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_maximum_set_gen.py new file mode 100644 index 000000000000..bceaae42b985 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.get( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_static_interface_maps_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_static_interface_maps_maximum_set_gen.py new file mode 100644 index 000000000000..bf11ba1955e3 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_static_interface_maps_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_get_static_interface_maps_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.begin_get_static_interface_maps( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_getStaticInterfaceMaps_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_status_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_status_maximum_set_gen.py new file mode 100644 index 000000000000..aa0fdf06b1ed --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_get_status_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_get_status_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.begin_get_status( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_getStatus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..5b003300c8a8 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..95f07f7e1629 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_reboot_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_reboot_maximum_set_gen.py new file mode 100644 index 000000000000..f88464015896 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_reboot_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_reboot_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_devices.begin_reboot( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_reboot_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_restore_config_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_restore_config_maximum_set_gen.py new file mode 100644 index 000000000000..b63e0e5f9068 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_restore_config_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_restore_config_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_devices.begin_restore_config( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_restoreConfig_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_maximum_set_gen.py new file mode 100644 index 000000000000..0f643758029d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_maximum_set_gen.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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_devices.begin_update( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + body={ + "properties": { + "annotation": "null", + "hostName": "networkDeviceName", + "serialNumber": "Arista;DCS-7280PR3-24;12.05;JPE21330382", + }, + "tags": {"keyID": "keyValue"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_power_cycle_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_power_cycle_maximum_set_gen.py new file mode 100644 index 000000000000..99866eb46fdf --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_power_cycle_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_update_power_cycle_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_devices.begin_update_power_cycle( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + body={"powerEnd": "Primary", "state": "On"}, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_updatePowerCycle_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_version_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_version_maximum_set_gen.py new file mode 100644 index 000000000000..dba41ea83ef6 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_devices_update_version_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_devices_update_version_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_devices.begin_update_version( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + body={"skuVersion": "DefaultSku"}, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkDevices_updateVersion_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_create_maximum_set_gen.py new file mode 100644 index 000000000000..ea4f4d88a411 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_create_maximum_set_gen.py @@ -0,0 +1,61 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_controllers.begin_create( + resource_group_name="resourceGroupName", + network_fabric_controller_name="NetworkControllerName", + body={ + "location": "eastus", + "properties": { + "annotation": "lab 1", + "infrastructureExpressRouteConnections": [ + { + "expressRouteAuthorizationKey": "xxxxxxx", + "expressRouteCircuitId": "/subscriptions/xxxxx/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/expressRouteCircuitName", + } + ], + "ipv4AddressSpace": "172.253.0.0/19", + "managedResourceGroupConfiguration": {"location": "eastus", "name": "managedResourceGroupName"}, + "workloadExpressRouteConnections": [ + { + "expressRouteAuthorizationKey": "xxxxx", + "expressRouteCircuitId": "/subscriptions/xxxxx/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/expressRouteCircuitName", + } + ], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_delete_maximum_set_gen.py new file mode 100644 index 000000000000..eea22465d447 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_fabric_controllers.begin_delete( + resource_group_name="resourceGroupName", + network_fabric_controller_name="networkFabricControllerName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_disable_workload_management_network_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_disable_workload_management_network_maximum_set_gen.py new file mode 100644 index 000000000000..a1ddf195cd7b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_disable_workload_management_network_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_disable_workload_management_network_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_fabric_controllers.begin_disable_workload_management_network( + resource_group_name="resourceGroupName", + network_fabric_controller_name="networkFabricControllerName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_disableWorkloadManagementNetwork_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_enable_workload_management_network_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_enable_workload_management_network_maximum_set_gen.py new file mode 100644 index 000000000000..437cd58eb89d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_enable_workload_management_network_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_enable_workload_management_network_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_fabric_controllers.begin_enable_workload_management_network( + resource_group_name="resourceGroupName", + network_fabric_controller_name="networkFabricControllerName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_enableWorkloadManagementNetwork_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_get_maximum_set_gen.py new file mode 100644 index 000000000000..0b175143318b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_controllers.get( + resource_group_name="resourceGroupName", + network_fabric_controller_name="networkFabricControllerName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..451064dde27c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_controllers.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..dbf1e87ec661 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_controllers.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_update_maximum_set_gen.py new file mode 100644 index 000000000000..5cd6577eaf95 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_controllers_update_maximum_set_gen.py @@ -0,0 +1,51 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_controllers_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_controllers.begin_update( + resource_group_name="resourceGroupName", + network_fabric_controller_name="networkFabricControllerName", + body={ + "properties": { + "workloadExpressRouteConnections": [ + { + "expressRouteAuthorizationKey": "xxxxxxx", + "expressRouteCircuitId": "/subscriptions/xxxxx/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/expressRouteCircuitName", + } + ] + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricControllers_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_get_maximum_set_gen.py new file mode 100644 index 000000000000..0391b3bff646 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_get_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_skus_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_skus.get( + network_fabric_sku_name="networkFabricSkuName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricSkus_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..25b7811e5209 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabric_skus_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabric_skus_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabric_skus.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabricSkus_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_create_maximum_set_gen.py new file mode 100644 index 000000000000..f09a9480814c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_create_maximum_set_gen.py @@ -0,0 +1,98 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabrics.begin_create( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + body={ + "location": "eastuseuap", + "properties": { + "annotation": "annotationValue", + "fabricASN": 29249, + "ipv4Prefix": "10.18.0.0/19", + "ipv6Prefix": "3FFE:FFFF:0:CD40::/59", + "managementNetworkConfiguration": { + "infrastructureVpnConfiguration": { + "optionAProperties": { + "mtu": 5892, + "peerASN": 42666, + "primaryIpv4Prefix": "20.0.0.12/30", + "primaryIpv6Prefix": "3FFE:FFFF:0:CD30::a8/126", + "secondaryIpv4Prefix": "20.0.0.13/30", + "secondaryIpv6Prefix": "3FFE:FFFF:0:CD30::ac/126", + "vlanId": 2724, + }, + "optionBProperties": { + "exportRouteTargets": ["65046:10039"], + "importRouteTargets": ["65046:10039"], + }, + "peeringOption": "OptionA", + }, + "workloadVpnConfiguration": { + "optionAProperties": { + "mtu": 5892, + "peerASN": 42666, + "primaryIpv4Prefix": "10.0.0.14/30", + "primaryIpv6Prefix": "2FFE:FFFF:0:CD30::a7/126", + "secondaryIpv4Prefix": "10.0.0.15/30", + "secondaryIpv6Prefix": "2FFE:FFFF:0:CD30::ac/126", + "vlanId": 2724, + }, + "optionBProperties": { + "exportRouteTargets": ["65046:10050"], + "importRouteTargets": ["65046:10050"], + }, + "peeringOption": "OptionA", + }, + }, + "networkFabricControllerId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/fabricControllerName", + "networkFabricSku": "M4-A400-A100-C16-aa", + "rackCount": 4, + "serverCountPerRack": 8, + "terminalServerConfiguration": { + "password": "xxxx", + "primaryIpv4Prefix": "20.0.0.12/30", + "primaryIpv6Prefix": "3FFE:FFFF:0:CD30::a8/126", + "secondaryIpv4Prefix": "20.0.0.13/30", + "secondaryIpv6Prefix": "3FFE:FFFF:0:CD30::ac/126", + "serialNumber": "123456", + "username": "username", + }, + }, + "tags": {"key6468": ""}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_delete_maximum_set_gen.py new file mode 100644 index 000000000000..e364a745f76a --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="70A68989-24C0-4FA7-B1B2-8A2BB6D10CA8", + ) + + client.network_fabrics.begin_delete( + resource_group_name="rgNetworkFabrics", + network_fabric_name="lrhjxlxlhgvufessdcuetcwnto", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_deprovision_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_deprovision_maximum_set_gen.py new file mode 100644 index 000000000000..7a99d0d17356 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_deprovision_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_deprovision_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_fabrics.begin_deprovision( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_deprovision_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_get_maximum_set_gen.py new file mode 100644 index 000000000000..6abe5c26f5a3 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabrics.get( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..69886d8f3fcb --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabrics.list_by_resource_group( + resource_group_name="rgNetworkFabrics", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..c84f10e563ff --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabrics.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_provision_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_provision_maximum_set_gen.py new file mode 100644 index 000000000000..3b4fb2add4a8 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_provision_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_provision_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_fabrics.begin_provision( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_provision_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_update_maximum_set_gen.py new file mode 100644 index 000000000000..6b06bf38bcac --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_fabrics_update_maximum_set_gen.py @@ -0,0 +1,52 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_fabrics_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_fabrics.begin_update( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + body={ + "properties": { + "annotation": "annotationValue", + "terminalServerConfiguration": { + "password": "xxxxxxx", + "serialNumber": "234567", + "username": "username", + }, + }, + "tags": {"key1758": ""}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkFabrics_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_create_maximum_set_gen.py new file mode 100644 index 000000000000..767b74e24bc8 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_create_maximum_set_gen.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_interfaces.begin_create( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + network_interface_name="networkInterfaceName", + body={"properties": {"annotation": "null"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_delete_maximum_set_gen.py new file mode 100644 index 000000000000..833274bdec6f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_interfaces.begin_delete( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + network_interface_name="networkInterfaceName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_maximum_set_gen.py new file mode 100644 index 000000000000..f573911101a7 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_interfaces.get( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + network_interface_name="networkInterfaceName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_status_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_status_maximum_set_gen.py new file mode 100644 index 000000000000..cc95c15c484d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_get_status_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_get_status_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_interfaces.begin_get_status( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + network_interface_name="networkInterfaceName", + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_getStatus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_list_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_list_maximum_set_gen.py new file mode 100644 index 000000000000..6ddad25461d6 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_list_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_interfaces.list( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_administrative_state_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_administrative_state_maximum_set_gen.py new file mode 100644 index 000000000000..38128d75c6ad --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_administrative_state_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_update_administrative_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_interfaces.begin_update_administrative_state( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + network_interface_name="networkInterfaceName", + body={"state": "Enable"}, + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_updateAdministrativeState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_maximum_set_gen.py new file mode 100644 index 000000000000..8adcab9edb89 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_interfaces_update_maximum_set_gen.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_interfaces_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_interfaces.begin_update( + resource_group_name="resourceGroupName", + network_device_name="networkDeviceName", + network_interface_name="networkInterfaceName", + body={"properties": {"annotation": "null"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkInterfaces_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_get_maximum_set_gen.py new file mode 100644 index 000000000000..08f9109cbe46 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_get_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_rack_skus_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_rack_skus.get( + network_rack_sku_name="networkRackSkuName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRackSkus_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..1b11cd71c94f --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_rack_skus_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_rack_skus_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_rack_skus.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRackSkus_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_create_maximum_set_gen.py new file mode 100644 index 000000000000..569d1fa122ca --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_create_maximum_set_gen.py @@ -0,0 +1,50 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_racks_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_racks.begin_create( + resource_group_name="resourceGroupName", + network_rack_name="networkRackName", + body={ + "location": "eastus", + "properties": { + "annotation": "null", + "networkFabricId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkFabrics/networkFabricName", + "networkRackSku": "RackSKU", + }, + "tags": {"keyID": "keyValue"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRacks_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_delete_maximum_set_gen.py new file mode 100644 index 000000000000..8a3b37d4b86c --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_racks_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_racks.begin_delete( + resource_group_name="resourceGroupName", + network_rack_name="networkRackName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRacks_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_get_maximum_set_gen.py new file mode 100644 index 000000000000..3c367fa9cfec --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_racks_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_racks.get( + resource_group_name="resourceGroupName", + network_rack_name="networkRackName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRacks_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..ca1dabe09d22 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_racks_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_racks.list_by_resource_group( + resource_group_name="resourceGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRacks_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..65d6880336d7 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_racks_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_racks.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRacks_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_update_maximum_set_gen.py new file mode 100644 index 000000000000..d82a9d3bf852 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_racks_update_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_racks_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_racks.begin_update( + resource_group_name="resourceGroupName", + network_rack_name="networkRackName", + body={"properties": {}, "tags": {"keyID": "keyValue"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkRacks_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_create_maximum_set_gen.py new file mode 100644 index 000000000000..d0f22c3451aa --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_create_maximum_set_gen.py @@ -0,0 +1,60 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_to_network_interconnects_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_to_network_interconnects.begin_create( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + network_to_network_interconnect_name="DefaultNNI", + body={ + "properties": { + "isManagementType": "True", + "layer2Configuration": {"mtu": 1500, "portCount": 10}, + "layer3Configuration": { + "exportRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName2", + "importRoutePolicyId": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName1", + "peerASN": 50272, + "primaryIpv4Prefix": "172.31.0.0/31", + "primaryIpv6Prefix": "3FFE:FFFF:0:CD30::a0/126", + "secondaryIpv4Prefix": "172.31.0.20/31", + "secondaryIpv6Prefix": "3FFE:FFFF:0:CD30::a4/126", + "vlanId": 2064, + }, + "nniType": "CE", + "useOptionB": "False", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkToNetworkInterconnects_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_delete_maximum_set_gen.py new file mode 100644 index 000000000000..0a8fa8e8e1ee --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_to_network_interconnects_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.network_to_network_interconnects.begin_delete( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + network_to_network_interconnect_name="DefaultNNI", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkToNetworkInterconnects_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_get_maximum_set_gen.py new file mode 100644 index 000000000000..b0448ccbf00d --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_get_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_to_network_interconnects_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_to_network_interconnects.get( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + network_to_network_interconnect_name="DefaultNNI", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkToNetworkInterconnects_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_list_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_list_maximum_set_gen.py new file mode 100644 index 000000000000..0a3e55bf5e83 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/network_to_network_interconnects_list_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python network_to_network_interconnects_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.network_to_network_interconnects.list( + resource_group_name="resourceGroupName", + network_fabric_name="FabricName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/NetworkToNetworkInterconnects_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_create_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_create_maximum_set_gen.py new file mode 100644 index 000000000000..8035cc9fa8cd --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_create_maximum_set_gen.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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python route_policies_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.route_policies.begin_create( + resource_group_name="rgRoutePolicies", + route_policy_name="routePolicyName", + body={ + "location": "EastUS", + "properties": { + "annotation": "annotationValue", + "statements": [ + { + "action": { + "actionType": "Permit", + "ipCommunityProperties": { + "add": { + "ipCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipCommunities/ipCommunityName" + ] + }, + "delete": { + "ipCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipCommunities/ipCommunityName" + ] + }, + "set": { + "ipCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipCommunities/ipCommunityName" + ] + }, + }, + "ipExtendedCommunityProperties": { + "add": { + "ipExtendedCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/ipExtendedCommunityName" + ] + }, + "delete": { + "ipExtendedCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/ipExtendedCommunityName" + ] + }, + "set": { + "ipExtendedCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/ipExtendedCommunityName" + ] + }, + }, + "localPreference": 20, + }, + "annotation": "annotationValue", + "condition": { + "ipCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipCommunities/ipCommunityName" + ], + "ipExtendedCommunityIds": [ + "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/ipExtendedCommunityName" + ], + "ipPrefixId": "subscriptions/xxxxxx/resourceGroups/resourcegroupname/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/example-ipPrefix", + }, + "sequenceNumber": 7, + } + ], + }, + "tags": {"key8254": ""}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/RoutePolicies_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_delete_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_delete_maximum_set_gen.py new file mode 100644 index 000000000000..d92ae2392b6b --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python route_policies_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + client.route_policies.begin_delete( + resource_group_name="rgRoutePolicies", + route_policy_name="routePolicyName", + ).result() + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/RoutePolicies_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_get_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_get_maximum_set_gen.py new file mode 100644 index 000000000000..710e624a9981 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python route_policies_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.route_policies.get( + resource_group_name="rgRoutePolicies", + route_policy_name="routePolicyName", + ) + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/RoutePolicies_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_resource_group_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..cebc247d5571 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python route_policies_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.route_policies.list_by_resource_group( + resource_group_name="rgRoutePolicies", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/RoutePolicies_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_subscription_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..c18fc59d513a --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python route_policies_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.route_policies.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/RoutePolicies_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_update_maximum_set_gen.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_update_maximum_set_gen.py new file mode 100644 index 000000000000..b1c443f9035a --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/generated_samples/route_policies_update_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.managednetworkfabric import AzureNetworkFabricManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-managednetworkfabric +# USAGE + python route_policies_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureNetworkFabricManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="97D66995-95BA-464A-A250-FB6E25E499A8", + ) + + response = client.route_policies.begin_update( + resource_group_name="resourceGroupName", + route_policy_name="routePolicyName", + body={"tags": {"key8254": ""}}, + ).result() + print(response) + + +# x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/RoutePolicies_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/sdk_packaging.toml b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/sdk_packaging.toml new file mode 100644 index 000000000000..51bf09c96c7e --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/sdk_packaging.toml @@ -0,0 +1,10 @@ +[packaging] +package_name = "azure-mgmt-managednetworkfabric" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/setup.py b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/setup.py new file mode 100644 index 000000000000..0dc404191a33 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/setup.py @@ -0,0 +1,83 @@ +#!/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. +# -------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-managednetworkfabric" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace("-", ".") + +# Version extraction inspired from 'requests' +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +with open("CHANGELOG.md", encoding="utf-8") as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), + include_package_data=True, + package_data={ + "pytyped": ["py.typed"], + }, + install_requires=[ + "isodate<1.0.0,>=0.6.1", + "azure-common~=1.1", + "azure-mgmt-core>=1.3.2,<2.0.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", + ], + python_requires=">=3.7", +) diff --git a/sdk/managednetworkfabric/ci.yml b/sdk/managednetworkfabric/ci.yml new file mode 100644 index 000000000000..7b94a2e92ecc --- /dev/null +++ b/sdk/managednetworkfabric/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/managednetworkfabric/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/managednetworkfabric/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managednetworkfabric + TestProxy: true + Artifacts: + - name: azure-mgmt-managednetworkfabric + safeName: azuremgmtmanagednetworkfabric