From fb095c809457c14949de34265f5b5ac38af0e55b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 17 Nov 2023 02:36:22 +0000 Subject: [PATCH] CodeGen from PR 26730 in Azure/azure-rest-api-specs Merge 9834953ad3771d5d37debdea35d935933e69ac52 into df4c0dccbfb696b378dfef8c7e451dfa4b82b175 --- .../azure-mgmt-hybridnetwork/_meta.json | 10 +- .../mgmt/hybridnetwork/_configuration.py | 12 +- .../_hybrid_network_management_client.py | 111 +- .../mgmt/hybridnetwork/_serialization.py | 119 +- .../azure/mgmt/hybridnetwork/_vendor.py | 11 - .../azure/mgmt/hybridnetwork/_version.py | 2 +- .../mgmt/hybridnetwork/aio/_configuration.py | 12 +- .../aio/_hybrid_network_management_client.py | 112 +- .../hybridnetwork/aio/operations/__init__.py | 42 +- .../_artifact_manifests_operations.py | 1128 +++ ...ions.py => _artifact_stores_operations.py} | 624 +- ...perations.py => _components_operations.py} | 176 +- ..._configuration_group_schemas_operations.py | 999 +++ .../_configuration_group_values_operations.py | 802 ++ ...k_function_definition_groups_operations.py | 759 ++ ...function_definition_versions_operations.py | 1093 +++ .../_network_function_vendors_operations.py | 142 - .../_network_functions_operations.py | 111 +- ...twork_service_design_groups_operations.py} | 611 +- ...work_service_design_versions_operations.py | 1092 +++ .../aio/operations/_operations.py | 12 +- ...tions.py => _proxy_artifact_operations.py} | 555 +- ...perations.py => _publishers_operations.py} | 567 +- .../operations/_role_instances_operations.py | 620 -- .../_site_network_services_operations.py | 797 ++ ...ces_operations.py => _sites_operations.py} | 350 +- .../mgmt/hybridnetwork/models/__init__.py | 410 +- ..._hybrid_network_management_client_enums.py | 302 +- .../mgmt/hybridnetwork/models/_models_py3.py | 7019 +++++++++++++---- .../mgmt/hybridnetwork/operations/__init__.py | 42 +- .../_artifact_manifests_operations.py | 1443 ++++ ...ions.py => _artifact_stores_operations.py} | 741 +- ...perations.py => _components_operations.py} | 212 +- ..._configuration_group_schemas_operations.py | 1266 +++ .../_configuration_group_values_operations.py | 1009 +++ ...k_function_definition_groups_operations.py | 979 +++ ...function_definition_versions_operations.py | 1412 ++++ .../_network_function_vendors_operations.py | 172 - .../_network_functions_operations.py | 163 +- ...etwork_service_design_groups_operations.py | 978 +++ ...work_service_design_versions_operations.py | 1411 ++++ .../hybridnetwork/operations/_operations.py | 16 +- .../operations/_proxy_artifact_operations.py | 664 ++ .../operations/_publishers_operations.py | 988 +++ .../operations/_role_instances_operations.py | 790 -- ...y => _site_network_services_operations.py} | 502 +- .../operations/_sites_operations.py | 962 +++ .../_vendor_network_functions_operations.py | 585 -- .../_vendor_sku_preview_operations.py | 721 -- .../operations/_vendors_operations.py | 641 -- .../artifact_manifest_create.py | 52 + ...restart.py => artifact_manifest_delete.py} | 15 +- ...stance_get.py => artifact_manifest_get.py} | 14 +- ...rtifact_manifest_list_by_artifact_store.py | 43 + .../artifact_manifest_list_credential.py | 43 + .../artifact_manifest_update_state.py | 44 + .../artifact_manifest_update_tags.py | 44 + ...ice_create.py => artifact_store_create.py} | 18 +- .../artifact_store_delete.py | 41 + .../generated_samples/artifact_store_get.py | 42 + .../artifact_store_update_tags.py | 43 + ...artifact_stores_list_by_publisher_name.py} | 10 +- .../virtual_network_function_create.py | 55 + ...work_function_definition_version_create.py | 100 + ...work_function_definition_version_delete.py | 42 + ...network_function_definition_version_get.py | 43 + .../virtual_network_function_delete.py} | 11 +- .../virtual_network_function_get.py | 41 + .../virtual_network_function_create.py | 55 + ...work_function_definition_version_create.py | 100 + ...work_function_definition_version_delete.py | 42 + ...network_function_definition_version_get.py | 43 + .../virtual_network_function_delete.py | 40 + .../virtual_network_function_get.py} | 11 +- ...ku_list_credential.py => component_get.py} | 11 +- ... => component_list_by_network_function.py} | 9 +- .../configuration_group_schema_create.py | 49 + .../configuration_group_schema_delete.py | 41 + .../configuration_group_schema_get.py | 42 + ...ion_group_schema_list_by_publisher_name.py | 42 + .../configuration_group_schema_update_tags.py | 43 + ...ation_group_schema_version_update_state.py | 43 + .../configuration_group_value_create.py | 52 + ...configuration_group_value_create_secret.py | 52 + .../configuration_group_value_delete.py | 40 + ...guration_group_value_first_party_create.py | 52 + .../configuration_group_value_get.py | 41 + ...tion_group_value_list_by_resource_group.py | 41 + ...ration_group_value_list_by_subscription.py | 39 + .../configuration_group_value_update_tags.py | 42 + .../generated_samples/get_operations.py | 2 +- .../network_function_create.py | 56 +- .../network_function_create_secret.py | 59 + ...etwork_function_definition_group_create.py | 43 + ...twork_function_definition_group_delete.py} | 14 +- .../network_function_definition_group_get.py | 42 + ...k_function_definition_group_update_tags.py | 43 + ...efinition_groups_list_by_publisher_name.py | 42 + ...work_function_definition_version_create.py | 89 + ...work_function_definition_version_delete.py | 42 + ...network_function_definition_version_get.py | 43 + ...st_by_network_function_definition_group.py | 43 + ...unction_definition_version_update_state.py | 44 + ...function_definition_version_update_tags.py | 44 + .../network_function_delete.py | 5 +- .../network_function_first_party_create.py | 59 + .../generated_samples/network_function_get.py | 2 +- ...network_function_list_by_resource_group.py | 2 +- .../network_function_list_by_subscription.py | 2 +- .../network_function_update_tags.py | 2 +- ...ion_vendor_and_sku_list_by_subscription.py | 39 - .../network_functions_execute_request.py | 5 +- .../network_service_design_group_create.py | 43 + ...=> network_service_design_group_delete.py} | 14 +- .../network_service_design_group_get.py | 42 + ...etwork_service_design_group_update_tags.py | 43 + ...e_design_groups_list_by_publisher_name.py} | 11 +- .../network_service_design_version_create.py | 72 + .../network_service_design_version_delete.py | 42 + .../network_service_design_version_get.py | 43 + ...on_list_by_network_service_design_group.py | 43 + ...ork_service_design_version_update_state.py | 44 + ...work_service_design_version_update_tags.py | 44 + .../{vendor_create.py => publisher_create.py} | 9 +- .../{vendor_delete.py => publisher_delete.py} | 10 +- .../{vendor_sku_get.py => publisher_get.py} | 10 +- .../publisher_list_by_resource_group.py | 41 + ...n.py => publisher_list_by_subscription.py} | 6 +- ...vendor_get.py => publisher_update_tags.py} | 9 +- .../artifact_change_state.py | 45 + .../pure_proxy_artifact/artifact_get.py | 44 + .../pure_proxy_artifact/artifact_list.py | 43 + .../generated_samples/site_create.py | 63 + .../{device_delete.py => site_delete.py} | 9 +- .../{device_get.py => site_get.py} | 8 +- ...roup.py => site_list_by_resource_group.py} | 6 +- ...iption.py => site_list_by_subscription.py} | 6 +- .../site_network_service_create.py | 59 + .../site_network_service_delete.py | 40 + ...site_network_service_first_party_create.py | 59 + ...ion_key.py => site_network_service_get.py} | 8 +- ...network_service_list_by_resource_group.py} | 9 +- ...e_network_service_list_by_subscription.py} | 8 +- .../site_network_service_update_tags.py | 42 + ...ice_update_tags.py => site_update_tags.py} | 8 +- .../generated_samples/vendor_nf_create.py | 100 - .../generated_samples/vendor_sku_create.py | 122 - .../vendor_sku_preview_delete.py | 42 - .../vendor_sku_preview_get.py | 42 - .../vendor_sku_preview_list_by_sku.py | 42 - 150 files changed, 29723 insertions(+), 8258 deletions(-) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_manifests_operations.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/{_vendor_skus_operations.py => _artifact_stores_operations.py} (58%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/{_network_function_vendor_skus_operations.py => _components_operations.py} (50%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_schemas_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_values_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_groups_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_versions_operations.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/{_vendor_sku_preview_operations.py => _network_service_design_groups_operations.py} (52%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_versions_operations.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/{_vendor_network_functions_operations.py => _proxy_artifact_operations.py} (50%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/{_vendors_operations.py => _publishers_operations.py} (52%) delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_site_network_services_operations.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/{_devices_operations.py => _sites_operations.py} (72%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_manifests_operations.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/{_vendor_skus_operations.py => _artifact_stores_operations.py} (54%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/{_network_function_vendor_skus_operations.py => _components_operations.py} (52%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_schemas_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_values_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_groups_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_versions_operations.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_groups_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_versions_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_proxy_artifact_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_publishers_operations.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/{_devices_operations.py => _site_network_services_operations.py} (69%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_sites_operations.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_create.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{role_instance_restart.py => artifact_manifest_delete.py} (79%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{role_instance_get.py => artifact_manifest_get.py} (80%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_by_artifact_store.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_credential.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_state.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_tags.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_create.py => artifact_store_create.py} (73%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_update_tags.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{network_function_sku_details_get.py => artifact_stores_list_by_publisher_name.py} (82%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_get.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_sku_delete.py => azure_core/virtual_network_function_delete.py} (83%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_delete.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_nf_get.py => azure_operator_nexus/virtual_network_function_get.py} (83%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_sku_list_credential.py => component_get.py} (84%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{network_function_sku_list_by_vendor.py => component_list_by_network_function.py} (83%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_list_by_publisher_name.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_update_tags.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_version_update_state.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create_secret.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_first_party_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_resource_group.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_subscription.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_update_tags.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create_secret.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_create.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{role_instance_stop.py => network_function_definition_group_delete.py} (77%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_update_tags.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_groups_list_by_publisher_name.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_list_by_network_function_definition_group.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_state.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_tags.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_first_party_create.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_vendor_and_sku_list_by_subscription.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_create.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{role_instance_start.py => network_service_design_group_delete.py} (79%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_update_tags.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{role_instance_list_by_vendor_network_function.py => network_service_design_groups_list_by_publisher_name.py} (80%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_list_by_network_service_design_group.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_state.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_tags.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_create.py => publisher_create.py} (84%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_delete.py => publisher_delete.py} (85%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_sku_get.py => publisher_get.py} (86%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_resource_group.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_list_by_subscription.py => publisher_list_by_subscription.py} (87%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_get.py => publisher_update_tags.py} (85%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_change_state.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_get.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_list.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_create.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_delete.py => site_delete.py} (86%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_get.py => site_get.py} (88%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_list_by_resource_group.py => site_list_by_resource_group.py} (87%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_list_by_subscription.py => site_list_by_subscription.py} (87%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_create.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_delete.py create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_first_party_create.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_list_registration_key.py => site_network_service_get.py} (85%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_nf_list_by_vendor.py => site_network_service_list_by_resource_group.py} (83%) rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{vendor_sku_list_by_vendor.py => site_network_service_list_by_subscription.py} (85%) create mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_update_tags.py rename sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/{device_update_tags.py => site_update_tags.py} (87%) delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_create.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_create.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_delete.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_get.py delete mode 100644 sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_list_by_sku.py diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json index 0e845b9654aa..4225f7f7a616 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json @@ -1,11 +1,11 @@ { - "commit": "3ce1e043e2d0e57016437a3870f40e33da8a6397", + "commit": "ff27245b2c35d1ff2acdd4a099cc976097c6ac98", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hybridnetwork/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/hybridnetwork/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/hybridnetwork/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py index 6169ba20acc0..971507b84dcb 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class HybridNetworkManagementClientConfiguration(Configuration): # pylint: disa :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 "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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(HybridNetworkManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py index 16aefb2e1c55..2cb31e30ea47 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py @@ -16,16 +16,21 @@ from ._configuration import HybridNetworkManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - DevicesOperations, - NetworkFunctionVendorSkusOperations, - NetworkFunctionVendorsOperations, + ArtifactManifestsOperations, + ArtifactStoresOperations, + ComponentsOperations, + ConfigurationGroupSchemasOperations, + ConfigurationGroupValuesOperations, + NetworkFunctionDefinitionGroupsOperations, + NetworkFunctionDefinitionVersionsOperations, NetworkFunctionsOperations, + NetworkServiceDesignGroupsOperations, + NetworkServiceDesignVersionsOperations, Operations, - RoleInstancesOperations, - VendorNetworkFunctionsOperations, - VendorSkuPreviewOperations, - VendorSkusOperations, - VendorsOperations, + ProxyArtifactOperations, + PublishersOperations, + SiteNetworkServicesOperations, + SitesOperations, ) if TYPE_CHECKING: @@ -37,37 +42,52 @@ class HybridNetworkManagementClient: # pylint: disable=client-accepts-api-versi """The definitions in this swagger specification will be used to manage the Hybrid Network resources. - :ivar devices: DevicesOperations operations - :vartype devices: azure.mgmt.hybridnetwork.operations.DevicesOperations + :ivar configuration_group_schemas: ConfigurationGroupSchemasOperations operations + :vartype configuration_group_schemas: + azure.mgmt.hybridnetwork.operations.ConfigurationGroupSchemasOperations + :ivar configuration_group_values: ConfigurationGroupValuesOperations operations + :vartype configuration_group_values: + azure.mgmt.hybridnetwork.operations.ConfigurationGroupValuesOperations :ivar network_functions: NetworkFunctionsOperations operations :vartype network_functions: azure.mgmt.hybridnetwork.operations.NetworkFunctionsOperations - :ivar network_function_vendors: NetworkFunctionVendorsOperations operations - :vartype network_function_vendors: - azure.mgmt.hybridnetwork.operations.NetworkFunctionVendorsOperations - :ivar network_function_vendor_skus: NetworkFunctionVendorSkusOperations operations - :vartype network_function_vendor_skus: - azure.mgmt.hybridnetwork.operations.NetworkFunctionVendorSkusOperations + :ivar components: ComponentsOperations operations + :vartype components: azure.mgmt.hybridnetwork.operations.ComponentsOperations + :ivar network_function_definition_groups: NetworkFunctionDefinitionGroupsOperations operations + :vartype network_function_definition_groups: + azure.mgmt.hybridnetwork.operations.NetworkFunctionDefinitionGroupsOperations + :ivar network_function_definition_versions: NetworkFunctionDefinitionVersionsOperations + operations + :vartype network_function_definition_versions: + azure.mgmt.hybridnetwork.operations.NetworkFunctionDefinitionVersionsOperations + :ivar network_service_design_groups: NetworkServiceDesignGroupsOperations operations + :vartype network_service_design_groups: + azure.mgmt.hybridnetwork.operations.NetworkServiceDesignGroupsOperations + :ivar network_service_design_versions: NetworkServiceDesignVersionsOperations operations + :vartype network_service_design_versions: + azure.mgmt.hybridnetwork.operations.NetworkServiceDesignVersionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridnetwork.operations.Operations - :ivar vendors: VendorsOperations operations - :vartype vendors: azure.mgmt.hybridnetwork.operations.VendorsOperations - :ivar vendor_skus: VendorSkusOperations operations - :vartype vendor_skus: azure.mgmt.hybridnetwork.operations.VendorSkusOperations - :ivar vendor_sku_preview: VendorSkuPreviewOperations operations - :vartype vendor_sku_preview: azure.mgmt.hybridnetwork.operations.VendorSkuPreviewOperations - :ivar vendor_network_functions: VendorNetworkFunctionsOperations operations - :vartype vendor_network_functions: - azure.mgmt.hybridnetwork.operations.VendorNetworkFunctionsOperations - :ivar role_instances: RoleInstancesOperations operations - :vartype role_instances: azure.mgmt.hybridnetwork.operations.RoleInstancesOperations + :ivar publishers: PublishersOperations operations + :vartype publishers: azure.mgmt.hybridnetwork.operations.PublishersOperations + :ivar artifact_stores: ArtifactStoresOperations operations + :vartype artifact_stores: azure.mgmt.hybridnetwork.operations.ArtifactStoresOperations + :ivar artifact_manifests: ArtifactManifestsOperations operations + :vartype artifact_manifests: azure.mgmt.hybridnetwork.operations.ArtifactManifestsOperations + :ivar proxy_artifact: ProxyArtifactOperations operations + :vartype proxy_artifact: azure.mgmt.hybridnetwork.operations.ProxyArtifactOperations + :ivar sites: SitesOperations operations + :vartype sites: azure.mgmt.hybridnetwork.operations.SitesOperations + :ivar site_network_services: SiteNetworkServicesOperations operations + :vartype site_network_services: + azure.mgmt.hybridnetwork.operations.SiteNetworkServicesOperations :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 "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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. @@ -83,32 +103,45 @@ def __init__( self._config = HybridNetworkManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **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.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_group_schemas = ConfigurationGroupSchemasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.configuration_group_values = ConfigurationGroupValuesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.network_functions = NetworkFunctionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.network_function_vendors = NetworkFunctionVendorsOperations( + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_definition_groups = NetworkFunctionDefinitionGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_function_definition_versions = NetworkFunctionDefinitionVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_service_design_groups = NetworkServiceDesignGroupsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.network_function_vendor_skus = NetworkFunctionVendorSkusOperations( + self.network_service_design_versions = NetworkServiceDesignVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vendors = VendorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.vendor_skus = VendorSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.vendor_sku_preview = VendorSkuPreviewOperations( + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_stores = ArtifactStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_manifests = ArtifactManifestsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.vendor_network_functions = VendorNetworkFunctionsOperations( + self.proxy_artifact = ProxyArtifactOperations(self._client, self._config, self._serialize, self._deserialize) + self.sites = SitesOperations(self._client, self._config, self._serialize, self._deserialize) + self.site_network_services = SiteNetworkServicesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.role_instances = RoleInstancesOperations(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. @@ -139,5 +172,5 @@ def __enter__(self) -> "HybridNetworkManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_serialization.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_serialization.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - 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: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + 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): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): 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=False, **kwargs): + 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)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + 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: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + 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. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + 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 @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + 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: @@ -715,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # 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)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): 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) @@ -863,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -875,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -922,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(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 @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): 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) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # 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) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,7 @@ class Deserializer(object): 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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + 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 @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): 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 deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_vendor.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_vendor.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): 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: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_version.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_version.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_configuration.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_configuration.py index 1fade2cca7a0..dae7971f56d2 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_configuration.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class HybridNetworkManagementClientConfiguration(Configuration): # pylint: disa :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 "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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(HybridNetworkManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-01-01-preview"] = kwargs.pop("api_version", "2022-01-01-preview") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py index faeb2df7d4fd..8956dd34da6c 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py @@ -16,16 +16,21 @@ from .._serialization import Deserializer, Serializer from ._configuration import HybridNetworkManagementClientConfiguration from .operations import ( - DevicesOperations, - NetworkFunctionVendorSkusOperations, - NetworkFunctionVendorsOperations, + ArtifactManifestsOperations, + ArtifactStoresOperations, + ComponentsOperations, + ConfigurationGroupSchemasOperations, + ConfigurationGroupValuesOperations, + NetworkFunctionDefinitionGroupsOperations, + NetworkFunctionDefinitionVersionsOperations, NetworkFunctionsOperations, + NetworkServiceDesignGroupsOperations, + NetworkServiceDesignVersionsOperations, Operations, - RoleInstancesOperations, - VendorNetworkFunctionsOperations, - VendorSkuPreviewOperations, - VendorSkusOperations, - VendorsOperations, + ProxyArtifactOperations, + PublishersOperations, + SiteNetworkServicesOperations, + SitesOperations, ) if TYPE_CHECKING: @@ -37,37 +42,53 @@ class HybridNetworkManagementClient: # pylint: disable=client-accepts-api-versi """The definitions in this swagger specification will be used to manage the Hybrid Network resources. - :ivar devices: DevicesOperations operations - :vartype devices: azure.mgmt.hybridnetwork.aio.operations.DevicesOperations + :ivar configuration_group_schemas: ConfigurationGroupSchemasOperations operations + :vartype configuration_group_schemas: + azure.mgmt.hybridnetwork.aio.operations.ConfigurationGroupSchemasOperations + :ivar configuration_group_values: ConfigurationGroupValuesOperations operations + :vartype configuration_group_values: + azure.mgmt.hybridnetwork.aio.operations.ConfigurationGroupValuesOperations :ivar network_functions: NetworkFunctionsOperations operations :vartype network_functions: azure.mgmt.hybridnetwork.aio.operations.NetworkFunctionsOperations - :ivar network_function_vendors: NetworkFunctionVendorsOperations operations - :vartype network_function_vendors: - azure.mgmt.hybridnetwork.aio.operations.NetworkFunctionVendorsOperations - :ivar network_function_vendor_skus: NetworkFunctionVendorSkusOperations operations - :vartype network_function_vendor_skus: - azure.mgmt.hybridnetwork.aio.operations.NetworkFunctionVendorSkusOperations + :ivar components: ComponentsOperations operations + :vartype components: azure.mgmt.hybridnetwork.aio.operations.ComponentsOperations + :ivar network_function_definition_groups: NetworkFunctionDefinitionGroupsOperations operations + :vartype network_function_definition_groups: + azure.mgmt.hybridnetwork.aio.operations.NetworkFunctionDefinitionGroupsOperations + :ivar network_function_definition_versions: NetworkFunctionDefinitionVersionsOperations + operations + :vartype network_function_definition_versions: + azure.mgmt.hybridnetwork.aio.operations.NetworkFunctionDefinitionVersionsOperations + :ivar network_service_design_groups: NetworkServiceDesignGroupsOperations operations + :vartype network_service_design_groups: + azure.mgmt.hybridnetwork.aio.operations.NetworkServiceDesignGroupsOperations + :ivar network_service_design_versions: NetworkServiceDesignVersionsOperations operations + :vartype network_service_design_versions: + azure.mgmt.hybridnetwork.aio.operations.NetworkServiceDesignVersionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridnetwork.aio.operations.Operations - :ivar vendors: VendorsOperations operations - :vartype vendors: azure.mgmt.hybridnetwork.aio.operations.VendorsOperations - :ivar vendor_skus: VendorSkusOperations operations - :vartype vendor_skus: azure.mgmt.hybridnetwork.aio.operations.VendorSkusOperations - :ivar vendor_sku_preview: VendorSkuPreviewOperations operations - :vartype vendor_sku_preview: azure.mgmt.hybridnetwork.aio.operations.VendorSkuPreviewOperations - :ivar vendor_network_functions: VendorNetworkFunctionsOperations operations - :vartype vendor_network_functions: - azure.mgmt.hybridnetwork.aio.operations.VendorNetworkFunctionsOperations - :ivar role_instances: RoleInstancesOperations operations - :vartype role_instances: azure.mgmt.hybridnetwork.aio.operations.RoleInstancesOperations + :ivar publishers: PublishersOperations operations + :vartype publishers: azure.mgmt.hybridnetwork.aio.operations.PublishersOperations + :ivar artifact_stores: ArtifactStoresOperations operations + :vartype artifact_stores: azure.mgmt.hybridnetwork.aio.operations.ArtifactStoresOperations + :ivar artifact_manifests: ArtifactManifestsOperations operations + :vartype artifact_manifests: + azure.mgmt.hybridnetwork.aio.operations.ArtifactManifestsOperations + :ivar proxy_artifact: ProxyArtifactOperations operations + :vartype proxy_artifact: azure.mgmt.hybridnetwork.aio.operations.ProxyArtifactOperations + :ivar sites: SitesOperations operations + :vartype sites: azure.mgmt.hybridnetwork.aio.operations.SitesOperations + :ivar site_network_services: SiteNetworkServicesOperations operations + :vartype site_network_services: + azure.mgmt.hybridnetwork.aio.operations.SiteNetworkServicesOperations :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 "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-01". 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. @@ -83,32 +104,45 @@ def __init__( self._config = HybridNetworkManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **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.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_group_schemas = ConfigurationGroupSchemasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.configuration_group_values = ConfigurationGroupValuesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.network_functions = NetworkFunctionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.network_function_vendors = NetworkFunctionVendorsOperations( + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_definition_groups = NetworkFunctionDefinitionGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_function_definition_versions = NetworkFunctionDefinitionVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_service_design_groups = NetworkServiceDesignGroupsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.network_function_vendor_skus = NetworkFunctionVendorSkusOperations( + self.network_service_design_versions = NetworkServiceDesignVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vendors = VendorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.vendor_skus = VendorSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.vendor_sku_preview = VendorSkuPreviewOperations( + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_stores = ArtifactStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_manifests = ArtifactManifestsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.vendor_network_functions = VendorNetworkFunctionsOperations( + self.proxy_artifact = ProxyArtifactOperations(self._client, self._config, self._serialize, self._deserialize) + self.sites = SitesOperations(self._client, self._config, self._serialize, self._deserialize) + self.site_network_services = SiteNetworkServicesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.role_instances = RoleInstancesOperations(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. @@ -139,5 +173,5 @@ async def __aenter__(self) -> "HybridNetworkManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py index 934a7dba455c..03fe34722de3 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py @@ -6,32 +6,42 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._devices_operations import DevicesOperations +from ._configuration_group_schemas_operations import ConfigurationGroupSchemasOperations +from ._configuration_group_values_operations import ConfigurationGroupValuesOperations from ._network_functions_operations import NetworkFunctionsOperations -from ._network_function_vendors_operations import NetworkFunctionVendorsOperations -from ._network_function_vendor_skus_operations import NetworkFunctionVendorSkusOperations +from ._components_operations import ComponentsOperations +from ._network_function_definition_groups_operations import NetworkFunctionDefinitionGroupsOperations +from ._network_function_definition_versions_operations import NetworkFunctionDefinitionVersionsOperations +from ._network_service_design_groups_operations import NetworkServiceDesignGroupsOperations +from ._network_service_design_versions_operations import NetworkServiceDesignVersionsOperations from ._operations import Operations -from ._vendors_operations import VendorsOperations -from ._vendor_skus_operations import VendorSkusOperations -from ._vendor_sku_preview_operations import VendorSkuPreviewOperations -from ._vendor_network_functions_operations import VendorNetworkFunctionsOperations -from ._role_instances_operations import RoleInstancesOperations +from ._publishers_operations import PublishersOperations +from ._artifact_stores_operations import ArtifactStoresOperations +from ._artifact_manifests_operations import ArtifactManifestsOperations +from ._proxy_artifact_operations import ProxyArtifactOperations +from ._sites_operations import SitesOperations +from ._site_network_services_operations import SiteNetworkServicesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DevicesOperations", + "ConfigurationGroupSchemasOperations", + "ConfigurationGroupValuesOperations", "NetworkFunctionsOperations", - "NetworkFunctionVendorsOperations", - "NetworkFunctionVendorSkusOperations", + "ComponentsOperations", + "NetworkFunctionDefinitionGroupsOperations", + "NetworkFunctionDefinitionVersionsOperations", + "NetworkServiceDesignGroupsOperations", + "NetworkServiceDesignVersionsOperations", "Operations", - "VendorsOperations", - "VendorSkusOperations", - "VendorSkuPreviewOperations", - "VendorNetworkFunctionsOperations", - "RoleInstancesOperations", + "PublishersOperations", + "ArtifactStoresOperations", + "ArtifactManifestsOperations", + "ProxyArtifactOperations", + "SitesOperations", + "SiteNetworkServicesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_manifests_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_manifests_operations.py new file mode 100644 index 000000000000..ffa3fb70110a --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_manifests_operations.py @@ -0,0 +1,1128 @@ +# 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._artifact_manifests_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_artifact_store_request, + build_list_credential_request, + build_update_request, + build_update_state_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ArtifactManifestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`artifact_manifests` 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_by_artifact_store( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArtifactManifest"]: + """Gets information about the artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactManifest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :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.ArtifactManifestListResult] = 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_artifact_store_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_artifact_store.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("ArtifactManifestListResult", 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_artifact_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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) + + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_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, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifest, IO], + **kwargs: Any + ) -> _models.ArtifactManifest: + 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.ArtifactManifest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArtifactManifest") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("ArtifactManifest", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ArtifactManifest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: _models.ArtifactManifest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactManifest]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :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 ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactManifest]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: 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 ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactManifest]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. Is + either a ArtifactManifest type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifest 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 ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :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.ArtifactManifest] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + 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("ArtifactManifest", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> _models.ArtifactManifest: + """Gets information about a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :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.ArtifactManifest] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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("ArtifactManifest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactManifest: + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactManifest: + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: 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: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ArtifactManifest: + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :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.ArtifactManifest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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("ArtifactManifest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @distributed_trace_async + async def list_credential( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> _models.ArtifactAccessCredential: + """List credential for publishing artifacts defined in artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactAccessCredential or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactAccessCredential + :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.ArtifactAccessCredential] = kwargs.pop("cls", None) + + request = build_list_credential_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credential.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("ArtifactAccessCredential", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credential.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential" + } + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifestUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.ArtifactManifestUpdateState]: + 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.ArtifactManifestUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArtifactManifestUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("ArtifactManifestUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState" + } + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: _models.ArtifactManifestUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactManifestUpdateState]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState + :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 ArtifactManifestUpdateState or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactManifestUpdateState]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: 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 ArtifactManifestUpdateState or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifestUpdateState, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactManifestUpdateState]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Is either a + ArtifactManifestUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState 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 ArtifactManifestUpdateState or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState] + :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.ArtifactManifestUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + 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("ArtifactManifestUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_stores_operations.py similarity index 58% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_skus_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_stores_operations.py index 99d8a224f2b2..fb35722bf37e 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_skus_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_artifact_stores_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,30 +31,26 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._vendor_skus_operations import ( +from ...operations._artifact_stores_operations import ( build_create_or_update_request, build_delete_request, build_get_request, - build_list_credential_request, - build_list_request, + build_list_by_publisher_request, + build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VendorSkusOperations: +class ArtifactStoresOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`vendor_skus` attribute. + :attr:`artifact_stores` attribute. """ models = _models @@ -66,8 +62,100 @@ def __init__(self, *args, **kwargs) -> None: 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ArtifactStore"]: + """Gets information of the ArtifactStores under publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactStore or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ArtifactStore] + :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.ArtifactStoreListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("ArtifactStoreListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores" + } + async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, vendor_name: str, sku_name: str, **kwargs: Any + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -80,14 +168,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -97,33 +184,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } @distributed_trace_async - async def begin_delete(self, vendor_name: str, sku_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the specified sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str + async def begin_delete( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_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 @@ -139,17 +235,16 @@ async def begin_delete(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -180,75 +275,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" - } - - @distributed_trace_async - async def get(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _models.VendorSku: - """Gets information about the specified sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VendorSku or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.VendorSku - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorSku] = kwargs.pop("cls", None) - - request = build_get_request( - vendor_name=vendor_name, - sku_name=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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VendorSku", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } async def _create_or_update_initial( - self, vendor_name: str, sku_name: str, parameters: Union[_models.VendorSku, IO], **kwargs: Any - ) -> _models.VendorSku: + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: Union[_models.ArtifactStore, IO], + **kwargs: Any + ) -> _models.ArtifactStore: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -260,23 +297,22 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VendorSku] = kwargs.pop("cls", None) + cls: ClsType[_models.ArtifactStore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VendorSku") + _json = self._serialize.body(parameters, "ArtifactStore") request = build_create_or_update_request( - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -289,8 +325,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,10 +338,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VendorSku", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VendorSku", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -312,28 +349,32 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } @overload async def begin_create_or_update( self, - vendor_name: str, - sku_name: str, - parameters: _models.VendorSku, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: _models.ArtifactStore, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VendorSku]: - """Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :param parameters: Parameters supplied to the create or update sku operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorSku + ) -> AsyncLROPoller[_models.ArtifactStore]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactStore :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -345,24 +386,34 @@ async def begin_create_or_update( :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 VendorSku or the result of + :return: An instance of AsyncLROPoller that returns either ArtifactStore or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.VendorSku] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactStore] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( - self, vendor_name: str, sku_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VendorSku]: - """Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :param parameters: Parameters supplied to the create or update sku operation. Required. + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactStore]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -375,26 +426,33 @@ async def begin_create_or_update( :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 VendorSku or the result of + :return: An instance of AsyncLROPoller that returns either ArtifactStore or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.VendorSku] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactStore] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, vendor_name: str, sku_name: str, parameters: Union[_models.VendorSku, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.VendorSku]: - """Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :param parameters: Parameters supplied to the create or update sku operation. Is either a model - type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorSku or IO + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: Union[_models.ArtifactStore, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ArtifactStore]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. Is + either a ArtifactStore type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactStore or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -406,26 +464,25 @@ async def begin_create_or_update( :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 VendorSku or the result of + :return: An instance of AsyncLROPoller that returns either ArtifactStore or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.VendorSku] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ArtifactStore] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VendorSku] = kwargs.pop("cls", None) + cls: ClsType[_models.ArtifactStore] = 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_or_update_initial( - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -437,7 +494,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VendorSku", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -461,28 +518,27 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } - @distributed_trace - def list(self, vendor_name: str, **kwargs: Any) -> AsyncIterable["_models.VendorSku"]: - """Lists all the skus of a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str + @distributed_trace_async + async def get( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> _models.ArtifactStore: + """Gets information about the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VendorSku or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.VendorSku] + :return: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorSkuListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -491,77 +547,139 @@ def list(self, vendor_name: str, **kwargs: Any) -> AsyncIterable["_models.Vendor } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_request( - vendor_name=vendor_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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactStore] = kwargs.pop("cls", None) - 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 + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_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) - async def extract_data(pipeline_response): - deserialized = self._deserialize("VendorSkuListResult", 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) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - 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("ArtifactStore", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return AsyncItemPaged(get_next, extract_data) + return deserialized - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } - @distributed_trace_async - async def list_credential(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _models.SkuCredential: - """Generate credentials for publishing SKU images. + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactStore: + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore + :raises ~azure.core.exceptions.HttpResponseError: + """ - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactStore: + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. + :type parameters: 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: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ArtifactStore: + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: SkuCredential or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.SkuCredential + :return: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -572,28 +690,40 @@ async def list_credential(self, vendor_name: str, sku_name: str, **kwargs: Any) } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.SkuCredential] = kwargs.pop("cls", None) + 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.ArtifactStore] = kwargs.pop("cls", None) - request = build_list_credential_request( - vendor_name=vendor_name, - sku_name=sku_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_credential.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,13 +733,13 @@ async def list_credential(self, vendor_name: str, sku_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuCredential", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_credential.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/listCredential" + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_components_operations.py similarity index 50% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendor_skus_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_components_operations.py index 11a5c2cc89df..ae13b6b7b919 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendor_skus_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_components_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -23,32 +22,26 @@ 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_function_vendor_skus_operations import ( - build_list_by_sku_request, - build_list_by_vendor_request, -) +from ...operations._components_operations import build_get_request, build_list_by_network_function_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class NetworkFunctionVendorSkusOperations: +class ComponentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`network_function_vendor_skus` attribute. + :attr:`components` attribute. """ models = _models @@ -60,25 +53,24 @@ def __init__(self, *args, **kwargs) -> None: 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_by_vendor(self, vendor_name: str, **kwargs: Any) -> AsyncIterable["_models.SkuOverview"]: - """Lists all network function vendor sku details in a vendor. - - :param vendor_name: The name of the network function vendor. Required. - :type vendor_name: str + @distributed_trace_async + async def get( + self, resource_group_name: str, network_function_name: str, component_name: str, **kwargs: Any + ) -> _models.Component: + """Gets information about the specified application instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_function_name: The name of the network function. Required. + :type network_function_name: str + :param component_name: The name of the component. Required. + :type component_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SkuOverview or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.SkuOverview] + :return: Component or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Component :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionSkuListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -87,90 +79,69 @@ def list_by_vendor(self, vendor_name: str, **kwargs: Any) -> AsyncIterable["_mod } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_vendor_request( - vendor_name=vendor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_vendor.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Component] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + component_name=component_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) - async def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkFunctionSkuListResult", 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) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - 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("Component", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return AsyncItemPaged(get_next, extract_data) + return deserialized - list_by_vendor.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}" } @distributed_trace - def list_by_sku( - self, vendor_name: str, vendor_sku_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NetworkFunctionSkuRoleDetails"]: - """Lists information about network function vendor sku details. - - :param vendor_name: The name of the network function vendor. Required. - :type vendor_name: str - :param vendor_sku_name: The name of the network function sku. Required. - :type vendor_sku_name: str + def list_by_network_function( + self, resource_group_name: str, network_function_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Component"]: + """Lists all the component resources in a network function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_function_name: The name of the network function. Required. + :type network_function_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkFunctionSkuRoleDetails or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionSkuRoleDetails] + :return: An iterator like instance of either Component or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Component] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionSkuDetails] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -183,12 +154,12 @@ def list_by_sku( def prepare_request(next_link=None): if not next_link: - request = build_list_by_sku_request( - vendor_name=vendor_name, - vendor_sku_name=vendor_sku_name, + request = build_list_by_network_function_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_sku.metadata["url"], + template_url=self.list_by_network_function.metadata["url"], headers=_headers, params=_params, ) @@ -214,7 +185,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkFunctionSkuDetails", pipeline_response) + deserialized = self._deserialize("ComponentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -223,8 +194,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,6 +209,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_sku.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus/{vendorSkuName}" + list_by_network_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_schemas_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_schemas_operations.py new file mode 100644 index 000000000000..e154fcef64b3 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_schemas_operations.py @@ -0,0 +1,999 @@ +# 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._configuration_group_schemas_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_publisher_request, + build_update_request, + build_update_state_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConfigurationGroupSchemasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`configuration_group_schemas` 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationGroupSchema"]: + """Gets information of the configuration group schemas under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupSchema or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :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.ConfigurationGroupSchemaListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("ConfigurationGroupSchemaListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_name: str, configuration_group_schema_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, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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) + + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, publisher_name: str, configuration_group_schema_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_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, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchema, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + 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.ConfigurationGroupSchema] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ConfigurationGroupSchema") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("ConfigurationGroupSchema", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConfigurationGroupSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: _models.ConfigurationGroupSchema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupSchema]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :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 ConfigurationGroupSchema or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupSchema]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. Required. + :type parameters: 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 ConfigurationGroupSchema or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchema, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupSchema]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. Is either a ConfigurationGroupSchema type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema 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 ConfigurationGroupSchema or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :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.ConfigurationGroupSchema] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + 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("ConfigurationGroupSchema", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, publisher_name: str, configuration_group_schema_name: str, **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Gets information about the specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :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.ConfigurationGroupSchema] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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("ConfigurationGroupSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: 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: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :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.ConfigurationGroupSchema] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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("ConfigurationGroupSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchemaVersionUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.ConfigurationGroupSchemaVersionUpdateState]: + 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.ConfigurationGroupSchemaVersionUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ConfigurationGroupSchemaVersionUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("ConfigurationGroupSchemaVersionUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState" + } + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: _models.ConfigurationGroupSchemaVersionUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupSchemaVersionUpdateState]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState + :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 + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupSchemaVersionUpdateState]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. + Required. + :type parameters: 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 + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchemaVersionUpdateState, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupSchemaVersionUpdateState]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. Is + either a ConfigurationGroupSchemaVersionUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState + 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 + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :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.ConfigurationGroupSchemaVersionUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + 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("ConfigurationGroupSchemaVersionUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_values_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_values_operations.py new file mode 100644 index 000000000000..6aa9939dc5ab --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_configuration_group_values_operations.py @@ -0,0 +1,802 @@ +# 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._configuration_group_values_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConfigurationGroupValuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`configuration_group_values` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, configuration_group_value_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, + configuration_group_value_name=configuration_group_value_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) + + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, configuration_group_value_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_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, + configuration_group_value_name=configuration_group_value_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.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, configuration_group_value_name: str, **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Gets information about the specified hybrid configuration group values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :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.ConfigurationGroupValue] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_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("ConfigurationGroupValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: Union[_models.ConfigurationGroupValue, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + 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.ConfigurationGroupValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ConfigurationGroupValue") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("ConfigurationGroupValue", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConfigurationGroupValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: _models.ConfigurationGroupValue, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupValue]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :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 ConfigurationGroupValue or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupValue]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. Required. + :type parameters: 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 ConfigurationGroupValue or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: Union[_models.ConfigurationGroupValue, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationGroupValue]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. Is either a ConfigurationGroupValue type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue 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 ConfigurationGroupValue or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :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.ConfigurationGroupValue] = 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_or_update_initial( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + parameters=parameters, + 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("ConfigurationGroupValue", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. Required. + :type parameters: 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: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :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.ConfigurationGroupValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("ConfigurationGroupValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ConfigurationGroupValue"]: + """Lists all sites in the configuration group value in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupValue or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :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.ConfigurationGroupValueListResult] = 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("ConfigurationGroupValueListResult", 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.HybridNetwork/configurationGroupValues" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationGroupValue"]: + """Lists all the hybrid network configurationGroupValues in a 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 ConfigurationGroupValue or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :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.ConfigurationGroupValueListResult] = 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("ConfigurationGroupValueListResult", 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.HybridNetwork/configurationGroupValues" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_groups_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_groups_operations.py new file mode 100644 index 000000000000..2baa04c5649b --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_groups_operations.py @@ -0,0 +1,759 @@ +# 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_function_definition_groups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_publisher_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkFunctionDefinitionGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`network_function_definition_groups` 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionDefinitionGroup"]: + """Gets information of the network function definition groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :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.NetworkFunctionDefinitionGroupListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("NetworkFunctionDefinitionGroupListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_name: str, network_function_definition_group_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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) + + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, publisher_name: str, network_function_definition_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: Union[_models.NetworkFunctionDefinitionGroup, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + 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.NetworkFunctionDefinitionGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkFunctionDefinitionGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkFunctionDefinitionGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkFunctionDefinitionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: _models.NetworkFunctionDefinitionGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionGroup]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :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 NetworkFunctionDefinitionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionGroup]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: 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 NetworkFunctionDefinitionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: Union[_models.NetworkFunctionDefinitionGroup, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionGroup]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Is either a NetworkFunctionDefinitionGroup type or a IO type. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup 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 NetworkFunctionDefinitionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :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.NetworkFunctionDefinitionGroup] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + parameters=parameters, + 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("NetworkFunctionDefinitionGroup", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, publisher_name: str, network_function_definition_group_name: str, **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Gets information about the specified networkFunctionDefinition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :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.NetworkFunctionDefinitionGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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("NetworkFunctionDefinitionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: 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: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :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.NetworkFunctionDefinitionGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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("NetworkFunctionDefinitionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_versions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_versions_operations.py new file mode 100644 index 000000000000..4371041c7ba4 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_definition_versions_operations.py @@ -0,0 +1,1093 @@ +# 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_function_definition_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_network_function_definition_group_request, + build_update_request, + build_update_state_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkFunctionDefinitionVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`network_function_definition_versions` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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) + + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersion, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + 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.NetworkFunctionDefinitionVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkFunctionDefinitionVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkFunctionDefinitionVersion", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkFunctionDefinitionVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: _models.NetworkFunctionDefinitionVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionVersion]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :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 NetworkFunctionDefinitionVersion or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionVersion]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: 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 NetworkFunctionDefinitionVersion or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionVersion]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Is either a NetworkFunctionDefinitionVersion type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion 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 NetworkFunctionDefinitionVersion or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :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.NetworkFunctionDefinitionVersion] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + 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("NetworkFunctionDefinitionVersion", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Gets information about a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :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.NetworkFunctionDefinitionVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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("NetworkFunctionDefinitionVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: 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: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :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.NetworkFunctionDefinitionVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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("NetworkFunctionDefinitionVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @distributed_trace + def list_by_network_function_definition_group( + self, resource_group_name: str, publisher_name: str, network_function_definition_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionDefinitionVersion"]: + """Gets information about a list of network function definition versions under a network function + definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_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 NetworkFunctionDefinitionVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :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.NetworkFunctionDefinitionVersionListResult] = 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_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_function_definition_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("NetworkFunctionDefinitionVersionListResult", 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_network_function_definition_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions" + } + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersionUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.NetworkFunctionDefinitionVersionUpdateState]: + 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.NetworkFunctionDefinitionVersionUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkFunctionDefinitionVersionUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("NetworkFunctionDefinitionVersionUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState" + } + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: _models.NetworkFunctionDefinitionVersionUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionVersionUpdateState]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState + :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 + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionVersionUpdateState]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. Required. + :type parameters: 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 + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersionUpdateState, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkFunctionDefinitionVersionUpdateState]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. Is either a NetworkFunctionDefinitionVersionUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState + 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 + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :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.NetworkFunctionDefinitionVersionUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + 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("NetworkFunctionDefinitionVersionUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py deleted file mode 100644 index cb56c8283b0c..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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._network_function_vendors_operations import build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NetworkFunctionVendorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`network_function_vendors` 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.NetworkFunctionVendor"]: - """Lists all the available vendor and sku information. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkFunctionVendor or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionVendor] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionVendorListResult] = 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( - 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("NetworkFunctionVendorListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/networkFunctionVendors"} diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py index ccd2f4ed40ee..c81bda5f15ed 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,9 +78,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -99,8 +93,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,8 +105,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}" @@ -121,8 +120,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements async def begin_delete( self, resource_group_name: str, network_function_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes the specified network function resource. This operation can take up to 1 hour to - complete. This is expected service behavior. + """Deletes the specified network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -144,9 +142,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -213,9 +209,7 @@ async def get(self, resource_group_name: str, network_function_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkFunction] = kwargs.pop("cls", None) request = build_get_request( @@ -230,8 +224,9 @@ async def get(self, resource_group_name: str, network_function_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,16 +265,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.NetworkFunction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NetworkFunction") @@ -299,8 +292,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,8 +329,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NetworkFunction]: - """Creates or updates a network function resource. This operation can take up to 6 hours to - complete. This is expected service behavior. + """Creates or updates a network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -373,8 +366,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.NetworkFunction]: - """Creates or updates a network function resource. This operation can take up to 6 hours to - complete. This is expected service behavior. + """Creates or updates a network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -409,8 +401,7 @@ async def begin_create_or_update( parameters: Union[_models.NetworkFunction, IO], **kwargs: Any ) -> AsyncLROPoller[_models.NetworkFunction]: - """Creates or updates a network function resource. This operation can take up to 6 hours to - complete. This is expected service behavior. + """Creates or updates a network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -418,7 +409,7 @@ async def begin_create_or_update( :param network_function_name: Resource name for the network function resource. Required. :type network_function_name: str :param parameters: Parameters supplied in the body to the create or update network function - operation. Is either a model type or a IO type. Required. + operation. Is either a NetworkFunction type or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunction or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -439,9 +430,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.NetworkFunction] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -561,7 +550,7 @@ async def update_tags( :param network_function_name: Resource name for the network function resource. Required. :type network_function_name: str :param parameters: Parameters supplied to the update network function tags operation. Is either - a model type or a IO type. Required. + a TagsObject type or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -582,16 +571,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.NetworkFunction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -611,8 +598,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -646,9 +634,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.NetworkF _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkFunctionListResult] = kwargs.pop("cls", None) error_map = { @@ -700,8 +686,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -736,9 +723,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkFunctionListResult] = kwargs.pop("cls", None) error_map = { @@ -791,8 +776,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -827,16 +813,14 @@ async def _execute_request_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ExecuteRequestParameters") @@ -856,8 +840,9 @@ async def _execute_request_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -867,8 +852,12 @@ async def _execute_request_initial( # pylint: disable=inconsistent-return-state 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, {}) + return cls(pipeline_response, None, response_headers) _execute_request_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest" @@ -884,7 +873,7 @@ async def begin_execute_request( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a request to services on a network function. + """Execute a request to services on a containerized network function. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -919,7 +908,7 @@ async def begin_execute_request( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a request to services on a network function. + """Execute a request to services on a containerized network function. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -952,15 +941,15 @@ async def begin_execute_request( parameters: Union[_models.ExecuteRequestParameters, IO], **kwargs: Any ) -> AsyncLROPoller[None]: - """Execute a request to services on a network function. + """Execute a request to services on a containerized network function. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param network_function_name: The name of the network function. Required. :type network_function_name: str - :param parameters: Payload for execute request post call. Is either a model type or a IO type. - Required. + :param parameters: Payload for execute request post call. Is either a ExecuteRequestParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.ExecuteRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -980,9 +969,7 @@ async def begin_execute_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_sku_preview_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_groups_operations.py similarity index 52% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_sku_preview_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_groups_operations.py index 6e22aea34613..11affc1b7ca9 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_sku_preview_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_groups_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,29 +31,26 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._vendor_sku_preview_operations import ( +from ...operations._network_service_design_groups_operations import ( build_create_or_update_request, build_delete_request, build_get_request, - build_list_request, + build_list_by_publisher_request, + build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VendorSkuPreviewOperations: +class NetworkServiceDesignGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`vendor_sku_preview` attribute. + :attr:`network_service_design_groups` attribute. """ models = _models @@ -66,26 +63,28 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, vendor_name: str, sku_name: str, **kwargs: Any) -> AsyncIterable["_models.PreviewSubscription"]: - """Lists all the preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str + def list_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkServiceDesignGroup"]: + """Gets information of the network service design groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PreviewSubscription or the result of cls(response) + :return: An iterator like instance of either NetworkServiceDesignGroup or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.PreviewSubscription] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PreviewSubscriptionsList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkServiceDesignGroupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,12 +97,12 @@ def list(self, vendor_name: str, sku_name: str, **kwargs: Any) -> AsyncIterable[ def prepare_request(next_link=None): if not next_link: - request = build_list_request( - vendor_name=vendor_name, - sku_name=sku_name, + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list_by_publisher.metadata["url"], headers=_headers, params=_params, ) @@ -129,7 +128,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("PreviewSubscriptionsList", pipeline_response) + deserialized = self._deserialize("NetworkServiceDesignGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -138,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,18 +152,143 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions" + list_by_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_name: str, network_service_design_group_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_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) + + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, publisher_name: str, network_service_design_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" } async def _create_or_update_initial( self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: Union[_models.PreviewSubscription, IO], + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: Union[_models.NetworkServiceDesignGroup, IO], **kwargs: Any - ) -> _models.PreviewSubscription: + ) -> _models.NetworkServiceDesignGroup: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -175,24 +300,22 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PreviewSubscription] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkServiceDesignGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "PreviewSubscription") + _json = self._serialize.body(parameters, "NetworkServiceDesignGroup") request = build_create_or_update_request( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -205,8 +328,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,10 +341,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("PreviewSubscription", pipeline_response) + deserialized = self._deserialize("NetworkServiceDesignGroup", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("PreviewSubscription", pipeline_response) + deserialized = self._deserialize("NetworkServiceDesignGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -228,31 +352,33 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" } @overload async def begin_create_or_update( self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: _models.PreviewSubscription, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: _models.NetworkServiceDesignGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PreviewSubscription]: - """Creates or updates preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :param parameters: Parameters supplied to the create or update vendor preview subscription - operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.PreviewSubscription + ) -> AsyncLROPoller[_models.NetworkServiceDesignGroup]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -264,34 +390,36 @@ async def begin_create_or_update( :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 PreviewSubscription or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either NetworkServiceDesignGroup or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.PreviewSubscription] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( self, - vendor_name: str, - sku_name: str, - preview_subscription: str, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PreviewSubscription]: - """Creates or updates preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :param parameters: Parameters supplied to the create or update vendor preview subscription - operation. Required. + ) -> AsyncLROPoller[_models.NetworkServiceDesignGroup]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -304,33 +432,35 @@ async def begin_create_or_update( :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 PreviewSubscription or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either NetworkServiceDesignGroup or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.PreviewSubscription] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: Union[_models.PreviewSubscription, IO], + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: Union[_models.NetworkServiceDesignGroup, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.PreviewSubscription]: - """Creates or updates preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :param parameters: Parameters supplied to the create or update vendor preview subscription - operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.PreviewSubscription or IO + ) -> AsyncLROPoller[_models.NetworkServiceDesignGroup]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Is either a NetworkServiceDesignGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -342,28 +472,26 @@ async def begin_create_or_update( :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 PreviewSubscription or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either NetworkServiceDesignGroup or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.PreviewSubscription] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PreviewSubscription] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkServiceDesignGroup] = 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_or_update_initial( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -375,7 +503,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PreviewSubscription", pipeline_response) + deserialized = self._deserialize("NetworkServiceDesignGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -399,24 +527,26 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" } @distributed_trace_async async def get( - self, vendor_name: str, sku_name: str, preview_subscription: str, **kwargs: Any - ) -> _models.PreviewSubscription: - """Gets the preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str + self, resource_group_name: str, publisher_name: str, network_service_design_group_name: str, **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Gets information about the specified networkServiceDesign group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PreviewSubscription or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.PreviewSubscription + :return: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -430,15 +560,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PreviewSubscription] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkServiceDesignGroup] = kwargs.pop("cls", None) request = build_get_request( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -448,8 +576,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,7 +588,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreviewSubscription", pipeline_response) + deserialized = self._deserialize("NetworkServiceDesignGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -467,12 +596,105 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" } - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, vendor_name: str, sku_name: str, preview_subscription: str, **kwargs: Any - ) -> None: + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: 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: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -481,113 +703,56 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.NetworkServiceDesignGroup] = kwargs.pop("cls", None) - request = build_delete_request( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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) - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" - } + deserialized = self._deserialize("NetworkServiceDesignGroup", pipeline_response) - @distributed_trace_async - async def begin_delete( - self, vendor_name: str, sku_name: str, preview_subscription: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: Literal["2022-01-01-preview"] = 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 - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, - 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 cls: + return cls(pipeline_response, 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 + return deserialized - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_versions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_versions_operations.py new file mode 100644 index 000000000000..abd80bbc7dec --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_service_design_versions_operations.py @@ -0,0 +1,1092 @@ +# 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_service_design_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_network_service_design_group_request, + build_update_request, + build_update_state_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkServiceDesignVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`network_service_design_versions` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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) + + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersion, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + 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.NetworkServiceDesignVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkServiceDesignVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkServiceDesignVersion", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkServiceDesignVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: _models.NetworkServiceDesignVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkServiceDesignVersion]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :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 NetworkServiceDesignVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkServiceDesignVersion]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: 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 NetworkServiceDesignVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkServiceDesignVersion]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Is either a NetworkServiceDesignVersion type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion 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 NetworkServiceDesignVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :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.NetworkServiceDesignVersion] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + 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("NetworkServiceDesignVersion", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Gets information about a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :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.NetworkServiceDesignVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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("NetworkServiceDesignVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: 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: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :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.NetworkServiceDesignVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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("NetworkServiceDesignVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @distributed_trace + def list_by_network_service_design_group( + self, resource_group_name: str, publisher_name: str, network_service_design_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkServiceDesignVersion"]: + """Gets information about a list of network service design versions under a network service design + group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_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 NetworkServiceDesignVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :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.NetworkServiceDesignVersionListResult] = 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_network_service_design_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_service_design_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("NetworkServiceDesignVersionListResult", 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_network_service_design_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions" + } + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersionUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.NetworkServiceDesignVersionUpdateState]: + 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.NetworkServiceDesignVersionUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkServiceDesignVersionUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("NetworkServiceDesignVersionUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState" + } + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: _models.NetworkServiceDesignVersionUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkServiceDesignVersionUpdateState]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState + :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 + NetworkServiceDesignVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkServiceDesignVersionUpdateState]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + Required. + :type parameters: 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 + NetworkServiceDesignVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersionUpdateState, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkServiceDesignVersionUpdateState]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + Is either a NetworkServiceDesignVersionUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState 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 + NetworkServiceDesignVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState] + :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.NetworkServiceDesignVersionUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + 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("NetworkServiceDesignVersionUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py index f44eb9ac55fb..4b20d347ca6e 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_proxy_artifact_operations.py similarity index 50% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_network_functions_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_proxy_artifact_operations.py index 2d81e28fcb88..1104d09b6dd1 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_network_functions_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_proxy_artifact_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,28 +31,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._vendor_network_functions_operations import ( - build_create_or_update_request, - build_get_request, - build_list_request, -) +from ...operations._proxy_artifact_operations import build_get_request, build_list_request, build_update_state_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VendorNetworkFunctionsOperations: +class ProxyArtifactOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`vendor_network_functions` attribute. + :attr:`proxy_artifact` attribute. """ models = _models @@ -64,24 +56,32 @@ def __init__(self, *args, **kwargs) -> None: 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, location_name: str, vendor_name: str, service_key: str, **kwargs: Any - ) -> _models.VendorNetworkFunction: - """Gets information about the specified vendor network function. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str + @distributed_trace + def list( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ProxyArtifactListOverview"]: + """Lists all the available artifacts in the parent Artifact Store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VendorNetworkFunction or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.VendorNetworkFunction + :return: An iterator like instance of either ProxyArtifactListOverview or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ProxyArtifactListOverview] :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.ProxyArtifactOverviewListResult] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -90,57 +90,179 @@ async def get( } 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, + publisher_name=publisher_name, + artifact_store_name=artifact_store_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("ProxyArtifactOverviewListResult", 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts" + } + + @distributed_trace + def get( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, artifact_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ProxyArtifactVersionsListOverview"]: + """Get a Artifact overview information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactVersionsListOverview or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] + :raises ~azure.core.exceptions.HttpResponseError: + """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorNetworkFunction] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProxyArtifactVersionsOverviewListResult] = kwargs.pop("cls", None) - request = build_get_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - 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) + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + artifact_name=artifact_name, + 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) - 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) + 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("ProxyArtifactVersionsOverviewListResult", 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) - deserialized = self._deserialize("VendorNetworkFunction", pipeline_response) + async def get_next(next_link=None): + request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, {}) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized + 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) get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions" } - async def _create_or_update_initial( + async def _update_state_initial( self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: Union[_models.VendorNetworkFunction, IO], + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: Union[_models.ArtifactChangeState, IO], **kwargs: Any - ) -> _models.VendorNetworkFunction: + ) -> Optional[_models.ProxyArtifactVersionsListOverview]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -152,86 +274,93 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VendorNetworkFunction] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.ProxyArtifactVersionsListOverview]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VendorNetworkFunction") + _json = self._serialize.body(parameters, "ArtifactChangeState") - request = build_create_or_update_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_version_name=artifact_version_name, subscription_id=self._config.subscription_id, + artifact_name=artifact_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._update_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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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("VendorNetworkFunction", pipeline_response) + deserialized = self._deserialize("ProxyArtifactVersionsListOverview", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VendorNetworkFunction", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" + _update_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}" } @overload - async def begin_create_or_update( + async def begin_update_state( self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: _models.VendorNetworkFunction, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: _models.ArtifactChangeState, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VendorNetworkFunction]: - """Creates or updates a vendor network function. This operation can take up to 6 hours to - complete. This is expected service behavior. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param parameters: Parameters supplied to the create or update vendor network function - operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorNetworkFunction + ) -> AsyncLROPoller[_models.ProxyArtifactVersionsListOverview]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. Required. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactChangeState :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -243,36 +372,40 @@ async def begin_create_or_update( :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 VendorNetworkFunction or the result - of cls(response) + :return: An instance of AsyncLROPoller that returns either ProxyArtifactVersionsListOverview or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_update_state( self, - location_name: str, - vendor_name: str, - service_key: str, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VendorNetworkFunction]: - """Creates or updates a vendor network function. This operation can take up to 6 hours to - complete. This is expected service behavior. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param parameters: Parameters supplied to the create or update vendor network function - operation. Required. + ) -> AsyncLROPoller[_models.ProxyArtifactVersionsListOverview]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. Required. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -285,35 +418,40 @@ async def begin_create_or_update( :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 VendorNetworkFunction or the result - of cls(response) + :return: An instance of AsyncLROPoller that returns either ProxyArtifactVersionsListOverview or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_update_state( self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: Union[_models.VendorNetworkFunction, IO], + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: Union[_models.ArtifactChangeState, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.VendorNetworkFunction]: - """Creates or updates a vendor network function. This operation can take up to 6 hours to - complete. This is expected service behavior. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param parameters: Parameters supplied to the create or update vendor network function - operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorNetworkFunction or IO + ) -> AsyncLROPoller[_models.ProxyArtifactVersionsListOverview]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. Required. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Is either a + ArtifactChangeState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactChangeState or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -325,28 +463,28 @@ async def begin_create_or_update( :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 VendorNetworkFunction or the result - of cls(response) + :return: An instance of AsyncLROPoller that returns either ProxyArtifactVersionsListOverview or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VendorNetworkFunction] = kwargs.pop("cls", None) + cls: ClsType[_models.ProxyArtifactVersionsListOverview] = 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_or_update_initial( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, + raw_result = await self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_name=artifact_name, + artifact_version_name=artifact_version_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -358,15 +496,14 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VendorNetworkFunction", pipeline_response) + deserialized = self._deserialize("ProxyArtifactVersionsListOverview", 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), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -381,106 +518,6 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" - } - - @distributed_trace - def list( - self, location_name: str, vendor_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.VendorNetworkFunction"]: - """Lists all the vendor network function sub resources in an Azure region, filtered by skuType, - skuName, vendorProvisioningState. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param filter: The filter to apply on the operation. The properties you can use for eq (equals) - are: skuType, skuName and vendorProvisioningState. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VendorNetworkFunction or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorNetworkFunctionListResult] = 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( - location_name=location_name, - vendor_name=vendor_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("VendorNetworkFunctionListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions" + begin_update_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_publishers_operations.py similarity index 52% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendors_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_publishers_operations.py index b2cb5e112c1a..d1a36b3bebb1 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendors_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_publishers_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,29 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._vendors_operations import ( +from ...operations._publishers_operations import ( build_create_or_update_request, build_delete_request, build_get_request, + build_list_by_resource_group_request, build_list_by_subscription_request, + build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VendorsOperations: +class PublishersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`vendors` attribute. + :attr:`publishers` attribute. """ models = _models @@ -65,8 +63,178 @@ def __init__(self, *args, **kwargs) -> None: 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Publisher"]: + """Lists all the publishers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Publisher] + :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.PublisherListResult] = 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("PublisherListResult", 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.HybridNetwork/publishers" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Publisher"]: + """Lists all the publishers in a 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 Publisher or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Publisher] + :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.PublisherListResult] = 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("PublisherListResult", 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.HybridNetwork/publishers" + } + async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, vendor_name: str, **kwargs: Any + self, resource_group_name: str, publisher_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -79,13 +247,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( - vendor_name=vendor_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -95,30 +262,38 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" } @distributed_trace_async - async def begin_delete(self, vendor_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the specified vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str + async def begin_delete(self, resource_group_name: str, publisher_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_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 @@ -134,16 +309,15 @@ async def begin_delete(self, vendor_name: str, **kwargs: Any) -> AsyncLROPoller[ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 - vendor_name=vendor_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -174,18 +348,21 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" } @distributed_trace_async - async def get(self, vendor_name: str, **kwargs: Any) -> _models.Vendor: - """Gets information about the specified vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str + async def get(self, resource_group_name: str, publisher_name: str, **kwargs: Any) -> _models.Publisher: + """Gets information about the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vendor or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Vendor + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -199,13 +376,12 @@ async def get(self, vendor_name: str, **kwargs: Any) -> _models.Vendor: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Vendor] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Publisher] = kwargs.pop("cls", None) request = build_get_request( - vendor_name=vendor_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -215,8 +391,9 @@ async def get(self, vendor_name: str, **kwargs: Any) -> _models.Vendor: 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,18 +403,24 @@ async def get(self, vendor_name: str, **kwargs: Any) -> _models.Vendor: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Vendor", pipeline_response) + deserialized = self._deserialize("Publisher", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}"} + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" + } async def _create_or_update_initial( - self, vendor_name: str, parameters: Optional[Union[_models.Vendor, IO]] = None, **kwargs: Any - ) -> _models.Vendor: + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[Union[_models.Publisher, IO]] = None, + **kwargs: Any + ) -> _models.Publisher: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -249,25 +432,24 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Vendor] = kwargs.pop("cls", None) + cls: ClsType[_models.Publisher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: - _json = self._serialize.body(parameters, "Vendor") + _json = self._serialize.body(parameters, "Publisher") else: _json = None request = build_create_or_update_request( - vendor_name=vendor_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -280,8 +462,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -292,10 +475,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Vendor", pipeline_response) + deserialized = self._deserialize("Publisher", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Vendor", pipeline_response) + deserialized = self._deserialize("Publisher", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,24 +486,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" } @overload async def begin_create_or_update( self, - vendor_name: str, - parameters: Optional[_models.Vendor] = None, + resource_group_name: str, + publisher_name: str, + parameters: Optional[_models.Publisher] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Vendor]: - """Creates or updates a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param parameters: Parameters supplied to the create vendor operation. Default value is None. - :type parameters: ~azure.mgmt.hybridnetwork.models.Vendor + ) -> AsyncLROPoller[_models.Publisher]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: ~azure.mgmt.hybridnetwork.models.Publisher :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -332,26 +520,31 @@ async def begin_create_or_update( :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 Vendor or the result of + :return: An instance of AsyncLROPoller that returns either Publisher or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Vendor] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Publisher] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( self, - vendor_name: str, + resource_group_name: str, + publisher_name: str, parameters: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Vendor]: - """Creates or updates a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param parameters: Parameters supplied to the create vendor operation. Default value is None. + ) -> AsyncLROPoller[_models.Publisher]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -364,23 +557,30 @@ async def begin_create_or_update( :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 Vendor or the result of + :return: An instance of AsyncLROPoller that returns either Publisher or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Vendor] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Publisher] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, vendor_name: str, parameters: Optional[Union[_models.Vendor, IO]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.Vendor]: - """Creates or updates a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param parameters: Parameters supplied to the create vendor operation. Is either a model type - or a IO type. Default value is None. - :type parameters: ~azure.mgmt.hybridnetwork.models.Vendor or IO + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[Union[_models.Publisher, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Publisher]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Is either a Publisher + type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.hybridnetwork.models.Publisher or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -392,25 +592,24 @@ async def begin_create_or_update( :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 Vendor or the result of + :return: An instance of AsyncLROPoller that returns either Publisher or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Vendor] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Publisher] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Vendor] = kwargs.pop("cls", None) + cls: ClsType[_models.Publisher] = 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_or_update_initial( - vendor_name=vendor_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -422,7 +621,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Vendor", pipeline_response) + deserialized = self._deserialize("Publisher", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -446,26 +645,93 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" } - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Vendor"]: - """Lists all the vendors in a subscription. - + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[_models.TagsObject] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Publisher: + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: An iterator like instance of either Vendor or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Vendor] + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorListResult] = kwargs.pop("cls", None) + @overload + async def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Publisher: + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: 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: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[Union[_models.TagsObject, IO]] = None, + **kwargs: Any + ) -> _models.Publisher: + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Is either a + TagsObject type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -474,59 +740,58 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Vendor"] } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - 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) + 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.Publisher] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "TagsObject") 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 + _json = None - async def extract_data(pipeline_response): - deserialized = self._deserialize("VendorListResult", 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) + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_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) - 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 + ) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response + 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) + 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 + deserialized = self._deserialize("Publisher", pipeline_response) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors"} + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py deleted file mode 100644 index 38378c46f085..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py +++ /dev/null @@ -1,620 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast -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._role_instances_operations import ( - build_get_request, - build_list_request, - build_restart_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RoleInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`role_instances` 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 _start_initial( # pylint: disable=inconsistent-return-statements - self, location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start" - } - - @distributed_trace_async - async def begin_start( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts a role instance of a vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_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: Literal["2022-01-01-preview"] = 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._start_initial( # type: ignore - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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_start.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start" - } - - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_stop_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop" - } - - @distributed_trace_async - async def begin_stop( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Powers off (stop) a role instance of a vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_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: Literal["2022-01-01-preview"] = 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._stop_initial( # type: ignore - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop" - } - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_restart_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._restart_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart" - } - - @distributed_trace_async - async def begin_restart( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts a role instance of a vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_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: Literal["2022-01-01-preview"] = 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._restart_initial( # type: ignore - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart" - } - - @distributed_trace_async - async def get( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> _models.RoleInstance: - """Gets the information of role instance of vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleInstance or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.RoleInstance - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.RoleInstance] = kwargs.pop("cls", None) - - request = build_get_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleInstance", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}" - } - - @distributed_trace - def list( - self, location_name: str, vendor_name: str, service_key: str, **kwargs: Any - ) -> AsyncIterable["_models.RoleInstance"]: - """Lists the information of role instances of vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleInstance or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.RoleInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionRoleInstanceListResult] = 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( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - 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("NetworkFunctionRoleInstanceListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances" - } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_site_network_services_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_site_network_services_operations.py new file mode 100644 index 000000000000..207cc7612ad4 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_site_network_services_operations.py @@ -0,0 +1,797 @@ +# 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._site_network_services_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SiteNetworkServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s + :attr:`site_network_services` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, site_network_service_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, + site_network_service_name=site_network_service_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) + + 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, site_network_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified site network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_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, + site_network_service_name=site_network_service_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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, site_network_service_name: str, **kwargs: Any + ) -> _models.SiteNetworkService: + """Gets information about the specified site network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService + :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.SiteNetworkService] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_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("SiteNetworkService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: Union[_models.SiteNetworkService, IO], + **kwargs: Any + ) -> _models.SiteNetworkService: + 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.SiteNetworkService] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SiteNetworkService") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("SiteNetworkService", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SiteNetworkService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: _models.SiteNetworkService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SiteNetworkService]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.SiteNetworkService + :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 SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.SiteNetworkService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SiteNetworkService]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + Required. + :type parameters: 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 SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.SiteNetworkService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: Union[_models.SiteNetworkService, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SiteNetworkService]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + Is either a SiteNetworkService type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.SiteNetworkService 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 SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.SiteNetworkService] + :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.SiteNetworkService] = 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_or_update_initial( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + parameters=parameters, + 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("SiteNetworkService", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SiteNetworkService: + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SiteNetworkService: + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. Required. + :type parameters: 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: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.SiteNetworkService: + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService + :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.SiteNetworkService] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("SiteNetworkService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SiteNetworkService"]: + """Lists all sites in the network service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteNetworkService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.SiteNetworkService] + :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.SiteNetworkServiceListResult] = 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("SiteNetworkServiceListResult", 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.HybridNetwork/siteNetworkServices" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SiteNetworkService"]: + """Lists all site network services. + + :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 SiteNetworkService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.SiteNetworkService] + :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.SiteNetworkServiceListResult] = 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("SiteNetworkServiceListResult", 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.HybridNetwork/siteNetworkServices" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_devices_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_sites_operations.py similarity index 72% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_devices_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_sites_operations.py index 1083f7473ce8..33beadd717dc 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_devices_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_sites_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,32 +31,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._devices_operations import ( +from ...operations._sites_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, - build_list_registration_key_request, build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DevicesOperations: +class SitesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.aio.HybridNetworkManagementClient`'s - :attr:`devices` attribute. + :attr:`sites` attribute. """ models = _models @@ -69,7 +64,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, device_name: str, **kwargs: Any + self, resource_group_name: str, site_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -82,14 +77,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, - device_name=device_name, + site_name=site_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -99,33 +92,38 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" } @distributed_trace_async - async def begin_delete(self, resource_group_name: str, device_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the specified device. + async def begin_delete(self, resource_group_name: str, site_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str + :param site_name: The name of the network service site. Required. + :type site_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 @@ -141,9 +139,7 @@ async def begin_delete(self, resource_group_name: str, device_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -151,7 +147,7 @@ async def begin_delete(self, resource_group_name: str, device_name: str, **kwarg if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - device_name=device_name, + site_name=site_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -182,21 +178,21 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" } @distributed_trace_async - async def get(self, resource_group_name: str, device_name: str, **kwargs: Any) -> _models.Device: - """Gets information about the specified device. + async def get(self, resource_group_name: str, site_name: str, **kwargs: Any) -> _models.Site: + """Gets information about the specified network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -210,14 +206,12 @@ async def get(self, resource_group_name: str, device_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Site] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - device_name=device_name, + site_name=site_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -227,8 +221,9 @@ async def get(self, resource_group_name: str, device_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,7 +233,7 @@ async def get(self, resource_group_name: str, device_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -246,12 +241,12 @@ async def get(self, resource_group_name: str, device_name: str, **kwargs: Any) - return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" } async def _create_or_update_initial( - self, resource_group_name: str, device_name: str, parameters: Union[_models.Device, IO], **kwargs: Any - ) -> _models.Device: + self, resource_group_name: str, site_name: str, parameters: Union[_models.Site, IO], **kwargs: Any + ) -> _models.Site: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -263,23 +258,21 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Site] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "Device") + _json = self._serialize.body(parameters, "Site") request = build_create_or_update_request( resource_group_name=resource_group_name, - device_name=device_name, + site_name=site_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -292,8 +285,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,10 +298,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -315,28 +309,29 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - device_name: str, - parameters: _models.Device, + site_name: str, + parameters: _models.Site, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: - """Creates or updates a device. + ) -> AsyncLROPoller[_models.Site]: + """Creates or updates a network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: Resource name for the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the create or update device operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.Device + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.Site :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -348,9 +343,8 @@ async def begin_create_or_update( :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 Device or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Device] + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -358,20 +352,21 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - device_name: str, + site_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: - """Creates or updates a device. + ) -> AsyncLROPoller[_models.Site]: + """Creates or updates a network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: Resource name for the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the create or update device operation. Required. + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. + Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -384,26 +379,25 @@ async def begin_create_or_update( :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 Device or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Device] + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, device_name: str, parameters: Union[_models.Device, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: - """Creates or updates a device. + self, resource_group_name: str, site_name: str, parameters: Union[_models.Site, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Site]: + """Creates or updates a network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: Resource name for the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the create or update device operation. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.Device or IO + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. Is + either a Site type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.Site or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -415,26 +409,23 @@ async def begin_create_or_update( :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 Device or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Device] + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridnetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Site] = 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_or_update_initial( resource_group_name=resource_group_name, - device_name=device_name, + site_name=site_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -446,7 +437,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -470,34 +461,34 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" } @overload async def update_tags( self, resource_group_name: str, - device_name: str, + site_name: str, parameters: _models.TagsObject, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Device: - """Updates device tags. + ) -> _models.Site: + """Updates a site update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the update device tags operation. Required. + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject :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: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ @@ -505,50 +496,50 @@ async def update_tags( async def update_tags( self, resource_group_name: str, - device_name: str, + site_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Device: - """Updates device tags. + ) -> _models.Site: + """Updates a site update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the update device tags operation. Required. + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. Required. :type parameters: 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: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def update_tags( - self, resource_group_name: str, device_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any - ) -> _models.Device: - """Updates device tags. + self, resource_group_name: str, site_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Site: + """Updates a site update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the update device tags operation. Is either a model - type or a IO type. Required. + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. Is either a TagsObject type + or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -562,23 +553,21 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Site] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( resource_group_name=resource_group_name, - device_name=device_name, + site_name=site_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -591,8 +580,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -602,7 +592,7 @@ async def update_tags( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -610,25 +600,23 @@ async def update_tags( return deserialized update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Device"]: - """Lists all the devices in a subscription. + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Site"]: + """Lists all sites in the network service in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Device or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Device] + :return: An iterator like instance of either Site or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DeviceListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SiteListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -670,7 +658,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeviceListResult", pipeline_response) + deserialized = self._deserialize("SiteListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -679,8 +667,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,27 +682,25 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices"} + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites"} @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Device"]: - """Lists all the device resource in a resource group. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Site"]: + """Lists all sites in the network service. :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 Device or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Device] + :return: An iterator like instance of either Site or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridnetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DeviceListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SiteListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -756,7 +743,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeviceListResult", pipeline_response) + deserialized = self._deserialize("SiteListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -765,8 +752,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -780,71 +768,5 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices" - } - - @distributed_trace_async - async def list_registration_key( - self, resource_group_name: str, device_name: str, **kwargs: Any - ) -> _models.DeviceRegistrationKey: - """List the registration key for the device. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeviceRegistrationKey or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.DeviceRegistrationKey - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DeviceRegistrationKey] = kwargs.pop("cls", None) - - request = build_list_registration_key_request( - resource_group_name=resource_group_name, - device_name=device_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_registration_key.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeviceRegistrationKey", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_registration_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}/listRegistrationKey" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py index 7184c99ca20d..e3a4ed4c908d 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py @@ -6,160 +6,362 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AzureStackEdgeFormat -from ._models_py3 import CustomProfile -from ._models_py3 import DataDisk -from ._models_py3 import Device -from ._models_py3 import DeviceListResult -from ._models_py3 import DevicePropertiesFormat -from ._models_py3 import DeviceRegistrationKey +from ._models_py3 import ArmResourceDefinitionResourceElementTemplate +from ._models_py3 import ArmResourceDefinitionResourceElementTemplateDetails +from ._models_py3 import ArmTemplateArtifactProfile +from ._models_py3 import ArmTemplateMappingRuleProfile +from ._models_py3 import ArtifactAccessCredential +from ._models_py3 import ArtifactChangeState +from ._models_py3 import ArtifactChangeStateProperties +from ._models_py3 import ArtifactManifest +from ._models_py3 import ArtifactManifestListResult +from ._models_py3 import ArtifactManifestPropertiesFormat +from ._models_py3 import ArtifactManifestUpdateState +from ._models_py3 import ArtifactProfile +from ._models_py3 import ArtifactStore +from ._models_py3 import ArtifactStoreListResult +from ._models_py3 import ArtifactStorePropertiesFormat +from ._models_py3 import ArtifactStorePropertiesFormatManagedResourceGroupConfiguration +from ._models_py3 import AzureArcK8SClusterNFVIDetails +from ._models_py3 import AzureArcKubernetesArtifactProfile +from ._models_py3 import AzureArcKubernetesDeployMappingRuleProfile +from ._models_py3 import AzureArcKubernetesHelmApplication +from ._models_py3 import AzureArcKubernetesNetworkFunctionApplication +from ._models_py3 import AzureArcKubernetesNetworkFunctionTemplate +from ._models_py3 import AzureContainerRegistryScopedTokenCredential +from ._models_py3 import AzureCoreArmTemplateArtifactProfile +from ._models_py3 import AzureCoreArmTemplateDeployMappingRuleProfile +from ._models_py3 import AzureCoreNFVIDetails +from ._models_py3 import AzureCoreNetworkFunctionApplication +from ._models_py3 import AzureCoreNetworkFunctionArmTemplateApplication +from ._models_py3 import AzureCoreNetworkFunctionTemplate +from ._models_py3 import AzureCoreNetworkFunctionVhdApplication +from ._models_py3 import AzureCoreVhdImageArtifactProfile +from ._models_py3 import AzureCoreVhdImageDeployMappingRuleProfile +from ._models_py3 import AzureOperatorNexusArmTemplateArtifactProfile +from ._models_py3 import AzureOperatorNexusArmTemplateDeployMappingRuleProfile +from ._models_py3 import AzureOperatorNexusClusterNFVIDetails +from ._models_py3 import AzureOperatorNexusImageArtifactProfile +from ._models_py3 import AzureOperatorNexusImageDeployMappingRuleProfile +from ._models_py3 import AzureOperatorNexusNetworkFunctionApplication +from ._models_py3 import AzureOperatorNexusNetworkFunctionArmTemplateApplication +from ._models_py3 import AzureOperatorNexusNetworkFunctionImageApplication +from ._models_py3 import AzureOperatorNexusNetworkFunctionTemplate +from ._models_py3 import AzureStorageAccountContainerCredential +from ._models_py3 import AzureStorageAccountCredential +from ._models_py3 import Component +from ._models_py3 import ComponentListResult +from ._models_py3 import ComponentProperties +from ._models_py3 import ConfigurationGroupSchema +from ._models_py3 import ConfigurationGroupSchemaListResult +from ._models_py3 import ConfigurationGroupSchemaPropertiesFormat +from ._models_py3 import ConfigurationGroupSchemaVersionUpdateState +from ._models_py3 import ConfigurationGroupValue +from ._models_py3 import ConfigurationGroupValueListResult +from ._models_py3 import ConfigurationGroupValuePropertiesFormat +from ._models_py3 import ConfigurationValueWithSecrets +from ._models_py3 import ConfigurationValueWithoutSecrets +from ._models_py3 import ContainerizedNetworkFunctionDefinitionVersion +from ._models_py3 import ContainerizedNetworkFunctionTemplate +from ._models_py3 import CustomLocationResourceId +from ._models_py3 import DaemonSet +from ._models_py3 import DependsOnProfile +from ._models_py3 import Deployment +from ._models_py3 import DeploymentResourceIdReference +from ._models_py3 import DeploymentStatusProperties from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import ExecuteRequestParameters -from ._models_py3 import ImageReference -from ._models_py3 import LinuxConfiguration +from ._models_py3 import HelmArtifactProfile +from ._models_py3 import HelmInstallOptions +from ._models_py3 import HelmMappingRuleProfile +from ._models_py3 import HelmMappingRuleProfileOptions +from ._models_py3 import HelmUpgradeOptions +from ._models_py3 import ImageArtifactProfile +from ._models_py3 import ImageMappingRuleProfile +from ._models_py3 import ManagedResourceGroupConfiguration +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import ManifestArtifactFormat +from ._models_py3 import MappingRuleProfile +from ._models_py3 import NFVIs +from ._models_py3 import NSDArtifactProfile from ._models_py3 import NetworkFunction +from ._models_py3 import NetworkFunctionApplication +from ._models_py3 import NetworkFunctionDefinitionGroup +from ._models_py3 import NetworkFunctionDefinitionGroupListResult +from ._models_py3 import NetworkFunctionDefinitionGroupPropertiesFormat +from ._models_py3 import NetworkFunctionDefinitionResourceElementTemplateDetails +from ._models_py3 import NetworkFunctionDefinitionVersion +from ._models_py3 import NetworkFunctionDefinitionVersionListResult +from ._models_py3 import NetworkFunctionDefinitionVersionPropertiesFormat +from ._models_py3 import NetworkFunctionDefinitionVersionUpdateState from ._models_py3 import NetworkFunctionListResult -from ._models_py3 import NetworkFunctionRoleConfiguration -from ._models_py3 import NetworkFunctionRoleInstanceListResult -from ._models_py3 import NetworkFunctionSkuDetails -from ._models_py3 import NetworkFunctionSkuListResult -from ._models_py3 import NetworkFunctionSkuRoleDetails -from ._models_py3 import NetworkFunctionTemplate -from ._models_py3 import NetworkFunctionUserConfiguration -from ._models_py3 import NetworkFunctionUserConfigurationOsProfile -from ._models_py3 import NetworkFunctionVendor -from ._models_py3 import NetworkFunctionVendorConfiguration -from ._models_py3 import NetworkFunctionVendorListResult -from ._models_py3 import NetworkInterface -from ._models_py3 import NetworkInterfaceIPConfiguration +from ._models_py3 import NetworkFunctionPropertiesFormat +from ._models_py3 import NetworkFunctionValueWithSecrets +from ._models_py3 import NetworkFunctionValueWithoutSecrets +from ._models_py3 import NetworkServiceDesignGroup +from ._models_py3 import NetworkServiceDesignGroupListResult +from ._models_py3 import NetworkServiceDesignGroupPropertiesFormat +from ._models_py3 import NetworkServiceDesignVersion +from ._models_py3 import NetworkServiceDesignVersionListResult +from ._models_py3 import NetworkServiceDesignVersionPropertiesFormat +from ._models_py3 import NetworkServiceDesignVersionUpdateState +from ._models_py3 import NfviDetails +from ._models_py3 import OpenDeploymentResourceReference from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult -from ._models_py3 import OsDisk -from ._models_py3 import OsProfile -from ._models_py3 import PreviewSubscription -from ._models_py3 import PreviewSubscriptionsList +from ._models_py3 import Pod +from ._models_py3 import PodEvent +from ._models_py3 import ProxyArtifactListOverview +from ._models_py3 import ProxyArtifactOverview +from ._models_py3 import ProxyArtifactOverviewListResult +from ._models_py3 import ProxyArtifactOverviewPropertiesFormat +from ._models_py3 import ProxyArtifactOverviewPropertiesValue +from ._models_py3 import ProxyArtifactVersionsListOverview +from ._models_py3 import ProxyArtifactVersionsOverviewListResult from ._models_py3 import ProxyResource +from ._models_py3 import Publisher +from ._models_py3 import PublisherListResult +from ._models_py3 import PublisherPropertiesFormat +from ._models_py3 import ReferencedResource +from ._models_py3 import ReplicaSet from ._models_py3 import RequestMetadata from ._models_py3 import Resource -from ._models_py3 import RoleInstance -from ._models_py3 import SkuCredential -from ._models_py3 import SkuOverview -from ._models_py3 import SshConfiguration -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageProfile -from ._models_py3 import SubResource +from ._models_py3 import ResourceElementTemplate +from ._models_py3 import Resources +from ._models_py3 import SecretDeploymentResourceReference +from ._models_py3 import Site +from ._models_py3 import SiteListResult +from ._models_py3 import SiteNetworkService +from ._models_py3 import SiteNetworkServiceListResult +from ._models_py3 import SiteNetworkServicePropertiesFormat +from ._models_py3 import SitePropertiesFormat +from ._models_py3 import Sku +from ._models_py3 import StatefulSet from ._models_py3 import SystemData from ._models_py3 import TagsObject from ._models_py3 import TrackedResource -from ._models_py3 import Vendor -from ._models_py3 import VendorListResult -from ._models_py3 import VendorNetworkFunction -from ._models_py3 import VendorNetworkFunctionListResult -from ._models_py3 import VendorSku -from ._models_py3 import VendorSkuListResult -from ._models_py3 import VirtualHardDisk +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VhdImageArtifactProfile +from ._models_py3 import VhdImageMappingRuleProfile +from ._models_py3 import VirtualNetworkFunctionDefinitionVersion +from ._models_py3 import VirtualNetworkFunctionTemplate from ._hybrid_network_management_client_enums import ActionType +from ._hybrid_network_management_client_enums import ApplicationEnablement +from ._hybrid_network_management_client_enums import ArtifactManifestState +from ._hybrid_network_management_client_enums import ArtifactReplicationStrategy +from ._hybrid_network_management_client_enums import ArtifactState +from ._hybrid_network_management_client_enums import ArtifactStoreType +from ._hybrid_network_management_client_enums import ArtifactType +from ._hybrid_network_management_client_enums import AzureArcKubernetesArtifactType +from ._hybrid_network_management_client_enums import AzureCoreArtifactType +from ._hybrid_network_management_client_enums import AzureOperatorNexusArtifactType +from ._hybrid_network_management_client_enums import ConfigurationGenerationType +from ._hybrid_network_management_client_enums import ConfigurationGroupValueConfigurationType +from ._hybrid_network_management_client_enums import ContainerizedNetworkFunctionNFVIType from ._hybrid_network_management_client_enums import CreatedByType -from ._hybrid_network_management_client_enums import DeviceType -from ._hybrid_network_management_client_enums import DiskCreateOptionTypes +from ._hybrid_network_management_client_enums import CredentialType from ._hybrid_network_management_client_enums import HttpMethod -from ._hybrid_network_management_client_enums import IPAllocationMethod -from ._hybrid_network_management_client_enums import IPVersion -from ._hybrid_network_management_client_enums import NetworkFunctionRoleConfigurationType +from ._hybrid_network_management_client_enums import IdType +from ._hybrid_network_management_client_enums import ManagedServiceIdentityType +from ._hybrid_network_management_client_enums import NFVIType +from ._hybrid_network_management_client_enums import NetworkFunctionConfigurationType from ._hybrid_network_management_client_enums import NetworkFunctionType -from ._hybrid_network_management_client_enums import OperatingSystemTypes -from ._hybrid_network_management_client_enums import OperationalState from ._hybrid_network_management_client_enums import Origin +from ._hybrid_network_management_client_enums import PodEventType +from ._hybrid_network_management_client_enums import PodStatus from ._hybrid_network_management_client_enums import ProvisioningState -from ._hybrid_network_management_client_enums import SkuDeploymentMode -from ._hybrid_network_management_client_enums import SkuType +from ._hybrid_network_management_client_enums import PublisherScope +from ._hybrid_network_management_client_enums import SkuName +from ._hybrid_network_management_client_enums import SkuTier from ._hybrid_network_management_client_enums import Status -from ._hybrid_network_management_client_enums import VMSwitchType -from ._hybrid_network_management_client_enums import VendorProvisioningState -from ._hybrid_network_management_client_enums import VirtualMachineSizeTypes +from ._hybrid_network_management_client_enums import TemplateType +from ._hybrid_network_management_client_enums import Type +from ._hybrid_network_management_client_enums import VersionState +from ._hybrid_network_management_client_enums import VirtualNetworkFunctionNFVIType from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AzureStackEdgeFormat", - "CustomProfile", - "DataDisk", - "Device", - "DeviceListResult", - "DevicePropertiesFormat", - "DeviceRegistrationKey", + "ArmResourceDefinitionResourceElementTemplate", + "ArmResourceDefinitionResourceElementTemplateDetails", + "ArmTemplateArtifactProfile", + "ArmTemplateMappingRuleProfile", + "ArtifactAccessCredential", + "ArtifactChangeState", + "ArtifactChangeStateProperties", + "ArtifactManifest", + "ArtifactManifestListResult", + "ArtifactManifestPropertiesFormat", + "ArtifactManifestUpdateState", + "ArtifactProfile", + "ArtifactStore", + "ArtifactStoreListResult", + "ArtifactStorePropertiesFormat", + "ArtifactStorePropertiesFormatManagedResourceGroupConfiguration", + "AzureArcK8SClusterNFVIDetails", + "AzureArcKubernetesArtifactProfile", + "AzureArcKubernetesDeployMappingRuleProfile", + "AzureArcKubernetesHelmApplication", + "AzureArcKubernetesNetworkFunctionApplication", + "AzureArcKubernetesNetworkFunctionTemplate", + "AzureContainerRegistryScopedTokenCredential", + "AzureCoreArmTemplateArtifactProfile", + "AzureCoreArmTemplateDeployMappingRuleProfile", + "AzureCoreNFVIDetails", + "AzureCoreNetworkFunctionApplication", + "AzureCoreNetworkFunctionArmTemplateApplication", + "AzureCoreNetworkFunctionTemplate", + "AzureCoreNetworkFunctionVhdApplication", + "AzureCoreVhdImageArtifactProfile", + "AzureCoreVhdImageDeployMappingRuleProfile", + "AzureOperatorNexusArmTemplateArtifactProfile", + "AzureOperatorNexusArmTemplateDeployMappingRuleProfile", + "AzureOperatorNexusClusterNFVIDetails", + "AzureOperatorNexusImageArtifactProfile", + "AzureOperatorNexusImageDeployMappingRuleProfile", + "AzureOperatorNexusNetworkFunctionApplication", + "AzureOperatorNexusNetworkFunctionArmTemplateApplication", + "AzureOperatorNexusNetworkFunctionImageApplication", + "AzureOperatorNexusNetworkFunctionTemplate", + "AzureStorageAccountContainerCredential", + "AzureStorageAccountCredential", + "Component", + "ComponentListResult", + "ComponentProperties", + "ConfigurationGroupSchema", + "ConfigurationGroupSchemaListResult", + "ConfigurationGroupSchemaPropertiesFormat", + "ConfigurationGroupSchemaVersionUpdateState", + "ConfigurationGroupValue", + "ConfigurationGroupValueListResult", + "ConfigurationGroupValuePropertiesFormat", + "ConfigurationValueWithSecrets", + "ConfigurationValueWithoutSecrets", + "ContainerizedNetworkFunctionDefinitionVersion", + "ContainerizedNetworkFunctionTemplate", + "CustomLocationResourceId", + "DaemonSet", + "DependsOnProfile", + "Deployment", + "DeploymentResourceIdReference", + "DeploymentStatusProperties", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "ExecuteRequestParameters", - "ImageReference", - "LinuxConfiguration", + "HelmArtifactProfile", + "HelmInstallOptions", + "HelmMappingRuleProfile", + "HelmMappingRuleProfileOptions", + "HelmUpgradeOptions", + "ImageArtifactProfile", + "ImageMappingRuleProfile", + "ManagedResourceGroupConfiguration", + "ManagedServiceIdentity", + "ManifestArtifactFormat", + "MappingRuleProfile", + "NFVIs", + "NSDArtifactProfile", "NetworkFunction", + "NetworkFunctionApplication", + "NetworkFunctionDefinitionGroup", + "NetworkFunctionDefinitionGroupListResult", + "NetworkFunctionDefinitionGroupPropertiesFormat", + "NetworkFunctionDefinitionResourceElementTemplateDetails", + "NetworkFunctionDefinitionVersion", + "NetworkFunctionDefinitionVersionListResult", + "NetworkFunctionDefinitionVersionPropertiesFormat", + "NetworkFunctionDefinitionVersionUpdateState", "NetworkFunctionListResult", - "NetworkFunctionRoleConfiguration", - "NetworkFunctionRoleInstanceListResult", - "NetworkFunctionSkuDetails", - "NetworkFunctionSkuListResult", - "NetworkFunctionSkuRoleDetails", - "NetworkFunctionTemplate", - "NetworkFunctionUserConfiguration", - "NetworkFunctionUserConfigurationOsProfile", - "NetworkFunctionVendor", - "NetworkFunctionVendorConfiguration", - "NetworkFunctionVendorListResult", - "NetworkInterface", - "NetworkInterfaceIPConfiguration", + "NetworkFunctionPropertiesFormat", + "NetworkFunctionValueWithSecrets", + "NetworkFunctionValueWithoutSecrets", + "NetworkServiceDesignGroup", + "NetworkServiceDesignGroupListResult", + "NetworkServiceDesignGroupPropertiesFormat", + "NetworkServiceDesignVersion", + "NetworkServiceDesignVersionListResult", + "NetworkServiceDesignVersionPropertiesFormat", + "NetworkServiceDesignVersionUpdateState", + "NfviDetails", + "OpenDeploymentResourceReference", "Operation", "OperationDisplay", "OperationListResult", - "OsDisk", - "OsProfile", - "PreviewSubscription", - "PreviewSubscriptionsList", + "Pod", + "PodEvent", + "ProxyArtifactListOverview", + "ProxyArtifactOverview", + "ProxyArtifactOverviewListResult", + "ProxyArtifactOverviewPropertiesFormat", + "ProxyArtifactOverviewPropertiesValue", + "ProxyArtifactVersionsListOverview", + "ProxyArtifactVersionsOverviewListResult", "ProxyResource", + "Publisher", + "PublisherListResult", + "PublisherPropertiesFormat", + "ReferencedResource", + "ReplicaSet", "RequestMetadata", "Resource", - "RoleInstance", - "SkuCredential", - "SkuOverview", - "SshConfiguration", - "SshPublicKey", - "StorageProfile", - "SubResource", + "ResourceElementTemplate", + "Resources", + "SecretDeploymentResourceReference", + "Site", + "SiteListResult", + "SiteNetworkService", + "SiteNetworkServiceListResult", + "SiteNetworkServicePropertiesFormat", + "SitePropertiesFormat", + "Sku", + "StatefulSet", "SystemData", "TagsObject", "TrackedResource", - "Vendor", - "VendorListResult", - "VendorNetworkFunction", - "VendorNetworkFunctionListResult", - "VendorSku", - "VendorSkuListResult", - "VirtualHardDisk", + "UserAssignedIdentity", + "VhdImageArtifactProfile", + "VhdImageMappingRuleProfile", + "VirtualNetworkFunctionDefinitionVersion", + "VirtualNetworkFunctionTemplate", "ActionType", + "ApplicationEnablement", + "ArtifactManifestState", + "ArtifactReplicationStrategy", + "ArtifactState", + "ArtifactStoreType", + "ArtifactType", + "AzureArcKubernetesArtifactType", + "AzureCoreArtifactType", + "AzureOperatorNexusArtifactType", + "ConfigurationGenerationType", + "ConfigurationGroupValueConfigurationType", + "ContainerizedNetworkFunctionNFVIType", "CreatedByType", - "DeviceType", - "DiskCreateOptionTypes", + "CredentialType", "HttpMethod", - "IPAllocationMethod", - "IPVersion", - "NetworkFunctionRoleConfigurationType", + "IdType", + "ManagedServiceIdentityType", + "NFVIType", + "NetworkFunctionConfigurationType", "NetworkFunctionType", - "OperatingSystemTypes", - "OperationalState", "Origin", + "PodEventType", + "PodStatus", "ProvisioningState", - "SkuDeploymentMode", - "SkuType", + "PublisherScope", + "SkuName", + "SkuTier", "Status", - "VMSwitchType", - "VendorProvisioningState", - "VirtualMachineSizeTypes", + "TemplateType", + "Type", + "VersionState", + "VirtualNetworkFunctionNFVIType", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py index aed214e79468..dab9852f90f8 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py @@ -16,6 +16,104 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class ApplicationEnablement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The application enablement.""" + + UNKNOWN = "Unknown" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ArtifactManifestState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact manifest state.""" + + UNKNOWN = "Unknown" + UPLOADING = "Uploading" + UPLOADED = "Uploaded" + VALIDATING = "Validating" + VALIDATION_FAILED = "ValidationFailed" + SUCCEEDED = "Succeeded" + + +class ArtifactReplicationStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The replication strategy.""" + + UNKNOWN = "Unknown" + SINGLE_REPLICATION = "SingleReplication" + + +class ArtifactState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact state.""" + + UNKNOWN = "Unknown" + PREVIEW = "Preview" + ACTIVE = "Active" + DEPRECATED = "Deprecated" + + +class ArtifactStoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact store type.""" + + UNKNOWN = "Unknown" + AZURE_CONTAINER_REGISTRY = "AzureContainerRegistry" + AZURE_STORAGE_ACCOUNT = "AzureStorageAccount" + + +class ArtifactType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact type.""" + + UNKNOWN = "Unknown" + OCI_ARTIFACT = "OCIArtifact" + VHD_IMAGE_FILE = "VhdImageFile" + ARM_TEMPLATE = "ArmTemplate" + IMAGE_FILE = "ImageFile" + + +class AzureArcKubernetesArtifactType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact type.""" + + UNKNOWN = "Unknown" + HELM_PACKAGE = "HelmPackage" + + +class AzureCoreArtifactType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact type.""" + + UNKNOWN = "Unknown" + VHD_IMAGE_FILE = "VhdImageFile" + ARM_TEMPLATE = "ArmTemplate" + + +class AzureOperatorNexusArtifactType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The artifact type.""" + + UNKNOWN = "Unknown" + IMAGE_FILE = "ImageFile" + ARM_TEMPLATE = "ArmTemplate" + + +class ConfigurationGenerationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The configuration generation type.""" + + UNKNOWN = "Unknown" + HANDLEBAR_TEMPLATE = "HandlebarTemplate" + + +class ConfigurationGroupValueConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The secret type which indicates if secret or not.""" + + UNKNOWN = "Unknown" + SECRET = "Secret" + OPEN = "Open" + + +class ContainerizedNetworkFunctionNFVIType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network function type.""" + + UNKNOWN = "Unknown" + AZURE_ARC_KUBERNETES = "AzureArcKubernetes" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -25,18 +123,12 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -class DeviceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the device.""" - - UNKNOWN = "Unknown" - AZURE_STACK_EDGE = "AzureStackEdge" - - -class DiskCreateOptionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies how the virtual machine should be created.""" +class CredentialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The credential type.""" UNKNOWN = "Unknown" - EMPTY = "Empty" + AZURE_CONTAINER_REGISTRY_SCOPED_TOKEN = "AzureContainerRegistryScopedToken" + AZURE_STORAGE_ACCOUNT_TOKEN = "AzureStorageAccountToken" class HttpMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -50,26 +142,31 @@ class HttpMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" -class IPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """IP address allocation method.""" +class IdType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource reference arm id type.""" UNKNOWN = "Unknown" - STATIC = "Static" - DYNAMIC = "Dynamic" + OPEN = "Open" + SECRET = "Secret" -class IPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """IP address version.""" +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ - UNKNOWN = "Unknown" - I_PV4 = "IPv4" + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class NetworkFunctionRoleConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Role type.""" +class NetworkFunctionConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The secret type which indicates if secret or not.""" UNKNOWN = "Unknown" - VIRTUAL_MACHINE = "VirtualMachine" + SECRET = "Secret" + OPEN = "Open" class NetworkFunctionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -80,22 +177,13 @@ class NetworkFunctionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTAINERIZED_NETWORK_FUNCTION = "ContainerizedNetworkFunction" -class OperatingSystemTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The OS type.""" +class NFVIType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The NFVI type.""" UNKNOWN = "Unknown" - WINDOWS = "Windows" - LINUX = "Linux" - - -class OperationalState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operational state of the role instance.""" - - UNKNOWN = "Unknown" - STOPPED = "Stopped" - RUNNING = "Running" - STOPPING = "Stopping" - STARTING = "Starting" + AZURE_ARC_KUBERNETES = "AzureArcKubernetes" + AZURE_CORE = "AzureCore" + AZURE_OPERATOR_NEXUS = "AzureOperatorNexus" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -108,6 +196,25 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" +class PodEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of pod event.""" + + NORMAL = "Normal" + WARNING = "Warning" + + +class PodStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of a Pod.""" + + UNKNOWN = "Unknown" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + RUNNING = "Running" + PENDING = "Pending" + TERMINATING = "Terminating" + NOT_READY = "NotReady" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state.""" @@ -118,81 +225,78 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" CANCELED = "Canceled" DELETED = "Deleted" + CONVERGING = "Converging" -class SkuDeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The sku deployment mode.""" +class PublisherScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Publisher Scope.""" UNKNOWN = "Unknown" - AZURE = "Azure" - PRIVATE_EDGE_ZONE = "PrivateEdgeZone" + PRIVATE = "Private" -class SkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Sku type.""" +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of this Sku.""" - UNKNOWN = "Unknown" - EVOLVED_PACKET_CORE = "EvolvedPacketCore" - SDWAN = "SDWAN" - FIREWALL = "Firewall" + BASIC = "Basic" + STANDARD = "Standard" + + +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The SKU tier based on the SKU name.""" + + BASIC = "Basic" + STANDARD = "Standard" class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current device status.""" + """The component resource deployment status.""" UNKNOWN = "Unknown" - NOT_REGISTERED = "NotRegistered" - REGISTERED = "Registered" - DELETED = "Deleted" + DEPLOYED = "Deployed" + UNINSTALLED = "Uninstalled" + SUPERSEDED = "Superseded" + FAILED = "Failed" + UNINSTALLING = "Uninstalling" + PENDING_INSTALL = "Pending-Install" + PENDING_UPGRADE = "Pending-Upgrade" + PENDING_ROLLBACK = "Pending-Rollback" + DOWNLOADING = "Downloading" + INSTALLING = "Installing" + REINSTALLING = "Reinstalling" + ROLLINGBACK = "Rollingback" + UPGRADING = "Upgrading" + + +class TemplateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The template type.""" + + UNKNOWN = "Unknown" + ARM_TEMPLATE = "ArmTemplate" -class VendorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current vendor provisioning state.""" - - UNKNOWN = "Unknown" - NOT_PROVISIONED = "NotProvisioned" - PROVISIONING = "Provisioning" - PROVISIONED = "Provisioned" - DEPROVISIONED = "Deprovisioned" - USER_DATA_VALIDATION_FAILED = "UserDataValidationFailed" - - -class VirtualMachineSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The size of the virtual machine.""" - - UNKNOWN = "Unknown" - STANDARD_D1_V2 = "Standard_D1_v2" - STANDARD_D2_V2 = "Standard_D2_v2" - STANDARD_D3_V2 = "Standard_D3_v2" - STANDARD_D4_V2 = "Standard_D4_v2" - STANDARD_D5_V2 = "Standard_D5_v2" - STANDARD_D11_V2 = "Standard_D11_v2" - STANDARD_D12_V2 = "Standard_D12_v2" - STANDARD_D13_V2 = "Standard_D13_v2" - STANDARD_DS1_V2 = "Standard_DS1_v2" - STANDARD_DS2_V2 = "Standard_DS2_v2" - STANDARD_DS3_V2 = "Standard_DS3_v2" - STANDARD_DS4_V2 = "Standard_DS4_v2" - STANDARD_DS5_V2 = "Standard_DS5_v2" - STANDARD_DS11_V2 = "Standard_DS11_v2" - STANDARD_DS12_V2 = "Standard_DS12_v2" - STANDARD_DS13_V2 = "Standard_DS13_v2" - STANDARD_F1 = "Standard_F1" - STANDARD_F2 = "Standard_F2" - STANDARD_F4 = "Standard_F4" - STANDARD_F8 = "Standard_F8" - STANDARD_F16 = "Standard_F16" - STANDARD_F1_S = "Standard_F1s" - STANDARD_F2_S = "Standard_F2s" - STANDARD_F4_S = "Standard_F4s" - STANDARD_F8_S = "Standard_F8s" - STANDARD_F16_S = "Standard_F16s" - - -class VMSwitchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the VM switch.""" - - UNKNOWN = "Unknown" - MANAGEMENT = "Management" - WAN = "Wan" - LAN = "Lan" +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource element template type.""" + + UNKNOWN = "Unknown" + ARM_RESOURCE_DEFINITION = "ArmResourceDefinition" + NETWORK_FUNCTION_DEFINITION = "NetworkFunctionDefinition" + + +class VersionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The configuration group schema state.""" + + UNKNOWN = "Unknown" + PREVIEW = "Preview" + ACTIVE = "Active" + DEPRECATED = "Deprecated" + VALIDATING = "Validating" + VALIDATION_FAILED = "ValidationFailed" + + +class VirtualNetworkFunctionNFVIType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network function type.""" + + UNKNOWN = "Unknown" + AZURE_CORE = "AzureCore" + AZURE_OPERATOR_NEXUS = "AzureOperatorNexus" diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py index 5e861f7738bb..6da778c029fa 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py @@ -8,179 +8,282 @@ # -------------------------------------------------------------------------- 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 DevicePropertiesFormat(_serialization.Model): - """Device properties. +class ArmResourceDefinitionResourceElementTemplate(_serialization.Model): + """The arm template RE. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureStackEdgeFormat + :ivar template_type: The template type. Known values are: "Unknown" and "ArmTemplate". + :vartype template_type: str or ~azure.mgmt.hybridnetwork.models.TemplateType + :ivar parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :vartype parameter_values: str + :ivar artifact_profile: Artifact profile properties. + :vartype artifact_profile: ~azure.mgmt.hybridnetwork.models.NSDArtifactProfile + """ - Variables are only populated by the server, and will be ignored when sending a request. + _attribute_map = { + "template_type": {"key": "templateType", "type": "str"}, + "parameter_values": {"key": "parameterValues", "type": "str"}, + "artifact_profile": {"key": "artifactProfile", "type": "NSDArtifactProfile"}, + } + + def __init__( + self, + *, + template_type: Optional[Union[str, "_models.TemplateType"]] = None, + parameter_values: Optional[str] = None, + artifact_profile: Optional["_models.NSDArtifactProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword template_type: The template type. Known values are: "Unknown" and "ArmTemplate". + :paramtype template_type: str or ~azure.mgmt.hybridnetwork.models.TemplateType + :keyword parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :paramtype parameter_values: str + :keyword artifact_profile: Artifact profile properties. + :paramtype artifact_profile: ~azure.mgmt.hybridnetwork.models.NSDArtifactProfile + """ + super().__init__(**kwargs) + self.template_type = template_type + self.parameter_values = parameter_values + self.artifact_profile = artifact_profile + + +class ResourceElementTemplate(_serialization.Model): + """The resource element template object. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ArmResourceDefinitionResourceElementTemplateDetails, + NetworkFunctionDefinitionResourceElementTemplateDetails All required parameters must be populated in order to send to Azure. - :ivar status: The current device status. Known values are: "Unknown", "NotRegistered", - "Registered", and "Deleted". - :vartype status: str or ~azure.mgmt.hybridnetwork.models.Status - :ivar provisioning_state: The provisioning state of the device resource. Known values are: - "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar device_type: The type of the device. Required. Known values are: "Unknown" and - "AzureStackEdge". - :vartype device_type: str or ~azure.mgmt.hybridnetwork.models.DeviceType - :ivar network_functions: The list of network functions deployed on the device. - :vartype network_functions: list[~azure.mgmt.hybridnetwork.models.SubResource] + :ivar name: Name of the resource element template. + :vartype name: str + :ivar resource_element_type: The resource element template type. Required. Known values are: + "Unknown", "ArmResourceDefinition", and "NetworkFunctionDefinition". + :vartype resource_element_type: str or ~azure.mgmt.hybridnetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile """ _validation = { - "status": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "device_type": {"required": True}, - "network_functions": {"readonly": True}, + "resource_element_type": {"required": True}, } _attribute_map = { - "status": {"key": "status", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "device_type": {"key": "deviceType", "type": "str"}, - "network_functions": {"key": "networkFunctions", "type": "[SubResource]"}, + "name": {"key": "name", "type": "str"}, + "resource_element_type": {"key": "type", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, } - _subtype_map = {"device_type": {"AzureStackEdge": "AzureStackEdgeFormat"}} + _subtype_map = { + "resource_element_type": { + "ArmResourceDefinition": "ArmResourceDefinitionResourceElementTemplateDetails", + "NetworkFunctionDefinition": "NetworkFunctionDefinitionResourceElementTemplateDetails", + } + } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + """ super().__init__(**kwargs) - self.status = None - self.provisioning_state = None - self.device_type: Optional[str] = None - self.network_functions = None - + self.name = name + self.resource_element_type: Optional[str] = None + self.depends_on_profile = depends_on_profile -class AzureStackEdgeFormat(DevicePropertiesFormat): - """The reference to the Azure stack edge device. - Variables are only populated by the server, and will be ignored when sending a request. +class ArmResourceDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The arm resource definition resource element template details. All required parameters must be populated in order to send to Azure. - :ivar status: The current device status. Known values are: "Unknown", "NotRegistered", - "Registered", and "Deleted". - :vartype status: str or ~azure.mgmt.hybridnetwork.models.Status - :ivar provisioning_state: The provisioning state of the device resource. Known values are: - "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar device_type: The type of the device. Required. Known values are: "Unknown" and - "AzureStackEdge". - :vartype device_type: str or ~azure.mgmt.hybridnetwork.models.DeviceType - :ivar network_functions: The list of network functions deployed on the device. - :vartype network_functions: list[~azure.mgmt.hybridnetwork.models.SubResource] - :ivar azure_stack_edge: The reference to the Azure stack edge device. Required. - :vartype azure_stack_edge: ~azure.mgmt.hybridnetwork.models.SubResource + :ivar name: Name of the resource element template. + :vartype name: str + :ivar resource_element_type: The resource element template type. Required. Known values are: + "Unknown", "ArmResourceDefinition", and "NetworkFunctionDefinition". + :vartype resource_element_type: str or ~azure.mgmt.hybridnetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~azure.mgmt.hybridnetwork.models.ArmResourceDefinitionResourceElementTemplate """ _validation = { - "status": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "device_type": {"required": True}, - "network_functions": {"readonly": True}, - "azure_stack_edge": {"required": True}, + "resource_element_type": {"required": True}, } _attribute_map = { - "status": {"key": "status", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "device_type": {"key": "deviceType", "type": "str"}, - "network_functions": {"key": "networkFunctions", "type": "[SubResource]"}, - "azure_stack_edge": {"key": "azureStackEdge", "type": "SubResource"}, + "name": {"key": "name", "type": "str"}, + "resource_element_type": {"key": "type", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "configuration": {"key": "configuration", "type": "ArmResourceDefinitionResourceElementTemplate"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + configuration: Optional["_models.ArmResourceDefinitionResourceElementTemplate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~azure.mgmt.hybridnetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.resource_element_type: str = "ArmResourceDefinition" + self.configuration = configuration + + +class ArmTemplateArtifactProfile(_serialization.Model): + """Template artifact profile. + + :ivar template_name: Template name. + :vartype template_name: str + :ivar template_version: Template version. + :vartype template_version: str + """ + + _attribute_map = { + "template_name": {"key": "templateName", "type": "str"}, + "template_version": {"key": "templateVersion", "type": "str"}, } - def __init__(self, *, azure_stack_edge: "_models.SubResource", **kwargs): + def __init__( + self, *, template_name: Optional[str] = None, template_version: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword azure_stack_edge: The reference to the Azure stack edge device. Required. - :paramtype azure_stack_edge: ~azure.mgmt.hybridnetwork.models.SubResource + :keyword template_name: Template name. + :paramtype template_name: str + :keyword template_version: Template version. + :paramtype template_version: str """ super().__init__(**kwargs) - self.device_type: str = "AzureStackEdge" - self.azure_stack_edge = azure_stack_edge + self.template_name = template_name + self.template_version = template_version -class CustomProfile(_serialization.Model): - """Specifies the custom settings for the virtual machine. +class ArmTemplateMappingRuleProfile(_serialization.Model): + """Template mapping rule profile. - :ivar metadata_configuration_path: Path for metadata configuration. - :vartype metadata_configuration_path: str + :ivar template_parameters: List of template parameters. + :vartype template_parameters: str """ _attribute_map = { - "metadata_configuration_path": {"key": "metadataConfigurationPath", "type": "str"}, + "template_parameters": {"key": "templateParameters", "type": "str"}, } - def __init__(self, *, metadata_configuration_path: Optional[str] = None, **kwargs): + def __init__(self, *, template_parameters: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword metadata_configuration_path: Path for metadata configuration. - :paramtype metadata_configuration_path: str + :keyword template_parameters: List of template parameters. + :paramtype template_parameters: str """ super().__init__(**kwargs) - self.metadata_configuration_path = metadata_configuration_path + self.template_parameters = template_parameters -class DataDisk(_serialization.Model): - """Specifies information about the operating system disk used by the virtual machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. +class ArtifactAccessCredential(_serialization.Model): + """The artifact manifest credential definition. - :ivar create_option: Specifies how the virtual machine should be created. Known values are: - "Unknown" and "Empty". - :vartype create_option: str or ~azure.mgmt.hybridnetwork.models.DiskCreateOptionTypes - :ivar name: The name of data disk. - :vartype name: str - :ivar disk_size_gb: Specifies the size of an empty disk in gigabytes. This element can be used - to overwrite the size of the disk in a virtual machine image. - :vartype disk_size_gb: int + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureContainerRegistryScopedTokenCredential, AzureStorageAccountCredential + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: The credential type. Required. Known values are: "Unknown", + "AzureContainerRegistryScopedToken", and "AzureStorageAccountToken". + :vartype credential_type: str or ~azure.mgmt.hybridnetwork.models.CredentialType """ + _validation = { + "credential_type": {"required": True}, + } + _attribute_map = { - "create_option": {"key": "createOption", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, + "credential_type": {"key": "credentialType", "type": "str"}, } - def __init__( - self, - *, - create_option: Optional[Union[str, "_models.DiskCreateOptionTypes"]] = None, - name: Optional[str] = None, - disk_size_gb: Optional[int] = None, - **kwargs - ): - """ - :keyword create_option: Specifies how the virtual machine should be created. Known values are: - "Unknown" and "Empty". - :paramtype create_option: str or ~azure.mgmt.hybridnetwork.models.DiskCreateOptionTypes - :keyword name: The name of data disk. - :paramtype name: str - :keyword disk_size_gb: Specifies the size of an empty disk in gigabytes. This element can be - used to overwrite the size of the disk in a virtual machine image. - :paramtype disk_size_gb: int + _subtype_map = { + "credential_type": { + "AzureContainerRegistryScopedToken": "AzureContainerRegistryScopedTokenCredential", + "AzureStorageAccountToken": "AzureStorageAccountCredential", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.credential_type: Optional[str] = None + + +class ArtifactChangeState(_serialization.Model): + """The artifact updating request payload. + + :ivar properties: Artifact update state properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ArtifactChangeStateProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ArtifactChangeStateProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ArtifactChangeStateProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Artifact update state properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.ArtifactChangeStateProperties """ super().__init__(**kwargs) - self.create_option = create_option - self.name = name - self.disk_size_gb = disk_size_gb + self.properties = properties + + +class ArtifactChangeStateProperties(_serialization.Model): + """The artifact update state properties. + + :ivar artifact_state: The artifact state. Known values are: "Unknown", "Preview", "Active", and + "Deprecated". + :vartype artifact_state: str or ~azure.mgmt.hybridnetwork.models.ArtifactState + """ + + _attribute_map = { + "artifact_state": {"key": "artifactState", "type": "str"}, + } + + def __init__(self, *, artifact_state: Optional[Union[str, "_models.ArtifactState"]] = None, **kwargs: Any) -> None: + """ + :keyword artifact_state: The artifact state. Known values are: "Unknown", "Preview", "Active", + and "Deprecated". + :paramtype artifact_state: str or ~azure.mgmt.hybridnetwork.models.ArtifactState + """ + super().__init__(**kwargs) + self.artifact_state = artifact_state class Resource(_serialization.Model): @@ -196,30 +299,37 @@ class Resource(_serialization.Model): :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.hybridnetwork.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): + 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'. + """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. @@ -233,6 +343,9 @@ class TrackedResource(Resource): :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.hybridnetwork.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -243,6 +356,7 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -250,11 +364,12 @@ class TrackedResource(Resource): "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): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -266,8 +381,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Device(TrackedResource): - """Device resource. +class ArtifactManifest(TrackedResource): + """Artifact manifest properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -281,71 +396,63 @@ class Device(TrackedResource): :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.hybridnetwork.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 system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar status: The current device status. Known values are: "Unknown", "NotRegistered", - "Registered", and "Deleted". - :vartype status: str or ~azure.mgmt.hybridnetwork.models.Status - :ivar provisioning_state: The provisioning state of the device resource. Known values are: - "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar device_type: The type of the device. Known values are: "Unknown" and "AzureStackEdge". - :vartype device_type: str or ~azure.mgmt.hybridnetwork.models.DeviceType - :ivar network_functions: The list of network functions deployed on the device. - :vartype network_functions: list[~azure.mgmt.hybridnetwork.models.SubResource] + :ivar properties: Artifact manifest properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ArtifactManifestPropertiesFormat """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, - "status": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "network_functions": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "status": {"key": "properties.status", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "device_type": {"key": "properties.deviceType", "type": "str"}, - "network_functions": {"key": "properties.networkFunctions", "type": "[SubResource]"}, + "properties": {"key": "properties", "type": "ArtifactManifestPropertiesFormat"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ArtifactManifestPropertiesFormat"] = 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 properties: Artifact manifest properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.ArtifactManifestPropertiesFormat """ super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None - self.status = None - self.provisioning_state = None - self.device_type: Optional[str] = None - self.network_functions = None + self.properties = properties -class DeviceListResult(_serialization.Model): - """Response for devices API service call. +class ArtifactManifestListResult(_serialization.Model): + """A list of artifact manifests. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of devices. - :vartype value: list[~azure.mgmt.hybridnetwork.models.Device] - :ivar next_link: The URL to get the next set of results. + :ivar value: A list of artifact manifests. + :vartype value: list[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :ivar next_link: The URI to get the next set of results. :vartype next_link: str """ @@ -354,252 +461,106 @@ class DeviceListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Device]"}, + "value": {"key": "value", "type": "[ArtifactManifest]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Device"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ArtifactManifest"]] = None, **kwargs: Any) -> None: """ - :keyword value: A list of devices. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.Device] + :keyword value: A list of artifact manifests. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.ArtifactManifest] """ super().__init__(**kwargs) self.value = value self.next_link = None -class DeviceRegistrationKey(_serialization.Model): - """The device registration key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar registration_key: The registration key for the device. - :vartype registration_key: str - """ - - _validation = { - "registration_key": {"readonly": True}, - } - - _attribute_map = { - "registration_key": {"key": "registrationKey", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.registration_key = None - - -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): - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. +class ArtifactManifestPropertiesFormat(_serialization.Model): + """Artifact manifest properties. 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.hybridnetwork.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.hybridnetwork.models.ErrorAdditionalInfo] + :ivar provisioning_state: The provisioning state of the ArtifactManifest resource. Known values + are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar artifact_manifest_state: The artifact manifest state. Known values are: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", and "Succeeded". + :vartype artifact_manifest_state: str or ~azure.mgmt.hybridnetwork.models.ArtifactManifestState + :ivar artifacts: The artifacts list. + :vartype artifacts: list[~azure.mgmt.hybridnetwork.models.ManifestArtifactFormat] """ _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]"}, + "provisioning_state": {"readonly": True}, + "artifact_manifest_state": {"readonly": True}, } - def __init__(self, **kwargs): - """ """ - 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.hybridnetwork.models.ErrorDetail - """ - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "artifact_manifest_state": {"key": "artifactManifestState", "type": "str"}, + "artifacts": {"key": "artifacts", "type": "[ManifestArtifactFormat]"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, artifacts: Optional[List["_models.ManifestArtifactFormat"]] = None, **kwargs: Any) -> None: """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.hybridnetwork.models.ErrorDetail + :keyword artifacts: The artifacts list. + :paramtype artifacts: list[~azure.mgmt.hybridnetwork.models.ManifestArtifactFormat] """ super().__init__(**kwargs) - self.error = error - + self.provisioning_state = None + self.artifact_manifest_state = None + self.artifacts = artifacts -class ExecuteRequestParameters(_serialization.Model): - """Payload for execute request post call. - All required parameters must be populated in order to send to Azure. +class ArtifactManifestUpdateState(_serialization.Model): + """The artifact manifest updating request payload. Only the 'Uploaded' state is allowed for + updates. Other states are used for internal state transitioning. - :ivar service_endpoint: The endpoint of service to call. Required. - :vartype service_endpoint: str - :ivar request_metadata: The request metadata. Required. - :vartype request_metadata: ~azure.mgmt.hybridnetwork.models.RequestMetadata + :ivar artifact_manifest_state: The artifact manifest state. Known values are: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", and "Succeeded". + :vartype artifact_manifest_state: str or ~azure.mgmt.hybridnetwork.models.ArtifactManifestState """ - _validation = { - "service_endpoint": {"required": True}, - "request_metadata": {"required": True}, - } - _attribute_map = { - "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, - "request_metadata": {"key": "requestMetadata", "type": "RequestMetadata"}, + "artifact_manifest_state": {"key": "artifactManifestState", "type": "str"}, } - def __init__(self, *, service_endpoint: str, request_metadata: "_models.RequestMetadata", **kwargs): + def __init__( + self, *, artifact_manifest_state: Optional[Union[str, "_models.ArtifactManifestState"]] = None, **kwargs: Any + ) -> None: """ - :keyword service_endpoint: The endpoint of service to call. Required. - :paramtype service_endpoint: str - :keyword request_metadata: The request metadata. Required. - :paramtype request_metadata: ~azure.mgmt.hybridnetwork.models.RequestMetadata + :keyword artifact_manifest_state: The artifact manifest state. Known values are: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", and "Succeeded". + :paramtype artifact_manifest_state: str or + ~azure.mgmt.hybridnetwork.models.ArtifactManifestState """ super().__init__(**kwargs) - self.service_endpoint = service_endpoint - self.request_metadata = request_metadata + self.artifact_manifest_state = artifact_manifest_state -class ImageReference(_serialization.Model): - """The image reference properties. - - :ivar publisher: The image publisher. - :vartype publisher: str - :ivar offer: Specifies the offer of the image used to create the virtual machine. - :vartype offer: str - :ivar sku: The image SKU. - :vartype sku: str - :ivar version: Specifies the version of the image used to create the virtual machine. The - allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - Specify 'latest' to use the latest version of an image available at deploy time. Even if you - use 'latest', the VM image will not automatically update after deploy time even if a new - version becomes available. - :vartype version: str - :ivar exact_version: Specifies in decimal numbers, the exact version of image used to create - the virtual machine. - :vartype exact_version: str - """ - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "exact_version": {"key": "exactVersion", "type": "str"}, - } - - def __init__( - self, - *, - publisher: Optional[str] = None, - offer: Optional[str] = None, - sku: Optional[str] = None, - version: Optional[str] = None, - exact_version: Optional[str] = None, - **kwargs - ): - """ - :keyword publisher: The image publisher. - :paramtype publisher: str - :keyword offer: Specifies the offer of the image used to create the virtual machine. - :paramtype offer: str - :keyword sku: The image SKU. - :paramtype sku: str - :keyword version: Specifies the version of the image used to create the virtual machine. The - allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - Specify 'latest' to use the latest version of an image available at deploy time. Even if you - use 'latest', the VM image will not automatically update after deploy time even if a new - version becomes available. - :paramtype version: str - :keyword exact_version: Specifies in decimal numbers, the exact version of image used to create - the virtual machine. - :paramtype exact_version: str - """ - super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - self.version = version - self.exact_version = exact_version - +class ArtifactProfile(_serialization.Model): + """Artifact profile properties. -class LinuxConfiguration(_serialization.Model): - """Specifies the Linux operating system settings on the virtual machine. - - :ivar ssh: Specifies the ssh key configuration for a Linux OS. - :vartype ssh: ~azure.mgmt.hybridnetwork.models.SshConfiguration + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource """ _attribute_map = { - "ssh": {"key": "ssh", "type": "SshConfiguration"}, + "artifact_store": {"key": "artifactStore", "type": "ReferencedResource"}, } - def __init__(self, *, ssh: Optional["_models.SshConfiguration"] = None, **kwargs): + def __init__(self, *, artifact_store: Optional["_models.ReferencedResource"] = None, **kwargs: Any) -> None: """ - :keyword ssh: Specifies the ssh key configuration for a Linux OS. - :paramtype ssh: ~azure.mgmt.hybridnetwork.models.SshConfiguration + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource """ super().__init__(**kwargs) - self.ssh = ssh + self.artifact_store = artifact_store -class NetworkFunction(TrackedResource): # pylint: disable=too-many-instance-attributes - """Network function resource response. +class ArtifactStore(TrackedResource): + """Artifact store properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -613,83 +574,33 @@ class NetworkFunction(TrackedResource): # pylint: disable=too-many-instance-att :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.hybridnetwork.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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar provisioning_state: The provisioning state of the network function resource. Known values - are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar device: The reference to the device resource. Once set, it cannot be updated. - :vartype device: ~azure.mgmt.hybridnetwork.models.SubResource - :ivar sku_name: The sku name for the network function. Once set, it cannot be updated. - :vartype sku_name: str - :ivar sku_type: The sku type for the network function. Known values are: "Unknown", - "EvolvedPacketCore", "SDWAN", and "Firewall". - :vartype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType - :ivar vendor_name: The vendor name for the network function. Once set, it cannot be updated. - :vartype vendor_name: str - :ivar service_key: The service key for the network function resource. - :vartype service_key: str - :ivar vendor_provisioning_state: The vendor provisioning state for the network function - resource. Known values are: "Unknown", "NotProvisioned", "Provisioning", "Provisioned", - "Deprovisioned", and "UserDataValidationFailed". - :vartype vendor_provisioning_state: str or - ~azure.mgmt.hybridnetwork.models.VendorProvisioningState - :ivar managed_application: The resource URI of the managed application. - :vartype managed_application: ~azure.mgmt.hybridnetwork.models.SubResource - :ivar managed_application_parameters: The parameters for the managed application. - :vartype managed_application_parameters: JSON - :ivar network_function_container_configurations: The network function container configurations - from the user. - :vartype network_function_container_configurations: JSON - :ivar network_function_user_configurations: The network function configurations from the user. - :vartype network_function_user_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkFunctionUserConfiguration] + :ivar properties: ArtifactStores properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ArtifactStorePropertiesFormat """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "sku_type": {"readonly": True}, - "service_key": {"readonly": True}, - "vendor_provisioning_state": {"readonly": True}, - "managed_application": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "device": {"key": "properties.device", "type": "SubResource"}, - "sku_name": {"key": "properties.skuName", "type": "str"}, - "sku_type": {"key": "properties.skuType", "type": "str"}, - "vendor_name": {"key": "properties.vendorName", "type": "str"}, - "service_key": {"key": "properties.serviceKey", "type": "str"}, - "vendor_provisioning_state": {"key": "properties.vendorProvisioningState", "type": "str"}, - "managed_application": {"key": "properties.managedApplication", "type": "SubResource"}, - "managed_application_parameters": {"key": "properties.managedApplicationParameters", "type": "object"}, - "network_function_container_configurations": { - "key": "properties.networkFunctionContainerConfigurations", - "type": "object", - }, - "network_function_user_configurations": { - "key": "properties.networkFunctionUserConfigurations", - "type": "[NetworkFunctionUserConfiguration]", - }, + "properties": {"key": "properties", "type": "ArtifactStorePropertiesFormat"}, } def __init__( @@ -697,61 +608,28 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, - device: Optional["_models.SubResource"] = None, - sku_name: Optional[str] = None, - vendor_name: Optional[str] = None, - managed_application_parameters: Optional[JSON] = None, - network_function_container_configurations: Optional[JSON] = None, - network_function_user_configurations: Optional[List["_models.NetworkFunctionUserConfiguration"]] = None, - **kwargs - ): + properties: Optional["_models.ArtifactStorePropertiesFormat"] = 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 etag: A unique read-only string that changes whenever the resource is updated. - :paramtype etag: str - :keyword device: The reference to the device resource. Once set, it cannot be updated. - :paramtype device: ~azure.mgmt.hybridnetwork.models.SubResource - :keyword sku_name: The sku name for the network function. Once set, it cannot be updated. - :paramtype sku_name: str - :keyword vendor_name: The vendor name for the network function. Once set, it cannot be updated. - :paramtype vendor_name: str - :keyword managed_application_parameters: The parameters for the managed application. - :paramtype managed_application_parameters: JSON - :keyword network_function_container_configurations: The network function container - configurations from the user. - :paramtype network_function_container_configurations: JSON - :keyword network_function_user_configurations: The network function configurations from the - user. - :paramtype network_function_user_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkFunctionUserConfiguration] + :keyword properties: ArtifactStores properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.ArtifactStorePropertiesFormat """ super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.system_data = None - self.provisioning_state = None - self.device = device - self.sku_name = sku_name - self.sku_type = None - self.vendor_name = vendor_name - self.service_key = None - self.vendor_provisioning_state = None - self.managed_application = None - self.managed_application_parameters = managed_application_parameters - self.network_function_container_configurations = network_function_container_configurations - self.network_function_user_configurations = network_function_user_configurations + self.properties = properties -class NetworkFunctionListResult(_serialization.Model): - """Response for network function API service call. +class ArtifactStoreListResult(_serialization.Model): + """A list of artifact stores. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of network function resources in a subscription or resource group. - :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunction] + :ivar value: A list of artifact stores. + :vartype value: list[~azure.mgmt.hybridnetwork.models.ArtifactStore] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -761,675 +639,4292 @@ class NetworkFunctionListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[NetworkFunction]"}, + "value": {"key": "value", "type": "[ArtifactStore]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.NetworkFunction"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ArtifactStore"]] = None, **kwargs: Any) -> None: """ - :keyword value: A list of network function resources in a subscription or resource group. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunction] + :keyword value: A list of artifact stores. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.ArtifactStore] """ super().__init__(**kwargs) self.value = value self.next_link = None -class NetworkFunctionRoleConfiguration(_serialization.Model): - """Network function role configuration. - - :ivar role_name: The name of the network function role. - :vartype role_name: str - :ivar role_type: Role type. Known values are: "Unknown" and "VirtualMachine". - :vartype role_type: str or - ~azure.mgmt.hybridnetwork.models.NetworkFunctionRoleConfigurationType - :ivar virtual_machine_size: The size of the virtual machine. Known values are: "Unknown", - "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", - "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_DS1_v2", "Standard_DS2_v2", - "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", - "Standard_DS12_v2", "Standard_DS13_v2", "Standard_F1", "Standard_F2", "Standard_F4", - "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", - and "Standard_F16s". - :vartype virtual_machine_size: str or ~azure.mgmt.hybridnetwork.models.VirtualMachineSizeTypes - :ivar os_profile: Specifies the operating system settings for the role instance. This value can - be updated during the deployment of network function. - :vartype os_profile: ~azure.mgmt.hybridnetwork.models.OsProfile - :ivar user_data_template: The user data template for customers. This is a json schema template - describing the format and data type of user data parameters. - :vartype user_data_template: JSON - :ivar user_data_parameters: The user parameters for customers. The format of user data - parameters has to be matched with the provided user data template. - :vartype user_data_parameters: JSON - :ivar network_interfaces: The network interface configurations. - :vartype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.hybridnetwork.models.StorageProfile - :ivar custom_profile: Specifies the custom settings for the virtual machine. - :vartype custom_profile: ~azure.mgmt.hybridnetwork.models.CustomProfile - """ - - _attribute_map = { - "role_name": {"key": "roleName", "type": "str"}, - "role_type": {"key": "roleType", "type": "str"}, - "virtual_machine_size": {"key": "virtualMachineSize", "type": "str"}, - "os_profile": {"key": "osProfile", "type": "OsProfile"}, - "user_data_template": {"key": "userDataTemplate", "type": "object"}, - "user_data_parameters": {"key": "userDataParameters", "type": "object"}, - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, - "storage_profile": {"key": "storageProfile", "type": "StorageProfile"}, - "custom_profile": {"key": "customProfile", "type": "CustomProfile"}, - } - - def __init__( - self, - *, - role_name: Optional[str] = None, - role_type: Optional[Union[str, "_models.NetworkFunctionRoleConfigurationType"]] = None, - virtual_machine_size: Optional[Union[str, "_models.VirtualMachineSizeTypes"]] = None, - os_profile: Optional["_models.OsProfile"] = None, - user_data_template: Optional[JSON] = None, - user_data_parameters: Optional[JSON] = None, - network_interfaces: Optional[List["_models.NetworkInterface"]] = None, - storage_profile: Optional["_models.StorageProfile"] = None, - custom_profile: Optional["_models.CustomProfile"] = None, - **kwargs - ): - """ - :keyword role_name: The name of the network function role. - :paramtype role_name: str - :keyword role_type: Role type. Known values are: "Unknown" and "VirtualMachine". - :paramtype role_type: str or - ~azure.mgmt.hybridnetwork.models.NetworkFunctionRoleConfigurationType - :keyword virtual_machine_size: The size of the virtual machine. Known values are: "Unknown", - "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", - "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_DS1_v2", "Standard_DS2_v2", - "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", - "Standard_DS12_v2", "Standard_DS13_v2", "Standard_F1", "Standard_F2", "Standard_F4", - "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", - and "Standard_F16s". - :paramtype virtual_machine_size: str or - ~azure.mgmt.hybridnetwork.models.VirtualMachineSizeTypes - :keyword os_profile: Specifies the operating system settings for the role instance. This value - can be updated during the deployment of network function. - :paramtype os_profile: ~azure.mgmt.hybridnetwork.models.OsProfile - :keyword user_data_template: The user data template for customers. This is a json schema - template describing the format and data type of user data parameters. - :paramtype user_data_template: JSON - :keyword user_data_parameters: The user parameters for customers. The format of user data - parameters has to be matched with the provided user data template. - :paramtype user_data_parameters: JSON - :keyword network_interfaces: The network interface configurations. - :paramtype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.hybridnetwork.models.StorageProfile - :keyword custom_profile: Specifies the custom settings for the virtual machine. - :paramtype custom_profile: ~azure.mgmt.hybridnetwork.models.CustomProfile - """ - super().__init__(**kwargs) - self.role_name = role_name - self.role_type = role_type - self.virtual_machine_size = virtual_machine_size - self.os_profile = os_profile - self.user_data_template = user_data_template - self.user_data_parameters = user_data_parameters - self.network_interfaces = network_interfaces - self.storage_profile = storage_profile - self.custom_profile = custom_profile - - -class NetworkFunctionRoleInstanceListResult(_serialization.Model): - """List of role instances of vendor network function. +class ArtifactStorePropertiesFormat(_serialization.Model): + """Artifact store properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of role instances. - :vartype value: list[~azure.mgmt.hybridnetwork.models.RoleInstance] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str + :ivar provisioning_state: The provisioning state of the application groups resource. Known + values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", + and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar store_type: The artifact store type. Known values are: "Unknown", + "AzureContainerRegistry", and "AzureStorageAccount". + :vartype store_type: str or ~azure.mgmt.hybridnetwork.models.ArtifactStoreType + :ivar replication_strategy: The replication strategy. Known values are: "Unknown" and + "SingleReplication". + :vartype replication_strategy: str or + ~azure.mgmt.hybridnetwork.models.ArtifactReplicationStrategy + :ivar managed_resource_group_configuration: + :vartype managed_resource_group_configuration: + ~azure.mgmt.hybridnetwork.models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + :ivar storage_resource_id: The created storage resource id. + :vartype storage_resource_id: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "storage_resource_id": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[RoleInstance]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "store_type": {"key": "storeType", "type": "str"}, + "replication_strategy": {"key": "replicationStrategy", "type": "str"}, + "managed_resource_group_configuration": { + "key": "managedResourceGroupConfiguration", + "type": "ArtifactStorePropertiesFormatManagedResourceGroupConfiguration", + }, + "storage_resource_id": {"key": "storageResourceId", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + store_type: Optional[Union[str, "_models.ArtifactStoreType"]] = None, + replication_strategy: Optional[Union[str, "_models.ArtifactReplicationStrategy"]] = None, + managed_resource_group_configuration: Optional[ + "_models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword store_type: The artifact store type. Known values are: "Unknown", + "AzureContainerRegistry", and "AzureStorageAccount". + :paramtype store_type: str or ~azure.mgmt.hybridnetwork.models.ArtifactStoreType + :keyword replication_strategy: The replication strategy. Known values are: "Unknown" and + "SingleReplication". + :paramtype replication_strategy: str or + ~azure.mgmt.hybridnetwork.models.ArtifactReplicationStrategy + :keyword managed_resource_group_configuration: + :paramtype managed_resource_group_configuration: + ~azure.mgmt.hybridnetwork.models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.provisioning_state = None + self.store_type = store_type + self.replication_strategy = replication_strategy + self.managed_resource_group_configuration = managed_resource_group_configuration + self.storage_resource_id = None -class NetworkFunctionSkuDetails(_serialization.Model): - """The network function sku details. +class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(_serialization.Model): + """ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar name: The managed resource group name. + :vartype name: str + :ivar location: The managed resource group location. + :vartype location: str + """ - :ivar sku_type: The network function sku type. Known values are: "Unknown", - "EvolvedPacketCore", "SDWAN", and "Firewall". - :vartype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType - :ivar value: The network function sku role details. - :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionSkuRoleDetails] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: 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 managed resource group name. + :paramtype name: str + :keyword location: The managed resource group location. + :paramtype location: str + """ + super().__init__(**kwargs) + self.name = name + self.location = location + + +class NFVIs(_serialization.Model): + """The NFVI object. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureArcK8SClusterNFVIDetails, AzureCoreNFVIDetails, AzureOperatorNexusClusterNFVIDetails + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: The NFVI type. Required. Known values are: "Unknown", "AzureArcKubernetes", + "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType """ _validation = { - "next_link": {"readonly": True}, + "nfvi_type": {"required": True}, } _attribute_map = { - "sku_type": {"key": "skuType", "type": "str"}, - "value": {"key": "value", "type": "[NetworkFunctionSkuRoleDetails]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "nfvi_type": {"key": "nfviType", "type": "str"}, } - def __init__( - self, - *, - sku_type: Optional[Union[str, "_models.SkuType"]] = None, - value: Optional[List["_models.NetworkFunctionSkuRoleDetails"]] = None, - **kwargs - ): + _subtype_map = { + "nfvi_type": { + "AzureArcKubernetes": "AzureArcK8SClusterNFVIDetails", + "AzureCore": "AzureCoreNFVIDetails", + "AzureOperatorNexus": "AzureOperatorNexusClusterNFVIDetails", + } + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword sku_type: The network function sku type. Known values are: "Unknown", - "EvolvedPacketCore", "SDWAN", and "Firewall". - :paramtype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType - :keyword value: The network function sku role details. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionSkuRoleDetails] + :keyword name: Name of the nfvi. + :paramtype name: str """ super().__init__(**kwargs) - self.sku_type = sku_type - self.value = value - self.next_link = None + self.name = name + self.nfvi_type: Optional[str] = None -class NetworkFunctionSkuListResult(_serialization.Model): - """A list of available network function skus. +class AzureArcK8SClusterNFVIDetails(NFVIs): + """The AzureArcK8sCluster NFVI detail. - 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 value: The network function vendor sku overview properties. - :vartype value: list[~azure.mgmt.hybridnetwork.models.SkuOverview] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: The NFVI type. Required. Known values are: "Unknown", "AzureArcKubernetes", + "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :ivar custom_location_reference: The reference to the custom location. + :vartype custom_location_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource """ _validation = { - "next_link": {"readonly": True}, + "nfvi_type": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SkuOverview]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "custom_location_reference": {"key": "customLocationReference", "type": "ReferencedResource"}, } - def __init__(self, *, value: Optional[List["_models.SkuOverview"]] = None, **kwargs): + def __init__( + self, + *, + name: Optional[str] = None, + custom_location_reference: Optional["_models.ReferencedResource"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: The network function vendor sku overview properties. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.SkuOverview] + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword custom_location_reference: The reference to the custom location. + :paramtype custom_location_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource """ - super().__init__(**kwargs) - self.value = value - self.next_link = None + super().__init__(name=name, **kwargs) + self.nfvi_type: str = "AzureArcKubernetes" + self.custom_location_reference = custom_location_reference -class NetworkFunctionSkuRoleDetails(_serialization.Model): - """The network function user configuration. +class AzureArcKubernetesArtifactProfile(ArtifactProfile): + """Azure arc kubernetes artifact profile properties. - :ivar role_name: The name of the network function role. - :vartype role_name: str - :ivar user_data_template: The user data template for customers. - :vartype user_data_template: JSON - :ivar user_data_parameters: The user parameters for customers. - :vartype user_data_parameters: JSON - :ivar network_interfaces: The network interface configuration. - :vartype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar helm_artifact_profile: Helm artifact profile. + :vartype helm_artifact_profile: ~azure.mgmt.hybridnetwork.models.HelmArtifactProfile """ _attribute_map = { - "role_name": {"key": "roleName", "type": "str"}, - "user_data_template": {"key": "userDataTemplate", "type": "object"}, - "user_data_parameters": {"key": "userDataParameters", "type": "object"}, - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, + "artifact_store": {"key": "artifactStore", "type": "ReferencedResource"}, + "helm_artifact_profile": {"key": "helmArtifactProfile", "type": "HelmArtifactProfile"}, } def __init__( self, *, - role_name: Optional[str] = None, - user_data_template: Optional[JSON] = None, - user_data_parameters: Optional[JSON] = None, - network_interfaces: Optional[List["_models.NetworkInterface"]] = None, - **kwargs - ): + artifact_store: Optional["_models.ReferencedResource"] = None, + helm_artifact_profile: Optional["_models.HelmArtifactProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword helm_artifact_profile: Helm artifact profile. + :paramtype helm_artifact_profile: ~azure.mgmt.hybridnetwork.models.HelmArtifactProfile + """ + super().__init__(artifact_store=artifact_store, **kwargs) + self.helm_artifact_profile = helm_artifact_profile + + +class MappingRuleProfile(_serialization.Model): + """Mapping rule profile properties. + + :ivar application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :vartype application_enablement: str or ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + """ + + _attribute_map = { + "application_enablement": {"key": "applicationEnablement", "type": "str"}, + } + + def __init__( + self, *, application_enablement: Optional[Union[str, "_models.ApplicationEnablement"]] = None, **kwargs: Any + ) -> None: """ - :keyword role_name: The name of the network function role. - :paramtype role_name: str - :keyword user_data_template: The user data template for customers. - :paramtype user_data_template: JSON - :keyword user_data_parameters: The user parameters for customers. - :paramtype user_data_parameters: JSON - :keyword network_interfaces: The network interface configuration. - :paramtype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] + :keyword application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :paramtype application_enablement: str or + ~azure.mgmt.hybridnetwork.models.ApplicationEnablement """ super().__init__(**kwargs) - self.role_name = role_name - self.user_data_template = user_data_template - self.user_data_parameters = user_data_parameters - self.network_interfaces = network_interfaces + self.application_enablement = application_enablement -class NetworkFunctionTemplate(_serialization.Model): - """The network function template. +class AzureArcKubernetesDeployMappingRuleProfile(MappingRuleProfile): + """Azure arc kubernetes deploy mapping rule profile. - :ivar network_function_role_configurations: An array of network function role definitions. - :vartype network_function_role_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkFunctionRoleConfiguration] + :ivar application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :vartype application_enablement: str or ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :ivar helm_mapping_rule_profile: The helm mapping rule profile. + :vartype helm_mapping_rule_profile: ~azure.mgmt.hybridnetwork.models.HelmMappingRuleProfile """ _attribute_map = { - "network_function_role_configurations": { - "key": "networkFunctionRoleConfigurations", - "type": "[NetworkFunctionRoleConfiguration]", - }, + "application_enablement": {"key": "applicationEnablement", "type": "str"}, + "helm_mapping_rule_profile": {"key": "helmMappingRuleProfile", "type": "HelmMappingRuleProfile"}, } def __init__( self, *, - network_function_role_configurations: Optional[List["_models.NetworkFunctionRoleConfiguration"]] = None, - **kwargs - ): + application_enablement: Optional[Union[str, "_models.ApplicationEnablement"]] = None, + helm_mapping_rule_profile: Optional["_models.HelmMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword network_function_role_configurations: An array of network function role definitions. - :paramtype network_function_role_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkFunctionRoleConfiguration] + :keyword application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :paramtype application_enablement: str or + ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :keyword helm_mapping_rule_profile: The helm mapping rule profile. + :paramtype helm_mapping_rule_profile: ~azure.mgmt.hybridnetwork.models.HelmMappingRuleProfile """ - super().__init__(**kwargs) - self.network_function_role_configurations = network_function_role_configurations + super().__init__(application_enablement=application_enablement, **kwargs) + self.helm_mapping_rule_profile = helm_mapping_rule_profile -class NetworkFunctionUserConfiguration(_serialization.Model): - """The network function user configuration. +class NetworkFunctionApplication(_serialization.Model): + """Network function application definition. - :ivar role_name: The name of the network function role. - :vartype role_name: str - :ivar user_data_parameters: The user data parameters from the customer. - :vartype user_data_parameters: JSON - :ivar network_interfaces: The network interface configuration. - :vartype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] - :ivar os_profile: Specifies the operating system settings for the role instance. - :vartype os_profile: ~azure.mgmt.hybridnetwork.models.NetworkFunctionUserConfigurationOsProfile + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile """ _attribute_map = { - "role_name": {"key": "roleName", "type": "str"}, - "user_data_parameters": {"key": "userDataParameters", "type": "object"}, - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, - "os_profile": {"key": "osProfile", "type": "NetworkFunctionUserConfigurationOsProfile"}, + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, } def __init__( self, *, - role_name: Optional[str] = None, - user_data_parameters: Optional[JSON] = None, - network_interfaces: Optional[List["_models.NetworkInterface"]] = None, - os_profile: Optional["_models.NetworkFunctionUserConfigurationOsProfile"] = None, - **kwargs - ): + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword role_name: The name of the network function role. - :paramtype role_name: str - :keyword user_data_parameters: The user data parameters from the customer. - :paramtype user_data_parameters: JSON - :keyword network_interfaces: The network interface configuration. - :paramtype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] - :keyword os_profile: Specifies the operating system settings for the role instance. - :paramtype os_profile: - ~azure.mgmt.hybridnetwork.models.NetworkFunctionUserConfigurationOsProfile + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile """ super().__init__(**kwargs) - self.role_name = role_name - self.user_data_parameters = user_data_parameters - self.network_interfaces = network_interfaces - self.os_profile = os_profile + self.name = name + self.depends_on_profile = depends_on_profile + +class AzureArcKubernetesNetworkFunctionApplication(NetworkFunctionApplication): + """Azure arc kubernetes network function application definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureArcKubernetesHelmApplication -class NetworkFunctionUserConfigurationOsProfile(_serialization.Model): - """Specifies the operating system settings for the role instance. + All required parameters must be populated in order to send to Azure. - :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded - string is decoded to a binary array that is saved as a file on the virtual machine. The maximum - length of the binary array is 65535 bytes. :code:`
`:code:`
` **Note: Do not pass any - secrets or passwords in customData property** :code:`
`:code:`
` This property cannot be - updated after the VM is created. :code:`
`:code:`
` customData is passed to the VM to be - saved as a file. For more information see `Custom Data on Azure VMs - `_ - :code:`
`:code:`
` For using cloud-init for your Linux VM, see `Using cloud-init to - customize a Linux VM during creation - `_. - :vartype custom_data: str + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown" and + "HelmPackage". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureArcKubernetesArtifactType """ + _validation = { + "artifact_type": {"required": True}, + } + _attribute_map = { - "custom_data": {"key": "customData", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, } - def __init__(self, *, custom_data: Optional[str] = None, **kwargs): + _subtype_map = {"artifact_type": {"HelmPackage": "AzureArcKubernetesHelmApplication"}} + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded - string is decoded to a binary array that is saved as a file on the virtual machine. The maximum - length of the binary array is 65535 bytes. :code:`
`:code:`
` **Note: Do not pass any - secrets or passwords in customData property** :code:`
`:code:`
` This property cannot be - updated after the VM is created. :code:`
`:code:`
` customData is passed to the VM to be - saved as a file. For more information see `Custom Data on Azure VMs - `_ - :code:`
`:code:`
` For using cloud-init for your Linux VM, see `Using cloud-init to - customize a Linux VM during creation - `_. - :paramtype custom_data: str + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile """ - super().__init__(**kwargs) - self.custom_data = custom_data + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: Optional[str] = None + +class AzureArcKubernetesHelmApplication(AzureArcKubernetesNetworkFunctionApplication): + """Azure arc kubernetes helm application configurations. -class NetworkFunctionVendor(_serialization.Model): - """The network function vendor. + All required parameters must be populated in order to send to Azure. - :ivar vendor_name: The network function vendor name. - :vartype vendor_name: str - :ivar sku_list: The network function sku list. - :vartype sku_list: list[~azure.mgmt.hybridnetwork.models.SkuOverview] + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown" and + "HelmPackage". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureArcKubernetesArtifactType + :ivar artifact_profile: Azure arc kubernetes artifact profile. + :vartype artifact_profile: ~azure.mgmt.hybridnetwork.models.AzureArcKubernetesArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureArcKubernetesDeployMappingRuleProfile """ + _validation = { + "artifact_type": {"required": True}, + } + _attribute_map = { - "vendor_name": {"key": "properties.vendorName", "type": "str"}, - "sku_list": {"key": "properties.skuList", "type": "[SkuOverview]"}, + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_profile": {"key": "artifactProfile", "type": "AzureArcKubernetesArtifactProfile"}, + "deploy_parameters_mapping_rule_profile": { + "key": "deployParametersMappingRuleProfile", + "type": "AzureArcKubernetesDeployMappingRuleProfile", + }, } def __init__( - self, *, vendor_name: Optional[str] = None, sku_list: Optional[List["_models.SkuOverview"]] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + artifact_profile: Optional["_models.AzureArcKubernetesArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["_models.AzureArcKubernetesDeployMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword vendor_name: The network function vendor name. - :paramtype vendor_name: str - :keyword sku_list: The network function sku list. - :paramtype sku_list: list[~azure.mgmt.hybridnetwork.models.SkuOverview] + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword artifact_profile: Azure arc kubernetes artifact profile. + :paramtype artifact_profile: ~azure.mgmt.hybridnetwork.models.AzureArcKubernetesArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureArcKubernetesDeployMappingRuleProfile """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: str = "HelmPackage" + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class ContainerizedNetworkFunctionTemplate(_serialization.Model): + """Containerized network function template. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureArcKubernetesNetworkFunctionTemplate + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: The network function type. Required. Known values are: "Unknown" and + "AzureArcKubernetes". + :vartype nfvi_type: str or + ~azure.mgmt.hybridnetwork.models.ContainerizedNetworkFunctionNFVIType + """ + + _validation = { + "nfvi_type": {"required": True}, + } + + _attribute_map = { + "nfvi_type": {"key": "nfviType", "type": "str"}, + } + + _subtype_map = {"nfvi_type": {"AzureArcKubernetes": "AzureArcKubernetesNetworkFunctionTemplate"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.vendor_name = vendor_name - self.sku_list = sku_list + self.nfvi_type: Optional[str] = None -class NetworkFunctionVendorConfiguration(_serialization.Model): - """Network function vendor configuration. +class AzureArcKubernetesNetworkFunctionTemplate(ContainerizedNetworkFunctionTemplate): + """Azure Arc kubernetes network function template. - 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 role_name: The name of the vendor network function role. - :vartype role_name: str - :ivar os_profile: Specifies the operating system settings for the role instance. - :vartype os_profile: ~azure.mgmt.hybridnetwork.models.OsProfile - :ivar user_data_parameters: The user parameters from the customer. - :vartype user_data_parameters: JSON - :ivar network_interfaces: The network interface configurations. - :vartype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] + :ivar nfvi_type: The network function type. Required. Known values are: "Unknown" and + "AzureArcKubernetes". + :vartype nfvi_type: str or + ~azure.mgmt.hybridnetwork.models.ContainerizedNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~azure.mgmt.hybridnetwork.models.AzureArcKubernetesNetworkFunctionApplication] """ _validation = { - "user_data_parameters": {"readonly": True}, + "nfvi_type": {"required": True}, } _attribute_map = { - "role_name": {"key": "roleName", "type": "str"}, - "os_profile": {"key": "osProfile", "type": "OsProfile"}, - "user_data_parameters": {"key": "userDataParameters", "type": "object"}, - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "network_function_applications": { + "key": "networkFunctionApplications", + "type": "[AzureArcKubernetesNetworkFunctionApplication]", + }, } def __init__( self, *, - role_name: Optional[str] = None, - os_profile: Optional["_models.OsProfile"] = None, - network_interfaces: Optional[List["_models.NetworkInterface"]] = None, - **kwargs - ): + network_function_applications: Optional[List["_models.AzureArcKubernetesNetworkFunctionApplication"]] = None, + **kwargs: Any + ) -> None: """ - :keyword role_name: The name of the vendor network function role. - :paramtype role_name: str - :keyword os_profile: Specifies the operating system settings for the role instance. - :paramtype os_profile: ~azure.mgmt.hybridnetwork.models.OsProfile - :keyword network_interfaces: The network interface configurations. - :paramtype network_interfaces: list[~azure.mgmt.hybridnetwork.models.NetworkInterface] + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~azure.mgmt.hybridnetwork.models.AzureArcKubernetesNetworkFunctionApplication] """ super().__init__(**kwargs) - self.role_name = role_name - self.os_profile = os_profile - self.user_data_parameters = None - self.network_interfaces = network_interfaces + self.nfvi_type: str = "AzureArcKubernetes" + self.network_function_applications = network_function_applications -class NetworkFunctionVendorListResult(_serialization.Model): - """The network function vendor list result. +class AzureContainerRegistryScopedTokenCredential(ArtifactAccessCredential): + """The azure container registry scoped token credential 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 value: A list of available network function vendors and skus. - :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionVendor] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str + :ivar credential_type: The credential type. Required. Known values are: "Unknown", + "AzureContainerRegistryScopedToken", and "AzureStorageAccountToken". + :vartype credential_type: str or ~azure.mgmt.hybridnetwork.models.CredentialType + :ivar username: The username of the credential. + :vartype username: str + :ivar acr_token: The credential value. + :vartype acr_token: str + :ivar acr_server_url: The Acr server url. + :vartype acr_server_url: str + :ivar repositories: The repositories that could be accessed using the current credential. + :vartype repositories: list[str] + :ivar expiry: The UTC time when credential will expire. + :vartype expiry: ~datetime.datetime """ _validation = { - "next_link": {"readonly": True}, + "credential_type": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[NetworkFunctionVendor]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "acr_token": {"key": "acrToken", "type": "str"}, + "acr_server_url": {"key": "acrServerUrl", "type": "str"}, + "repositories": {"key": "repositories", "type": "[str]"}, + "expiry": {"key": "expiry", "type": "iso-8601"}, } - def __init__(self, *, value: Optional[List["_models.NetworkFunctionVendor"]] = None, **kwargs): + def __init__( + self, + *, + username: Optional[str] = None, + acr_token: Optional[str] = None, + acr_server_url: Optional[str] = None, + repositories: Optional[List[str]] = None, + expiry: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword value: A list of available network function vendors and skus. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionVendor] + :keyword username: The username of the credential. + :paramtype username: str + :keyword acr_token: The credential value. + :paramtype acr_token: str + :keyword acr_server_url: The Acr server url. + :paramtype acr_server_url: str + :keyword repositories: The repositories that could be accessed using the current credential. + :paramtype repositories: list[str] + :keyword expiry: The UTC time when credential will expire. + :paramtype expiry: ~datetime.datetime """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.credential_type: str = "AzureContainerRegistryScopedToken" + self.username = username + self.acr_token = acr_token + self.acr_server_url = acr_server_url + self.repositories = repositories + self.expiry = expiry -class NetworkInterface(_serialization.Model): - """Network interface properties. +class AzureCoreArmTemplateArtifactProfile(ArtifactProfile): + """Azure template artifact profile properties. - :ivar network_interface_name: The name of the network interface. - :vartype network_interface_name: str - :ivar mac_address: The MAC address of the network interface. - :vartype mac_address: str - :ivar ip_configurations: A list of IP configurations of the network interface. - :vartype ip_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkInterfaceIPConfiguration] - :ivar vm_switch_type: The type of the VM switch. Known values are: "Unknown", "Management", - "Wan", and "Lan". - :vartype vm_switch_type: str or ~azure.mgmt.hybridnetwork.models.VMSwitchType + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar template_artifact_profile: Template artifact profile. + :vartype template_artifact_profile: ~azure.mgmt.hybridnetwork.models.ArmTemplateArtifactProfile """ _attribute_map = { - "network_interface_name": {"key": "networkInterfaceName", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "ip_configurations": {"key": "ipConfigurations", "type": "[NetworkInterfaceIPConfiguration]"}, - "vm_switch_type": {"key": "vmSwitchType", "type": "str"}, + "artifact_store": {"key": "artifactStore", "type": "ReferencedResource"}, + "template_artifact_profile": {"key": "templateArtifactProfile", "type": "ArmTemplateArtifactProfile"}, } def __init__( self, *, - network_interface_name: Optional[str] = None, - mac_address: Optional[str] = None, - ip_configurations: Optional[List["_models.NetworkInterfaceIPConfiguration"]] = None, - vm_switch_type: Optional[Union[str, "_models.VMSwitchType"]] = None, - **kwargs - ): + artifact_store: Optional["_models.ReferencedResource"] = None, + template_artifact_profile: Optional["_models.ArmTemplateArtifactProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword network_interface_name: The name of the network interface. - :paramtype network_interface_name: str - :keyword mac_address: The MAC address of the network interface. - :paramtype mac_address: str - :keyword ip_configurations: A list of IP configurations of the network interface. - :paramtype ip_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkInterfaceIPConfiguration] - :keyword vm_switch_type: The type of the VM switch. Known values are: "Unknown", "Management", - "Wan", and "Lan". - :paramtype vm_switch_type: str or ~azure.mgmt.hybridnetwork.models.VMSwitchType + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword template_artifact_profile: Template artifact profile. + :paramtype template_artifact_profile: + ~azure.mgmt.hybridnetwork.models.ArmTemplateArtifactProfile """ - super().__init__(**kwargs) - self.network_interface_name = network_interface_name - self.mac_address = mac_address - self.ip_configurations = ip_configurations - self.vm_switch_type = vm_switch_type + super().__init__(artifact_store=artifact_store, **kwargs) + self.template_artifact_profile = template_artifact_profile -class NetworkInterfaceIPConfiguration(_serialization.Model): - """Network interface IP configuration properties. +class AzureCoreArmTemplateDeployMappingRuleProfile(MappingRuleProfile): + """Azure template deploy mapping rule profile. - :ivar ip_allocation_method: IP address allocation method. Known values are: "Unknown", - "Static", and "Dynamic". - :vartype ip_allocation_method: str or ~azure.mgmt.hybridnetwork.models.IPAllocationMethod - :ivar ip_address: The value of the IP address. - :vartype ip_address: str - :ivar subnet: The value of the subnet. - :vartype subnet: str - :ivar gateway: The value of the gateway. - :vartype gateway: str - :ivar ip_version: IP address version. Known values are: "Unknown" and "IPv4". - :vartype ip_version: str or ~azure.mgmt.hybridnetwork.models.IPVersion - :ivar dns_servers: The list of DNS servers IP addresses. - :vartype dns_servers: list[str] + :ivar application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :vartype application_enablement: str or ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :ivar template_mapping_rule_profile: The template mapping rule profile. + :vartype template_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.ArmTemplateMappingRuleProfile """ _attribute_map = { - "ip_allocation_method": {"key": "ipAllocationMethod", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "subnet": {"key": "subnet", "type": "str"}, - "gateway": {"key": "gateway", "type": "str"}, - "ip_version": {"key": "ipVersion", "type": "str"}, - "dns_servers": {"key": "dnsServers", "type": "[str]"}, + "application_enablement": {"key": "applicationEnablement", "type": "str"}, + "template_mapping_rule_profile": {"key": "templateMappingRuleProfile", "type": "ArmTemplateMappingRuleProfile"}, } def __init__( self, *, - ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, - ip_address: Optional[str] = None, - subnet: Optional[str] = None, - gateway: Optional[str] = None, - ip_version: Optional[Union[str, "_models.IPVersion"]] = None, - dns_servers: Optional[List[str]] = None, - **kwargs - ): + application_enablement: Optional[Union[str, "_models.ApplicationEnablement"]] = None, + template_mapping_rule_profile: Optional["_models.ArmTemplateMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword ip_allocation_method: IP address allocation method. Known values are: "Unknown", - "Static", and "Dynamic". - :paramtype ip_allocation_method: str or ~azure.mgmt.hybridnetwork.models.IPAllocationMethod - :keyword ip_address: The value of the IP address. - :paramtype ip_address: str - :keyword subnet: The value of the subnet. - :paramtype subnet: str - :keyword gateway: The value of the gateway. - :paramtype gateway: str - :keyword ip_version: IP address version. Known values are: "Unknown" and "IPv4". - :paramtype ip_version: str or ~azure.mgmt.hybridnetwork.models.IPVersion - :keyword dns_servers: The list of DNS servers IP addresses. - :paramtype dns_servers: list[str] + :keyword application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :paramtype application_enablement: str or + ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :keyword template_mapping_rule_profile: The template mapping rule profile. + :paramtype template_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.ArmTemplateMappingRuleProfile """ - super().__init__(**kwargs) - self.ip_allocation_method = ip_allocation_method - self.ip_address = ip_address - self.subnet = subnet - self.gateway = gateway - self.ip_version = ip_version - self.dns_servers = dns_servers + super().__init__(application_enablement=application_enablement, **kwargs) + self.template_mapping_rule_profile = template_mapping_rule_profile -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. +class AzureCoreNetworkFunctionApplication(NetworkFunctionApplication): + """Azure virtual network function application definition. - Variables are only populated by the server, and will be ignored when sending a request. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureCoreNetworkFunctionArmTemplateApplication, AzureCoreNetworkFunctionVhdApplication - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. :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.hybridnetwork.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.hybridnetwork.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.hybridnetwork.models.ActionType + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown", "VhdImageFile", + and "ArmTemplate". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureCoreArtifactType """ _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, + "artifact_type": {"required": 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"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + } + + _subtype_map = { + "artifact_type": { + "ArmTemplate": "AzureCoreNetworkFunctionArmTemplateApplication", + "VhdImageFile": "AzureCoreNetworkFunctionVhdApplication", + } } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.hybridnetwork.models.OperationDisplay + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: Optional[str] = None -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. +class AzureCoreNetworkFunctionArmTemplateApplication(AzureCoreNetworkFunctionApplication): + """Azure core network function Template application 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 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 + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown", "VhdImageFile", + and "ArmTemplate". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureCoreArtifactType + :ivar artifact_profile: Azure template artifact profile. + :vartype artifact_profile: ~azure.mgmt.hybridnetwork.models.AzureCoreArmTemplateArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile """ _validation = { - "provider": {"readonly": True}, + "artifact_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_profile": {"key": "artifactProfile", "type": "AzureCoreArmTemplateArtifactProfile"}, + "deploy_parameters_mapping_rule_profile": { + "key": "deployParametersMappingRuleProfile", + "type": "AzureCoreArmTemplateDeployMappingRuleProfile", + }, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + artifact_profile: Optional["_models.AzureCoreArmTemplateArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["_models.AzureCoreArmTemplateDeployMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword artifact_profile: Azure template artifact profile. + :paramtype artifact_profile: + ~azure.mgmt.hybridnetwork.models.AzureCoreArmTemplateArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: str = "ArmTemplate" + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class VirtualNetworkFunctionTemplate(_serialization.Model): + """Virtual network function template. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureCoreNetworkFunctionTemplate, AzureOperatorNexusNetworkFunctionTemplate + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: The network function type. Required. Known values are: "Unknown", "AzureCore", + and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.VirtualNetworkFunctionNFVIType + """ + + _validation = { + "nfvi_type": {"required": True}, + } + + _attribute_map = { + "nfvi_type": {"key": "nfviType", "type": "str"}, + } + + _subtype_map = { + "nfvi_type": { + "AzureCore": "AzureCoreNetworkFunctionTemplate", + "AzureOperatorNexus": "AzureOperatorNexusNetworkFunctionTemplate", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.nfvi_type: Optional[str] = None + + +class AzureCoreNetworkFunctionTemplate(VirtualNetworkFunctionTemplate): + """Azure virtual network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: The network function type. Required. Known values are: "Unknown", "AzureCore", + and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.VirtualNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~azure.mgmt.hybridnetwork.models.AzureCoreNetworkFunctionApplication] + """ + + _validation = { + "nfvi_type": {"required": True}, + } + + _attribute_map = { + "nfvi_type": {"key": "nfviType", "type": "str"}, + "network_function_applications": { + "key": "networkFunctionApplications", + "type": "[AzureCoreNetworkFunctionApplication]", + }, + } + + def __init__( + self, + *, + network_function_applications: Optional[List["_models.AzureCoreNetworkFunctionApplication"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~azure.mgmt.hybridnetwork.models.AzureCoreNetworkFunctionApplication] + """ + super().__init__(**kwargs) + self.nfvi_type: str = "AzureCore" + self.network_function_applications = network_function_applications + + +class AzureCoreNetworkFunctionVhdApplication(AzureCoreNetworkFunctionApplication): + """Azure core network function vhd application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown", "VhdImageFile", + and "ArmTemplate". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureCoreArtifactType + :ivar artifact_profile: Azure vhd image artifact profile. + :vartype artifact_profile: ~azure.mgmt.hybridnetwork.models.AzureCoreVhdImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + + _validation = { + "artifact_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_profile": {"key": "artifactProfile", "type": "AzureCoreVhdImageArtifactProfile"}, + "deploy_parameters_mapping_rule_profile": { + "key": "deployParametersMappingRuleProfile", + "type": "AzureCoreVhdImageDeployMappingRuleProfile", + }, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + artifact_profile: Optional["_models.AzureCoreVhdImageArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["_models.AzureCoreVhdImageDeployMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword artifact_profile: Azure vhd image artifact profile. + :paramtype artifact_profile: ~azure.mgmt.hybridnetwork.models.AzureCoreVhdImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: str = "VhdImageFile" + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class AzureCoreNFVIDetails(NFVIs): + """The Azure Core NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: The NFVI type. Required. Known values are: "Unknown", "AzureArcKubernetes", + "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :ivar location: Location of the Azure core. + :vartype location: str + """ + + _validation = { + "nfvi_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, location: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword location: Location of the Azure core. + :paramtype location: str + """ + super().__init__(name=name, **kwargs) + self.nfvi_type: str = "AzureCore" + self.location = location + + +class AzureCoreVhdImageArtifactProfile(ArtifactProfile): + """Azure vhd artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar vhd_artifact_profile: Vhd artifact profile. + :vartype vhd_artifact_profile: ~azure.mgmt.hybridnetwork.models.VhdImageArtifactProfile + """ + + _attribute_map = { + "artifact_store": {"key": "artifactStore", "type": "ReferencedResource"}, + "vhd_artifact_profile": {"key": "vhdArtifactProfile", "type": "VhdImageArtifactProfile"}, + } + + def __init__( + self, + *, + artifact_store: Optional["_models.ReferencedResource"] = None, + vhd_artifact_profile: Optional["_models.VhdImageArtifactProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword vhd_artifact_profile: Vhd artifact profile. + :paramtype vhd_artifact_profile: ~azure.mgmt.hybridnetwork.models.VhdImageArtifactProfile + """ + super().__init__(artifact_store=artifact_store, **kwargs) + self.vhd_artifact_profile = vhd_artifact_profile + + +class AzureCoreVhdImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure vhd deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :vartype application_enablement: str or ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :ivar vhd_image_mapping_rule_profile: The vhd mapping rule profile. + :vartype vhd_image_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.VhdImageMappingRuleProfile + """ + + _attribute_map = { + "application_enablement": {"key": "applicationEnablement", "type": "str"}, + "vhd_image_mapping_rule_profile": {"key": "vhdImageMappingRuleProfile", "type": "VhdImageMappingRuleProfile"}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "_models.ApplicationEnablement"]] = None, + vhd_image_mapping_rule_profile: Optional["_models.VhdImageMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :paramtype application_enablement: str or + ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :keyword vhd_image_mapping_rule_profile: The vhd mapping rule profile. + :paramtype vhd_image_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.VhdImageMappingRuleProfile + """ + super().__init__(application_enablement=application_enablement, **kwargs) + self.vhd_image_mapping_rule_profile = vhd_image_mapping_rule_profile + + +class AzureOperatorNexusArmTemplateArtifactProfile(ArtifactProfile): + """Azure Operator Distributed Services vhd artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar template_artifact_profile: Template artifact profile. + :vartype template_artifact_profile: ~azure.mgmt.hybridnetwork.models.ArmTemplateArtifactProfile + """ + + _attribute_map = { + "artifact_store": {"key": "artifactStore", "type": "ReferencedResource"}, + "template_artifact_profile": {"key": "templateArtifactProfile", "type": "ArmTemplateArtifactProfile"}, + } + + def __init__( + self, + *, + artifact_store: Optional["_models.ReferencedResource"] = None, + template_artifact_profile: Optional["_models.ArmTemplateArtifactProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword template_artifact_profile: Template artifact profile. + :paramtype template_artifact_profile: + ~azure.mgmt.hybridnetwork.models.ArmTemplateArtifactProfile + """ + super().__init__(artifact_store=artifact_store, **kwargs) + self.template_artifact_profile = template_artifact_profile + + +class AzureOperatorNexusArmTemplateDeployMappingRuleProfile(MappingRuleProfile): + """Azure Operator Distributed Services template deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :vartype application_enablement: str or ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :ivar template_mapping_rule_profile: The template mapping rule profile. + :vartype template_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.ArmTemplateMappingRuleProfile + """ + + _attribute_map = { + "application_enablement": {"key": "applicationEnablement", "type": "str"}, + "template_mapping_rule_profile": {"key": "templateMappingRuleProfile", "type": "ArmTemplateMappingRuleProfile"}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "_models.ApplicationEnablement"]] = None, + template_mapping_rule_profile: Optional["_models.ArmTemplateMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :paramtype application_enablement: str or + ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :keyword template_mapping_rule_profile: The template mapping rule profile. + :paramtype template_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.ArmTemplateMappingRuleProfile + """ + super().__init__(application_enablement=application_enablement, **kwargs) + self.template_mapping_rule_profile = template_mapping_rule_profile + + +class AzureOperatorNexusClusterNFVIDetails(NFVIs): + """The AzureOperatorNexusCluster NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: The NFVI type. Required. Known values are: "Unknown", "AzureArcKubernetes", + "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :ivar custom_location_reference: The reference to the custom location. + :vartype custom_location_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource + """ + + _validation = { + "nfvi_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "custom_location_reference": {"key": "customLocationReference", "type": "ReferencedResource"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + custom_location_reference: Optional["_models.ReferencedResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword custom_location_reference: The reference to the custom location. + :paramtype custom_location_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource + """ + super().__init__(name=name, **kwargs) + self.nfvi_type: str = "AzureOperatorNexus" + self.custom_location_reference = custom_location_reference + + +class AzureOperatorNexusImageArtifactProfile(ArtifactProfile): + """Azure Operator Distributed Services image artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar image_artifact_profile: Image artifact profile. + :vartype image_artifact_profile: ~azure.mgmt.hybridnetwork.models.ImageArtifactProfile + """ + + _attribute_map = { + "artifact_store": {"key": "artifactStore", "type": "ReferencedResource"}, + "image_artifact_profile": {"key": "imageArtifactProfile", "type": "ImageArtifactProfile"}, + } + + def __init__( + self, + *, + artifact_store: Optional["_models.ReferencedResource"] = None, + image_artifact_profile: Optional["_models.ImageArtifactProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword image_artifact_profile: Image artifact profile. + :paramtype image_artifact_profile: ~azure.mgmt.hybridnetwork.models.ImageArtifactProfile + """ + super().__init__(artifact_store=artifact_store, **kwargs) + self.image_artifact_profile = image_artifact_profile + + +class AzureOperatorNexusImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure Operator Distributed Services image deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :vartype application_enablement: str or ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :ivar image_mapping_rule_profile: The vhd mapping rule profile. + :vartype image_mapping_rule_profile: ~azure.mgmt.hybridnetwork.models.ImageMappingRuleProfile + """ + + _attribute_map = { + "application_enablement": {"key": "applicationEnablement", "type": "str"}, + "image_mapping_rule_profile": {"key": "imageMappingRuleProfile", "type": "ImageMappingRuleProfile"}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "_models.ApplicationEnablement"]] = None, + image_mapping_rule_profile: Optional["_models.ImageMappingRuleProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_enablement: The application enablement. Known values are: "Unknown", + "Enabled", and "Disabled". + :paramtype application_enablement: str or + ~azure.mgmt.hybridnetwork.models.ApplicationEnablement + :keyword image_mapping_rule_profile: The vhd mapping rule profile. + :paramtype image_mapping_rule_profile: ~azure.mgmt.hybridnetwork.models.ImageMappingRuleProfile + """ + super().__init__(application_enablement=application_enablement, **kwargs) + self.image_mapping_rule_profile = image_mapping_rule_profile + + +class AzureOperatorNexusNetworkFunctionApplication(NetworkFunctionApplication): + """Azure Operator Distributed Services network function application definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureOperatorNexusNetworkFunctionArmTemplateApplication, + AzureOperatorNexusNetworkFunctionImageApplication + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown", "ImageFile", and + "ArmTemplate". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArtifactType + """ + + _validation = { + "artifact_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + } + + _subtype_map = { + "artifact_type": { + "ArmTemplate": "AzureOperatorNexusNetworkFunctionArmTemplateApplication", + "ImageFile": "AzureOperatorNexusNetworkFunctionImageApplication", + } + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: Optional[str] = None + + +class AzureOperatorNexusNetworkFunctionArmTemplateApplication(AzureOperatorNexusNetworkFunctionApplication): + """Azure Operator Distributed Services network function Template application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown", "ImageFile", and + "ArmTemplate". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArtifactType + :ivar artifact_profile: Azure Operator Distributed Services Template artifact profile. + :vartype artifact_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArmTemplateArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile + """ + + _validation = { + "artifact_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_profile": {"key": "artifactProfile", "type": "AzureOperatorNexusArmTemplateArtifactProfile"}, + "deploy_parameters_mapping_rule_profile": { + "key": "deployParametersMappingRuleProfile", + "type": "AzureOperatorNexusArmTemplateDeployMappingRuleProfile", + }, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + artifact_profile: Optional["_models.AzureOperatorNexusArmTemplateArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional[ + "_models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Operator Distributed Services Template artifact profile. + :paramtype artifact_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArmTemplateArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: str = "ArmTemplate" + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class AzureOperatorNexusNetworkFunctionImageApplication(AzureOperatorNexusNetworkFunctionApplication): + """Azure Operator Distributed Services network function image application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar artifact_type: The artifact type. Required. Known values are: "Unknown", "ImageFile", and + "ArmTemplate". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusArtifactType + :ivar artifact_profile: Azure Operator Distributed Services image artifact profile. + :vartype artifact_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusImageDeployMappingRuleProfile + """ + + _validation = { + "artifact_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_profile": {"key": "artifactProfile", "type": "AzureOperatorNexusImageArtifactProfile"}, + "deploy_parameters_mapping_rule_profile": { + "key": "deployParametersMappingRuleProfile", + "type": "AzureOperatorNexusImageDeployMappingRuleProfile", + }, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + artifact_profile: Optional["_models.AzureOperatorNexusImageArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional[ + "_models.AzureOperatorNexusImageDeployMappingRuleProfile" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Operator Distributed Services image artifact profile. + :paramtype artifact_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~azure.mgmt.hybridnetwork.models.AzureOperatorNexusImageDeployMappingRuleProfile + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type: str = "ImageFile" + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class AzureOperatorNexusNetworkFunctionTemplate(VirtualNetworkFunctionTemplate): + """Azure Operator Distributed Services network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: The network function type. Required. Known values are: "Unknown", "AzureCore", + and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.VirtualNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~azure.mgmt.hybridnetwork.models.AzureOperatorNexusNetworkFunctionApplication] + """ + + _validation = { + "nfvi_type": {"required": True}, + } + + _attribute_map = { + "nfvi_type": {"key": "nfviType", "type": "str"}, + "network_function_applications": { + "key": "networkFunctionApplications", + "type": "[AzureOperatorNexusNetworkFunctionApplication]", + }, + } + + def __init__( + self, + *, + network_function_applications: Optional[List["_models.AzureOperatorNexusNetworkFunctionApplication"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~azure.mgmt.hybridnetwork.models.AzureOperatorNexusNetworkFunctionApplication] + """ + super().__init__(**kwargs) + self.nfvi_type: str = "AzureOperatorNexus" + self.network_function_applications = network_function_applications + + +class AzureStorageAccountContainerCredential(_serialization.Model): + """The azure storage account container credential definition. + + :ivar container_name: The storage account container name. + :vartype container_name: str + :ivar container_sas_uri: The storage account container sas uri. + :vartype container_sas_uri: str + """ + + _attribute_map = { + "container_name": {"key": "containerName", "type": "str"}, + "container_sas_uri": {"key": "containerSasUri", "type": "str"}, + } + + def __init__( + self, *, container_name: Optional[str] = None, container_sas_uri: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword container_name: The storage account container name. + :paramtype container_name: str + :keyword container_sas_uri: The storage account container sas uri. + :paramtype container_sas_uri: str + """ + super().__init__(**kwargs) + self.container_name = container_name + self.container_sas_uri = container_sas_uri + + +class AzureStorageAccountCredential(ArtifactAccessCredential): + """The azure storage account credential definition. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: The credential type. Required. Known values are: "Unknown", + "AzureContainerRegistryScopedToken", and "AzureStorageAccountToken". + :vartype credential_type: str or ~azure.mgmt.hybridnetwork.models.CredentialType + :ivar storage_account_id: The storage account Id. + :vartype storage_account_id: str + :ivar container_credentials: The containers that could be accessed using the current + credential. + :vartype container_credentials: + list[~azure.mgmt.hybridnetwork.models.AzureStorageAccountContainerCredential] + :ivar expiry: The UTC time when credential will expire. + :vartype expiry: ~datetime.datetime + """ + + _validation = { + "credential_type": {"required": True}, + } + + _attribute_map = { + "credential_type": {"key": "credentialType", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "container_credentials": {"key": "containerCredentials", "type": "[AzureStorageAccountContainerCredential]"}, + "expiry": {"key": "expiry", "type": "iso-8601"}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + container_credentials: Optional[List["_models.AzureStorageAccountContainerCredential"]] = None, + expiry: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_account_id: The storage account Id. + :paramtype storage_account_id: str + :keyword container_credentials: The containers that could be accessed using the current + credential. + :paramtype container_credentials: + list[~azure.mgmt.hybridnetwork.models.AzureStorageAccountContainerCredential] + :keyword expiry: The UTC time when credential will expire. + :paramtype expiry: ~datetime.datetime + """ + super().__init__(**kwargs) + self.credential_type: str = "AzureStorageAccountToken" + self.storage_account_id = storage_account_id + self.container_credentials = container_credentials + self.expiry = expiry + + +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.hybridnetwork.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 Component(ProxyResource): + """The component sub 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.hybridnetwork.models.SystemData + :ivar properties: The component properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ComponentProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "ComponentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ComponentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The component properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.ComponentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ComponentListResult(_serialization.Model): + """Response for list component API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of component resources in a networkFunction. + :vartype value: list[~azure.mgmt.hybridnetwork.models.Component] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Component]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Component"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of component resources in a networkFunction. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.Component] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ComponentProperties(_serialization.Model): + """The component properties of the network function. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the component resource. Known values are: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar deployment_profile: The JSON-serialized deployment profile of the component resource. + :vartype deployment_profile: str + :ivar deployment_status: The deployment status of the component resource. + :vartype deployment_status: ~azure.mgmt.hybridnetwork.models.DeploymentStatusProperties + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "deployment_profile": {"readonly": True}, + "deployment_status": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_profile": {"key": "deploymentProfile", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "DeploymentStatusProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.deployment_profile = None + self.deployment_status = None + + +class ConfigurationGroupSchema(TrackedResource): + """Configuration group schema resource. + + 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.hybridnetwork.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 properties: Configuration group schema properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaPropertiesFormat + """ + + _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"}, + "properties": {"key": "properties", "type": "ConfigurationGroupSchemaPropertiesFormat"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ConfigurationGroupSchemaPropertiesFormat"] = 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 properties: Configuration group schema properties. + :paramtype properties: + ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaPropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ConfigurationGroupSchemaListResult(_serialization.Model): + """A list of configuration group schema resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of configuration group schema. + :vartype value: list[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ConfigurationGroupSchema]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ConfigurationGroupSchema"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of configuration group schema. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ConfigurationGroupSchemaPropertiesFormat(_serialization.Model): + """Configuration group schema properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the Configuration group schema resource. + Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar version_state: The configuration group schema version state. Known values are: "Unknown", + "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + :ivar description: Description of what schema can contain. + :vartype description: str + :ivar schema_definition: Name and value pairs that define the configuration value. It can be a + well formed escaped JSON string. + :vartype schema_definition: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "version_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "version_state": {"key": "versionState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "schema_definition": {"key": "schemaDefinition", "type": "str"}, + } + + def __init__( + self, *, description: Optional[str] = None, schema_definition: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword description: Description of what schema can contain. + :paramtype description: str + :keyword schema_definition: Name and value pairs that define the configuration value. It can be + a well formed escaped JSON string. + :paramtype schema_definition: str + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = description + self.schema_definition = schema_definition + + +class ConfigurationGroupSchemaVersionUpdateState(_serialization.Model): + """Publisher configuration group schema update request definition. + + :ivar version_state: The configuration group schema state. Known values are: "Unknown", + "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + """ + + _attribute_map = { + "version_state": {"key": "versionState", "type": "str"}, + } + + def __init__(self, *, version_state: Optional[Union[str, "_models.VersionState"]] = None, **kwargs: Any) -> None: + """ + :keyword version_state: The configuration group schema state. Known values are: "Unknown", + "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :paramtype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + """ + super().__init__(**kwargs) + self.version_state = version_state + + +class ConfigurationGroupValue(TrackedResource): + """Hybrid configuration group value resource. + + 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.hybridnetwork.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 properties: Hybrid configuration group value properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValuePropertiesFormat + """ + + _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"}, + "properties": {"key": "properties", "type": "ConfigurationGroupValuePropertiesFormat"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ConfigurationGroupValuePropertiesFormat"] = 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 properties: Hybrid configuration group value properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValuePropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ConfigurationGroupValueListResult(_serialization.Model): + """Response for hybrid configurationGroups API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of hybrid configurationGroups. + :vartype value: list[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ConfigurationGroupValue]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ConfigurationGroupValue"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of hybrid configurationGroups. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ConfigurationGroupValuePropertiesFormat(_serialization.Model): + """Hybrid configuration group value properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ConfigurationValueWithoutSecrets, ConfigurationValueWithSecrets + + 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 provisioning_state: The provisioning state of the site resource. Known values are: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the configuration group schema. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar configuration_group_schema_name: The configuration group schema name. + :vartype configuration_group_schema_name: str + :ivar configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :vartype configuration_group_schema_offering_location: str + :ivar configuration_group_schema_resource_reference: The configuration group schema resource + reference. + :vartype configuration_group_schema_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar configuration_type: The value which indicates if configuration values are secrets. + Required. Known values are: "Unknown", "Secret", and "Open". + :vartype configuration_type: str or + ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValueConfigurationType + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "configuration_group_schema_name": {"readonly": True}, + "configuration_group_schema_offering_location": {"readonly": True}, + "configuration_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "configuration_group_schema_name": {"key": "configurationGroupSchemaName", "type": "str"}, + "configuration_group_schema_offering_location": { + "key": "configurationGroupSchemaOfferingLocation", + "type": "str", + }, + "configuration_group_schema_resource_reference": { + "key": "configurationGroupSchemaResourceReference", + "type": "DeploymentResourceIdReference", + }, + "configuration_type": {"key": "configurationType", "type": "str"}, + } + + _subtype_map = { + "configuration_type": {"Open": "ConfigurationValueWithoutSecrets", "Secret": "ConfigurationValueWithSecrets"} + } + + def __init__( + self, + *, + configuration_group_schema_resource_reference: Optional["_models.DeploymentResourceIdReference"] = None, + **kwargs: Any + ) -> None: + """ + :keyword configuration_group_schema_resource_reference: The configuration group schema resource + reference. + :paramtype configuration_group_schema_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.publisher_name = None + self.publisher_scope = None + self.configuration_group_schema_name = None + self.configuration_group_schema_offering_location = None + self.configuration_group_schema_resource_reference = configuration_group_schema_resource_reference + self.configuration_type: Optional[str] = None + + +class ConfigurationValueWithoutSecrets(ConfigurationGroupValuePropertiesFormat): + """The ConfigurationValue with no secrets. + + 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 provisioning_state: The provisioning state of the site resource. Known values are: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the configuration group schema. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar configuration_group_schema_name: The configuration group schema name. + :vartype configuration_group_schema_name: str + :ivar configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :vartype configuration_group_schema_offering_location: str + :ivar configuration_group_schema_resource_reference: The configuration group schema resource + reference. + :vartype configuration_group_schema_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar configuration_type: The value which indicates if configuration values are secrets. + Required. Known values are: "Unknown", "Secret", and "Open". + :vartype configuration_type: str or + ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValueConfigurationType + :ivar configuration_value: Name and value pairs that define the configuration value. It can be + a well formed escaped JSON string. + :vartype configuration_value: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "configuration_group_schema_name": {"readonly": True}, + "configuration_group_schema_offering_location": {"readonly": True}, + "configuration_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "configuration_group_schema_name": {"key": "configurationGroupSchemaName", "type": "str"}, + "configuration_group_schema_offering_location": { + "key": "configurationGroupSchemaOfferingLocation", + "type": "str", + }, + "configuration_group_schema_resource_reference": { + "key": "configurationGroupSchemaResourceReference", + "type": "DeploymentResourceIdReference", + }, + "configuration_type": {"key": "configurationType", "type": "str"}, + "configuration_value": {"key": "configurationValue", "type": "str"}, + } + + def __init__( + self, + *, + configuration_group_schema_resource_reference: Optional["_models.DeploymentResourceIdReference"] = None, + configuration_value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword configuration_group_schema_resource_reference: The configuration group schema resource + reference. + :paramtype configuration_group_schema_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :keyword configuration_value: Name and value pairs that define the configuration value. It can + be a well formed escaped JSON string. + :paramtype configuration_value: str + """ + super().__init__( + configuration_group_schema_resource_reference=configuration_group_schema_resource_reference, **kwargs + ) + self.configuration_type: str = "Open" + self.configuration_value = configuration_value + + +class ConfigurationValueWithSecrets(ConfigurationGroupValuePropertiesFormat): + """The ConfigurationValue with secrets. + + 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 provisioning_state: The provisioning state of the site resource. Known values are: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the configuration group schema. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar configuration_group_schema_name: The configuration group schema name. + :vartype configuration_group_schema_name: str + :ivar configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :vartype configuration_group_schema_offering_location: str + :ivar configuration_group_schema_resource_reference: The configuration group schema resource + reference. + :vartype configuration_group_schema_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar configuration_type: The value which indicates if configuration values are secrets. + Required. Known values are: "Unknown", "Secret", and "Open". + :vartype configuration_type: str or + ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValueConfigurationType + :ivar secret_configuration_value: Name and value pairs that define the configuration value + secrets. It can be a well formed escaped JSON string. + :vartype secret_configuration_value: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "configuration_group_schema_name": {"readonly": True}, + "configuration_group_schema_offering_location": {"readonly": True}, + "configuration_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "configuration_group_schema_name": {"key": "configurationGroupSchemaName", "type": "str"}, + "configuration_group_schema_offering_location": { + "key": "configurationGroupSchemaOfferingLocation", + "type": "str", + }, + "configuration_group_schema_resource_reference": { + "key": "configurationGroupSchemaResourceReference", + "type": "DeploymentResourceIdReference", + }, + "configuration_type": {"key": "configurationType", "type": "str"}, + "secret_configuration_value": {"key": "secretConfigurationValue", "type": "str"}, + } + + def __init__( + self, + *, + configuration_group_schema_resource_reference: Optional["_models.DeploymentResourceIdReference"] = None, + secret_configuration_value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword configuration_group_schema_resource_reference: The configuration group schema resource + reference. + :paramtype configuration_group_schema_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :keyword secret_configuration_value: Name and value pairs that define the configuration value + secrets. It can be a well formed escaped JSON string. + :paramtype secret_configuration_value: str + """ + super().__init__( + configuration_group_schema_resource_reference=configuration_group_schema_resource_reference, **kwargs + ) + self.configuration_type: str = "Secret" + self.secret_configuration_value = secret_configuration_value + + +class NetworkFunctionDefinitionVersionPropertiesFormat(_serialization.Model): + """Network function definition version properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContainerizedNetworkFunctionDefinitionVersion, VirtualNetworkFunctionDefinitionVersion + + 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 provisioning_state: The provisioning state of the network function definition version + resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Known values are: + "Unknown", "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: The network function type. Required. Known values are: "Unknown", + "VirtualNetworkFunction", and "ContainerizedNetworkFunction". + :vartype network_function_type: str or ~azure.mgmt.hybridnetwork.models.NetworkFunctionType + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "version_state": {"readonly": True}, + "network_function_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "version_state": {"key": "versionState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "deploy_parameters": {"key": "deployParameters", "type": "str"}, + "network_function_type": {"key": "networkFunctionType", "type": "str"}, + } + + _subtype_map = { + "network_function_type": { + "ContainerizedNetworkFunction": "ContainerizedNetworkFunctionDefinitionVersion", + "VirtualNetworkFunction": "VirtualNetworkFunctionDefinitionVersion", + } + } + + def __init__( + self, *, description: Optional[str] = None, deploy_parameters: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = description + self.deploy_parameters = deploy_parameters + self.network_function_type: Optional[str] = None + + +class ContainerizedNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Containerized network function network function definition version 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 provisioning_state: The provisioning state of the network function definition version + resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Known values are: + "Unknown", "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: The network function type. Required. Known values are: "Unknown", + "VirtualNetworkFunction", and "ContainerizedNetworkFunction". + :vartype network_function_type: str or ~azure.mgmt.hybridnetwork.models.NetworkFunctionType + :ivar network_function_template: Containerized network function template. + :vartype network_function_template: + ~azure.mgmt.hybridnetwork.models.ContainerizedNetworkFunctionTemplate + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "version_state": {"readonly": True}, + "network_function_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "version_state": {"key": "versionState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "deploy_parameters": {"key": "deployParameters", "type": "str"}, + "network_function_type": {"key": "networkFunctionType", "type": "str"}, + "network_function_template": {"key": "networkFunctionTemplate", "type": "ContainerizedNetworkFunctionTemplate"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + network_function_template: Optional["_models.ContainerizedNetworkFunctionTemplate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Containerized network function template. + :paramtype network_function_template: + ~azure.mgmt.hybridnetwork.models.ContainerizedNetworkFunctionTemplate + """ + super().__init__(description=description, deploy_parameters=deploy_parameters, **kwargs) + self.network_function_type: str = "ContainerizedNetworkFunction" + self.network_function_template = network_function_template + + +class CustomLocationResourceId(_serialization.Model): + """Reference to an Azure ARC custom location resource. + + :ivar id: Azure ARC custom location resource ID. + :vartype id: str + """ + + _validation = { + "id": { + "pattern": r"^/[sS][uU][bB][sS][cC][rR][iI][pP][tT][iI][oO][nN][sS]/[^/?#]+/[rR][eE][sS][oO][uU][rR][cC][eE][gG][rR][oO][uU][pP][sS]/[^/?#]+/[pP][rR][oO][vV][iI][dD][eE][rR][sS]/[mM][iI][cC][rR][oO][sS][oO][fF][tT]\.[eE][xX][tT][eE][nN][dD][eE][dD][lL][oO][cC][aA][tT][iI][oO][nN]/[cC][uU][sS][tT][oO][mM][lL][oO][cC][aA][tT][iI][oO][nN][sS]/[^/?#]+$" + }, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Azure ARC custom location resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class DaemonSet(_serialization.Model): + """Helm DaemonSet status properties. + + :ivar name: The name of the daemonSet. + :vartype name: str + :ivar namespace: The namespace of the daemonSet. + :vartype namespace: str + :ivar desired: Desired number of pods. + :vartype desired: int + :ivar current: Current number of pods. + :vartype current: int + :ivar ready: Number of Ready pods. + :vartype ready: int + :ivar up_to_date: Number of upto date pods. + :vartype up_to_date: int + :ivar available: Number of available pods. + :vartype available: int + :ivar creation_time: Creation Time of daemonSet. + :vartype creation_time: ~datetime.datetime + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "desired": {"key": "desired", "type": "int"}, + "current": {"key": "current", "type": "int"}, + "ready": {"key": "ready", "type": "int"}, + "up_to_date": {"key": "upToDate", "type": "int"}, + "available": {"key": "available", "type": "int"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + desired: Optional[int] = None, + current: Optional[int] = None, + ready: Optional[int] = None, + up_to_date: Optional[int] = None, + available: Optional[int] = None, + creation_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the daemonSet. + :paramtype name: str + :keyword namespace: The namespace of the daemonSet. + :paramtype namespace: str + :keyword desired: Desired number of pods. + :paramtype desired: int + :keyword current: Current number of pods. + :paramtype current: int + :keyword ready: Number of Ready pods. + :paramtype ready: int + :keyword up_to_date: Number of upto date pods. + :paramtype up_to_date: int + :keyword available: Number of available pods. + :paramtype available: int + :keyword creation_time: Creation Time of daemonSet. + :paramtype creation_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.desired = desired + self.current = current + self.ready = ready + self.up_to_date = up_to_date + self.available = available + self.creation_time = creation_time + + +class DependsOnProfile(_serialization.Model): + """Depends on profile definition. + + :ivar install_depends_on: Application installation operation dependency. + :vartype install_depends_on: list[str] + :ivar uninstall_depends_on: Application deletion operation dependency. + :vartype uninstall_depends_on: list[str] + :ivar update_depends_on: Application update operation dependency. + :vartype update_depends_on: list[str] + """ + + _attribute_map = { + "install_depends_on": {"key": "installDependsOn", "type": "[str]"}, + "uninstall_depends_on": {"key": "uninstallDependsOn", "type": "[str]"}, + "update_depends_on": {"key": "updateDependsOn", "type": "[str]"}, + } + + def __init__( + self, + *, + install_depends_on: Optional[List[str]] = None, + uninstall_depends_on: Optional[List[str]] = None, + update_depends_on: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword install_depends_on: Application installation operation dependency. + :paramtype install_depends_on: list[str] + :keyword uninstall_depends_on: Application deletion operation dependency. + :paramtype uninstall_depends_on: list[str] + :keyword update_depends_on: Application update operation dependency. + :paramtype update_depends_on: list[str] + """ + super().__init__(**kwargs) + self.install_depends_on = install_depends_on + self.uninstall_depends_on = uninstall_depends_on + self.update_depends_on = update_depends_on + + +class Deployment(_serialization.Model): + """Helm Deployment status properties. + + :ivar name: The name of the deployment. + :vartype name: str + :ivar namespace: The namespace of the deployment. + :vartype namespace: str + :ivar desired: Desired number of pods. + :vartype desired: int + :ivar ready: Number of ready pods. + :vartype ready: int + :ivar up_to_date: Number of upto date pods. + :vartype up_to_date: int + :ivar available: Number of available pods. + :vartype available: int + :ivar creation_time: Creation Time of deployment. + :vartype creation_time: ~datetime.datetime + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "desired": {"key": "desired", "type": "int"}, + "ready": {"key": "ready", "type": "int"}, + "up_to_date": {"key": "upToDate", "type": "int"}, + "available": {"key": "available", "type": "int"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + desired: Optional[int] = None, + ready: Optional[int] = None, + up_to_date: Optional[int] = None, + available: Optional[int] = None, + creation_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the deployment. + :paramtype name: str + :keyword namespace: The namespace of the deployment. + :paramtype namespace: str + :keyword desired: Desired number of pods. + :paramtype desired: int + :keyword ready: Number of ready pods. + :paramtype ready: int + :keyword up_to_date: Number of upto date pods. + :paramtype up_to_date: int + :keyword available: Number of available pods. + :paramtype available: int + :keyword creation_time: Creation Time of deployment. + :paramtype creation_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.desired = desired + self.ready = ready + self.up_to_date = up_to_date + self.available = available + self.creation_time = creation_time + + +class DeploymentResourceIdReference(_serialization.Model): + """The azure resource reference which is used for deployment. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OpenDeploymentResourceReference, SecretDeploymentResourceReference + + All required parameters must be populated in order to send to Azure. + + :ivar id_type: The resource reference arm id type. Known values are: "Unknown", "Open", and + "Secret". + :vartype id_type: str or ~azure.mgmt.hybridnetwork.models.IdType + """ + + _validation = { + "id_type": {"required": True}, + } + + _attribute_map = { + "id_type": {"key": "idType", "type": "str"}, + } + + _subtype_map = { + "id_type": {"Open": "OpenDeploymentResourceReference", "Secret": "SecretDeploymentResourceReference"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id_type: Optional[str] = None + + +class DeploymentStatusProperties(_serialization.Model): + """The deployment status properties of the network function component. + + :ivar status: The status of the component resource. Known values are: "Unknown", "Deployed", + "Uninstalled", "Superseded", "Failed", "Uninstalling", "Pending-Install", "Pending-Upgrade", + "Pending-Rollback", "Downloading", "Installing", "Reinstalling", "Rollingback", and + "Upgrading". + :vartype status: str or ~azure.mgmt.hybridnetwork.models.Status + :ivar resources: The resource related to the component resource. + :vartype resources: ~azure.mgmt.hybridnetwork.models.Resources + :ivar next_expected_update_at: The next expected update of deployment status. + :vartype next_expected_update_at: ~datetime.datetime + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "resources": {"key": "resources", "type": "Resources"}, + "next_expected_update_at": {"key": "nextExpectedUpdateAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.Status"]] = None, + resources: Optional["_models.Resources"] = None, + next_expected_update_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: The status of the component resource. Known values are: "Unknown", "Deployed", + "Uninstalled", "Superseded", "Failed", "Uninstalling", "Pending-Install", "Pending-Upgrade", + "Pending-Rollback", "Downloading", "Installing", "Reinstalling", "Rollingback", and + "Upgrading". + :paramtype status: str or ~azure.mgmt.hybridnetwork.models.Status + :keyword resources: The resource related to the component resource. + :paramtype resources: ~azure.mgmt.hybridnetwork.models.Resources + :keyword next_expected_update_at: The next expected update of deployment status. + :paramtype next_expected_update_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.status = status + self.resources = resources + self.next_expected_update_at = next_expected_update_at + + +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.hybridnetwork.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.hybridnetwork.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.hybridnetwork.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.hybridnetwork.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExecuteRequestParameters(_serialization.Model): + """Payload for execute request post call. + + All required parameters must be populated in order to send to Azure. + + :ivar service_endpoint: The endpoint of service to call. Required. + :vartype service_endpoint: str + :ivar request_metadata: The request metadata. Required. + :vartype request_metadata: ~azure.mgmt.hybridnetwork.models.RequestMetadata + """ + + _validation = { + "service_endpoint": {"required": True}, + "request_metadata": {"required": True}, + } + + _attribute_map = { + "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, + "request_metadata": {"key": "requestMetadata", "type": "RequestMetadata"}, + } + + def __init__(self, *, service_endpoint: str, request_metadata: "_models.RequestMetadata", **kwargs: Any) -> None: + """ + :keyword service_endpoint: The endpoint of service to call. Required. + :paramtype service_endpoint: str + :keyword request_metadata: The request metadata. Required. + :paramtype request_metadata: ~azure.mgmt.hybridnetwork.models.RequestMetadata + """ + super().__init__(**kwargs) + self.service_endpoint = service_endpoint + self.request_metadata = request_metadata + + +class HelmArtifactProfile(_serialization.Model): + """Helm artifact profile. + + :ivar helm_package_name: Helm package name. + :vartype helm_package_name: str + :ivar helm_package_version_range: Helm package version range. + :vartype helm_package_version_range: str + :ivar registry_values_paths: The registry values path list. + :vartype registry_values_paths: list[str] + :ivar image_pull_secrets_values_paths: The image pull secrets values path list. + :vartype image_pull_secrets_values_paths: list[str] + """ + + _attribute_map = { + "helm_package_name": {"key": "helmPackageName", "type": "str"}, + "helm_package_version_range": {"key": "helmPackageVersionRange", "type": "str"}, + "registry_values_paths": {"key": "registryValuesPaths", "type": "[str]"}, + "image_pull_secrets_values_paths": {"key": "imagePullSecretsValuesPaths", "type": "[str]"}, + } + + def __init__( + self, + *, + helm_package_name: Optional[str] = None, + helm_package_version_range: Optional[str] = None, + registry_values_paths: Optional[List[str]] = None, + image_pull_secrets_values_paths: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword helm_package_name: Helm package name. + :paramtype helm_package_name: str + :keyword helm_package_version_range: Helm package version range. + :paramtype helm_package_version_range: str + :keyword registry_values_paths: The registry values path list. + :paramtype registry_values_paths: list[str] + :keyword image_pull_secrets_values_paths: The image pull secrets values path list. + :paramtype image_pull_secrets_values_paths: list[str] + """ + super().__init__(**kwargs) + self.helm_package_name = helm_package_name + self.helm_package_version_range = helm_package_version_range + self.registry_values_paths = registry_values_paths + self.image_pull_secrets_values_paths = image_pull_secrets_values_paths + + +class HelmInstallOptions(_serialization.Model): + """The helm deployment install options. + + :ivar atomic: The helm deployment atomic options. + :vartype atomic: str + :ivar wait: The helm deployment wait options. + :vartype wait: str + :ivar timeout: The helm deployment timeout options. + :vartype timeout: str + """ + + _attribute_map = { + "atomic": {"key": "atomic", "type": "str"}, + "wait": {"key": "wait", "type": "str"}, + "timeout": {"key": "timeout", "type": "str"}, + } + + def __init__( + self, *, atomic: Optional[str] = None, wait: Optional[str] = None, timeout: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword atomic: The helm deployment atomic options. + :paramtype atomic: str + :keyword wait: The helm deployment wait options. + :paramtype wait: str + :keyword timeout: The helm deployment timeout options. + :paramtype timeout: str + """ + super().__init__(**kwargs) + self.atomic = atomic + self.wait = wait + self.timeout = timeout + + +class HelmMappingRuleProfile(_serialization.Model): + """Helm mapping rule profile. + + :ivar release_namespace: Helm release namespace. + :vartype release_namespace: str + :ivar release_name: Helm release name. + :vartype release_name: str + :ivar helm_package_version: Helm package version. + :vartype helm_package_version: str + :ivar values: Helm release values. + :vartype values: str + :ivar options: The helm deployment options. + :vartype options: ~azure.mgmt.hybridnetwork.models.HelmMappingRuleProfileOptions + """ + + _attribute_map = { + "release_namespace": {"key": "releaseNamespace", "type": "str"}, + "release_name": {"key": "releaseName", "type": "str"}, + "helm_package_version": {"key": "helmPackageVersion", "type": "str"}, + "values": {"key": "values", "type": "str"}, + "options": {"key": "options", "type": "HelmMappingRuleProfileOptions"}, + } + + def __init__( + self, + *, + release_namespace: Optional[str] = None, + release_name: Optional[str] = None, + helm_package_version: Optional[str] = None, + values: Optional[str] = None, + options: Optional["_models.HelmMappingRuleProfileOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword release_namespace: Helm release namespace. + :paramtype release_namespace: str + :keyword release_name: Helm release name. + :paramtype release_name: str + :keyword helm_package_version: Helm package version. + :paramtype helm_package_version: str + :keyword values: Helm release values. + :paramtype values: str + :keyword options: The helm deployment options. + :paramtype options: ~azure.mgmt.hybridnetwork.models.HelmMappingRuleProfileOptions + """ + super().__init__(**kwargs) + self.release_namespace = release_namespace + self.release_name = release_name + self.helm_package_version = helm_package_version + self.values = values + self.options = options + + +class HelmMappingRuleProfileOptions(_serialization.Model): + """The helm deployment options. + + :ivar install_options: The helm deployment install options. + :vartype install_options: ~azure.mgmt.hybridnetwork.models.HelmInstallOptions + :ivar upgrade_options: The helm deployment upgrade options. + :vartype upgrade_options: ~azure.mgmt.hybridnetwork.models.HelmUpgradeOptions + """ + + _attribute_map = { + "install_options": {"key": "installOptions", "type": "HelmInstallOptions"}, + "upgrade_options": {"key": "upgradeOptions", "type": "HelmUpgradeOptions"}, + } + + def __init__( + self, + *, + install_options: Optional["_models.HelmInstallOptions"] = None, + upgrade_options: Optional["_models.HelmUpgradeOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword install_options: The helm deployment install options. + :paramtype install_options: ~azure.mgmt.hybridnetwork.models.HelmInstallOptions + :keyword upgrade_options: The helm deployment upgrade options. + :paramtype upgrade_options: ~azure.mgmt.hybridnetwork.models.HelmUpgradeOptions + """ + super().__init__(**kwargs) + self.install_options = install_options + self.upgrade_options = upgrade_options + + +class HelmUpgradeOptions(_serialization.Model): + """The helm deployment install options. + + :ivar atomic: The helm deployment atomic options. + :vartype atomic: str + :ivar wait: The helm deployment wait options. + :vartype wait: str + :ivar timeout: The helm deployment timeout options. + :vartype timeout: str + """ + + _attribute_map = { + "atomic": {"key": "atomic", "type": "str"}, + "wait": {"key": "wait", "type": "str"}, + "timeout": {"key": "timeout", "type": "str"}, + } + + def __init__( + self, *, atomic: Optional[str] = None, wait: Optional[str] = None, timeout: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword atomic: The helm deployment atomic options. + :paramtype atomic: str + :keyword wait: The helm deployment wait options. + :paramtype wait: str + :keyword timeout: The helm deployment timeout options. + :paramtype timeout: str + """ + super().__init__(**kwargs) + self.atomic = atomic + self.wait = wait + self.timeout = timeout + + +class ImageArtifactProfile(_serialization.Model): + """Image artifact profile. + + :ivar image_name: Image name. + :vartype image_name: str + :ivar image_version: Image version. + :vartype image_version: str + """ + + _attribute_map = { + "image_name": {"key": "imageName", "type": "str"}, + "image_version": {"key": "imageVersion", "type": "str"}, + } + + def __init__(self, *, image_name: Optional[str] = None, image_version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword image_name: Image name. + :paramtype image_name: str + :keyword image_version: Image version. + :paramtype image_version: str + """ + super().__init__(**kwargs) + self.image_name = image_name + self.image_version = image_version + + +class ImageMappingRuleProfile(_serialization.Model): + """Image mapping rule profile. + + :ivar user_configuration: List of values. + :vartype user_configuration: str + """ + + _attribute_map = { + "user_configuration": {"key": "userConfiguration", "type": "str"}, + } + + def __init__(self, *, user_configuration: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword user_configuration: List of values. + :paramtype user_configuration: str + """ + super().__init__(**kwargs) + self.user_configuration = user_configuration + + +class ManagedResourceGroupConfiguration(_serialization.Model): + """Managed resource group configuration. + + :ivar name: Managed resource group name. + :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: Managed resource group name. + :paramtype name: str + :keyword location: Managed resource group location. + :paramtype location: str + """ + super().__init__(**kwargs) + self.name = name + self.location = location + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + 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 principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.hybridnetwork.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.hybridnetwork.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManifestArtifactFormat(_serialization.Model): + """Manifest artifact properties. + + :ivar artifact_name: The artifact name. + :vartype artifact_name: str + :ivar artifact_type: The artifact type. Known values are: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", and "ImageFile". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + """ + + _attribute_map = { + "artifact_name": {"key": "artifactName", "type": "str"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_version": {"key": "artifactVersion", "type": "str"}, + } + + def __init__( + self, + *, + artifact_name: Optional[str] = None, + artifact_type: Optional[Union[str, "_models.ArtifactType"]] = None, + artifact_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_name: The artifact name. + :paramtype artifact_name: str + :keyword artifact_type: The artifact type. Known values are: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", and "ImageFile". + :paramtype artifact_type: str or ~azure.mgmt.hybridnetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + """ + super().__init__(**kwargs) + self.artifact_name = artifact_name + self.artifact_type = artifact_type + self.artifact_version = artifact_version + + +class NetworkFunction(TrackedResource): + """Network function resource response. + + 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.hybridnetwork.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 properties: Network function properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.NetworkFunctionPropertiesFormat + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar identity: The managed identity of the network function. + :vartype identity: ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentity + """ + + _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"}, + "properties": {"key": "properties", "type": "NetworkFunctionPropertiesFormat"}, + "etag": {"key": "etag", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.NetworkFunctionPropertiesFormat"] = None, + etag: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 properties: Network function properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.NetworkFunctionPropertiesFormat + :keyword etag: A unique read-only string that changes whenever the resource is updated. + :paramtype etag: str + :keyword identity: The managed identity of the network function. + :paramtype identity: ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentity + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.etag = etag + self.identity = identity + + +class NetworkFunctionDefinitionGroup(TrackedResource): + """Network function definition group resource. + + 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.hybridnetwork.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 properties: Network function definition group properties. + :vartype properties: + ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroupPropertiesFormat + """ + + _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"}, + "properties": {"key": "properties", "type": "NetworkFunctionDefinitionGroupPropertiesFormat"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.NetworkFunctionDefinitionGroupPropertiesFormat"] = 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 properties: Network function definition group properties. + :paramtype properties: + ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroupPropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class NetworkFunctionDefinitionGroupListResult(_serialization.Model): + """A list of network function definition group resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function definition group. + :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkFunctionDefinitionGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkFunctionDefinitionGroup"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of network function definition group. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionGroupPropertiesFormat(_serialization.Model): + """Network function definition group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the network function definition groups + resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar description: The network function definition group description. + :vartype description: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: The network function definition group description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.description = description + + +class NetworkFunctionDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The network function definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar resource_element_type: The resource element template type. Required. Known values are: + "Unknown", "ArmResourceDefinition", and "NetworkFunctionDefinition". + :vartype resource_element_type: str or ~azure.mgmt.hybridnetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~azure.mgmt.hybridnetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + + _validation = { + "resource_element_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_element_type": {"key": "type", "type": "str"}, + "depends_on_profile": {"key": "dependsOnProfile", "type": "DependsOnProfile"}, + "configuration": {"key": "configuration", "type": "ArmResourceDefinitionResourceElementTemplate"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["_models.DependsOnProfile"] = None, + configuration: Optional["_models.ArmResourceDefinitionResourceElementTemplate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~azure.mgmt.hybridnetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~azure.mgmt.hybridnetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + super().__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.resource_element_type: str = "NetworkFunctionDefinition" + self.configuration = configuration + + +class NetworkFunctionDefinitionVersion(TrackedResource): + """Network function definition version. + + 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.hybridnetwork.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 properties: Network function definition version properties. + :vartype properties: + ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionPropertiesFormat + """ + + _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"}, + "properties": {"key": "properties", "type": "NetworkFunctionDefinitionVersionPropertiesFormat"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.NetworkFunctionDefinitionVersionPropertiesFormat"] = 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 properties: Network function definition version properties. + :paramtype properties: + ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionPropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class NetworkFunctionDefinitionVersionListResult(_serialization.Model): + """A list of network function definition versions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function definition versions. + :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkFunctionDefinitionVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkFunctionDefinitionVersion"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of network function definition versions. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionVersionUpdateState(_serialization.Model): + """Publisher network function definition version update request definition. + + :ivar version_state: The network function definition version state. Only the 'Active' and + 'Deprecated' states are allowed for updates. Other states are used for internal state + transitioning. Known values are: "Unknown", "Preview", "Active", "Deprecated", "Validating", + and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + """ + + _attribute_map = { + "version_state": {"key": "versionState", "type": "str"}, + } + + def __init__(self, *, version_state: Optional[Union[str, "_models.VersionState"]] = None, **kwargs: Any) -> None: + """ + :keyword version_state: The network function definition version state. Only the 'Active' and + 'Deprecated' states are allowed for updates. Other states are used for internal state + transitioning. Known values are: "Unknown", "Preview", "Active", "Deprecated", "Validating", + and "ValidationFailed". + :paramtype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + """ + super().__init__(**kwargs) + self.version_state = version_state + + +class NetworkFunctionListResult(_serialization.Model): + """Response for network function API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function resources in a subscription or resource group. + :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkFunction]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.NetworkFunction"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of network function resources in a subscription or resource group. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkFunction] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionPropertiesFormat(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Network function properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + NetworkFunctionValueWithoutSecrets, NetworkFunctionValueWithSecrets + + 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 provisioning_state: The provisioning state of the network function resource. Known values + are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the network function. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar network_function_definition_group_name: The network function definition group name for + the network function. + :vartype network_function_definition_group_name: str + :ivar network_function_definition_version: The network function definition version for the + network function. + :vartype network_function_definition_version: str + :ivar network_function_definition_offering_location: The location of the network function + definition offering. + :vartype network_function_definition_offering_location: str + :ivar network_function_definition_version_resource_reference: The network function definition + version resource reference. + :vartype network_function_definition_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar nfvi_type: The nfvi type for the network function. Known values are: "Unknown", + "AzureArcKubernetes", "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :ivar nfvi_id: The nfviId for the network function. + :vartype nfvi_id: str + :ivar allow_software_update: Indicates if software updates are allowed during deployment. + :vartype allow_software_update: bool + :ivar configuration_type: The value which indicates if NF values are secrets. Required. Known + values are: "Unknown", "Secret", and "Open". + :vartype configuration_type: str or + ~azure.mgmt.hybridnetwork.models.NetworkFunctionConfigurationType + :ivar role_override_values: The role configuration override values from the user. + :vartype role_override_values: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "network_function_definition_group_name": {"readonly": True}, + "network_function_definition_version": {"readonly": True}, + "network_function_definition_offering_location": {"readonly": True}, + "configuration_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "network_function_definition_group_name": {"key": "networkFunctionDefinitionGroupName", "type": "str"}, + "network_function_definition_version": {"key": "networkFunctionDefinitionVersion", "type": "str"}, + "network_function_definition_offering_location": { + "key": "networkFunctionDefinitionOfferingLocation", + "type": "str", + }, + "network_function_definition_version_resource_reference": { + "key": "networkFunctionDefinitionVersionResourceReference", + "type": "DeploymentResourceIdReference", + }, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "nfvi_id": {"key": "nfviId", "type": "str"}, + "allow_software_update": {"key": "allowSoftwareUpdate", "type": "bool"}, + "configuration_type": {"key": "configurationType", "type": "str"}, + "role_override_values": {"key": "roleOverrideValues", "type": "[str]"}, + } + + _subtype_map = { + "configuration_type": { + "Open": "NetworkFunctionValueWithoutSecrets", + "Secret": "NetworkFunctionValueWithSecrets", + } + } + + def __init__( + self, + *, + network_function_definition_version_resource_reference: Optional[ + "_models.DeploymentResourceIdReference" + ] = None, + nfvi_type: Optional[Union[str, "_models.NFVIType"]] = None, + nfvi_id: Optional[str] = None, + allow_software_update: Optional[bool] = None, + role_override_values: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_function_definition_version_resource_reference: The network function + definition version resource reference. + :paramtype network_function_definition_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :keyword nfvi_type: The nfvi type for the network function. Known values are: "Unknown", + "AzureArcKubernetes", "AzureCore", and "AzureOperatorNexus". + :paramtype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :keyword nfvi_id: The nfviId for the network function. + :paramtype nfvi_id: str + :keyword allow_software_update: Indicates if software updates are allowed during deployment. + :paramtype allow_software_update: bool + :keyword role_override_values: The role configuration override values from the user. + :paramtype role_override_values: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.publisher_name = None + self.publisher_scope = None + self.network_function_definition_group_name = None + self.network_function_definition_version = None + self.network_function_definition_offering_location = None + self.network_function_definition_version_resource_reference = ( + network_function_definition_version_resource_reference + ) + self.nfvi_type = nfvi_type + self.nfvi_id = nfvi_id + self.allow_software_update = allow_software_update + self.configuration_type: Optional[str] = None + self.role_override_values = role_override_values + + +class NetworkFunctionValueWithoutSecrets( + NetworkFunctionPropertiesFormat +): # pylint: disable=too-many-instance-attributes + """NetworkFunction with no secrets. + + 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 provisioning_state: The provisioning state of the network function resource. Known values + are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the network function. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar network_function_definition_group_name: The network function definition group name for + the network function. + :vartype network_function_definition_group_name: str + :ivar network_function_definition_version: The network function definition version for the + network function. + :vartype network_function_definition_version: str + :ivar network_function_definition_offering_location: The location of the network function + definition offering. + :vartype network_function_definition_offering_location: str + :ivar network_function_definition_version_resource_reference: The network function definition + version resource reference. + :vartype network_function_definition_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar nfvi_type: The nfvi type for the network function. Known values are: "Unknown", + "AzureArcKubernetes", "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :ivar nfvi_id: The nfviId for the network function. + :vartype nfvi_id: str + :ivar allow_software_update: Indicates if software updates are allowed during deployment. + :vartype allow_software_update: bool + :ivar configuration_type: The value which indicates if NF values are secrets. Required. Known + values are: "Unknown", "Secret", and "Open". + :vartype configuration_type: str or + ~azure.mgmt.hybridnetwork.models.NetworkFunctionConfigurationType + :ivar role_override_values: The role configuration override values from the user. + :vartype role_override_values: list[str] + :ivar deployment_values: The JSON-serialized deployment values from the user. + :vartype deployment_values: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "network_function_definition_group_name": {"readonly": True}, + "network_function_definition_version": {"readonly": True}, + "network_function_definition_offering_location": {"readonly": True}, + "configuration_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "network_function_definition_group_name": {"key": "networkFunctionDefinitionGroupName", "type": "str"}, + "network_function_definition_version": {"key": "networkFunctionDefinitionVersion", "type": "str"}, + "network_function_definition_offering_location": { + "key": "networkFunctionDefinitionOfferingLocation", + "type": "str", + }, + "network_function_definition_version_resource_reference": { + "key": "networkFunctionDefinitionVersionResourceReference", + "type": "DeploymentResourceIdReference", + }, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "nfvi_id": {"key": "nfviId", "type": "str"}, + "allow_software_update": {"key": "allowSoftwareUpdate", "type": "bool"}, + "configuration_type": {"key": "configurationType", "type": "str"}, + "role_override_values": {"key": "roleOverrideValues", "type": "[str]"}, + "deployment_values": {"key": "deploymentValues", "type": "str"}, + } + + def __init__( + self, + *, + network_function_definition_version_resource_reference: Optional[ + "_models.DeploymentResourceIdReference" + ] = None, + nfvi_type: Optional[Union[str, "_models.NFVIType"]] = None, + nfvi_id: Optional[str] = None, + allow_software_update: Optional[bool] = None, + role_override_values: Optional[List[str]] = None, + deployment_values: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_function_definition_version_resource_reference: The network function + definition version resource reference. + :paramtype network_function_definition_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :keyword nfvi_type: The nfvi type for the network function. Known values are: "Unknown", + "AzureArcKubernetes", "AzureCore", and "AzureOperatorNexus". + :paramtype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :keyword nfvi_id: The nfviId for the network function. + :paramtype nfvi_id: str + :keyword allow_software_update: Indicates if software updates are allowed during deployment. + :paramtype allow_software_update: bool + :keyword role_override_values: The role configuration override values from the user. + :paramtype role_override_values: list[str] + :keyword deployment_values: The JSON-serialized deployment values from the user. + :paramtype deployment_values: str + """ + super().__init__( + network_function_definition_version_resource_reference=network_function_definition_version_resource_reference, + nfvi_type=nfvi_type, + nfvi_id=nfvi_id, + allow_software_update=allow_software_update, + role_override_values=role_override_values, + **kwargs + ) + self.configuration_type: str = "Open" + self.deployment_values = deployment_values + + +class NetworkFunctionValueWithSecrets(NetworkFunctionPropertiesFormat): # pylint: disable=too-many-instance-attributes + """NetworkFunction with secrets. + + 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 provisioning_state: The provisioning state of the network function resource. Known values + are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the network function. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar network_function_definition_group_name: The network function definition group name for + the network function. + :vartype network_function_definition_group_name: str + :ivar network_function_definition_version: The network function definition version for the + network function. + :vartype network_function_definition_version: str + :ivar network_function_definition_offering_location: The location of the network function + definition offering. + :vartype network_function_definition_offering_location: str + :ivar network_function_definition_version_resource_reference: The network function definition + version resource reference. + :vartype network_function_definition_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar nfvi_type: The nfvi type for the network function. Known values are: "Unknown", + "AzureArcKubernetes", "AzureCore", and "AzureOperatorNexus". + :vartype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :ivar nfvi_id: The nfviId for the network function. + :vartype nfvi_id: str + :ivar allow_software_update: Indicates if software updates are allowed during deployment. + :vartype allow_software_update: bool + :ivar configuration_type: The value which indicates if NF values are secrets. Required. Known + values are: "Unknown", "Secret", and "Open". + :vartype configuration_type: str or + ~azure.mgmt.hybridnetwork.models.NetworkFunctionConfigurationType + :ivar role_override_values: The role configuration override values from the user. + :vartype role_override_values: list[str] + :ivar secret_deployment_values: The JSON-serialized secret deployment values from the user. + This contains secrets like passwords,keys etc. + :vartype secret_deployment_values: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "network_function_definition_group_name": {"readonly": True}, + "network_function_definition_version": {"readonly": True}, + "network_function_definition_offering_location": {"readonly": True}, + "configuration_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "network_function_definition_group_name": {"key": "networkFunctionDefinitionGroupName", "type": "str"}, + "network_function_definition_version": {"key": "networkFunctionDefinitionVersion", "type": "str"}, + "network_function_definition_offering_location": { + "key": "networkFunctionDefinitionOfferingLocation", + "type": "str", + }, + "network_function_definition_version_resource_reference": { + "key": "networkFunctionDefinitionVersionResourceReference", + "type": "DeploymentResourceIdReference", + }, + "nfvi_type": {"key": "nfviType", "type": "str"}, + "nfvi_id": {"key": "nfviId", "type": "str"}, + "allow_software_update": {"key": "allowSoftwareUpdate", "type": "bool"}, + "configuration_type": {"key": "configurationType", "type": "str"}, + "role_override_values": {"key": "roleOverrideValues", "type": "[str]"}, + "secret_deployment_values": {"key": "secretDeploymentValues", "type": "str"}, + } + + def __init__( + self, + *, + network_function_definition_version_resource_reference: Optional[ + "_models.DeploymentResourceIdReference" + ] = None, + nfvi_type: Optional[Union[str, "_models.NFVIType"]] = None, + nfvi_id: Optional[str] = None, + allow_software_update: Optional[bool] = None, + role_override_values: Optional[List[str]] = None, + secret_deployment_values: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_function_definition_version_resource_reference: The network function + definition version resource reference. + :paramtype network_function_definition_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :keyword nfvi_type: The nfvi type for the network function. Known values are: "Unknown", + "AzureArcKubernetes", "AzureCore", and "AzureOperatorNexus". + :paramtype nfvi_type: str or ~azure.mgmt.hybridnetwork.models.NFVIType + :keyword nfvi_id: The nfviId for the network function. + :paramtype nfvi_id: str + :keyword allow_software_update: Indicates if software updates are allowed during deployment. + :paramtype allow_software_update: bool + :keyword role_override_values: The role configuration override values from the user. + :paramtype role_override_values: list[str] + :keyword secret_deployment_values: The JSON-serialized secret deployment values from the user. + This contains secrets like passwords,keys etc. + :paramtype secret_deployment_values: str + """ + super().__init__( + network_function_definition_version_resource_reference=network_function_definition_version_resource_reference, + nfvi_type=nfvi_type, + nfvi_id=nfvi_id, + allow_software_update=allow_software_update, + role_override_values=role_override_values, + **kwargs + ) + self.configuration_type: str = "Secret" + self.secret_deployment_values = secret_deployment_values + + +class NetworkServiceDesignGroup(TrackedResource): + """network service design group resource. + + 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.hybridnetwork.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 properties: network service design group properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroupPropertiesFormat + """ + + _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"}, + "properties": {"key": "properties", "type": "NetworkServiceDesignGroupPropertiesFormat"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.NetworkServiceDesignGroupPropertiesFormat"] = 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 properties: network service design group properties. + :paramtype properties: + ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroupPropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class NetworkServiceDesignGroupListResult(_serialization.Model): + """A list of network service design group resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network service design group. + :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkServiceDesignGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.NetworkServiceDesignGroup"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of network service design group. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkServiceDesignGroupPropertiesFormat(_serialization.Model): + """network service design group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the network service design groups resource. + Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar description: The network service design group description. + :vartype description: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: The network service design group description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.description = description + + +class NetworkServiceDesignVersion(TrackedResource): + """network service design version. + + 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.hybridnetwork.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 properties: network service design version properties. + :vartype properties: + ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionPropertiesFormat + """ + + _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"}, + "properties": {"key": "properties", "type": "NetworkServiceDesignVersionPropertiesFormat"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.NetworkServiceDesignVersionPropertiesFormat"] = 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 properties: network service design version properties. + :paramtype properties: + ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionPropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class NetworkServiceDesignVersionListResult(_serialization.Model): + """A list of network service design versions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network service design versions. + :vartype value: list[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkServiceDesignVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.NetworkServiceDesignVersion"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of network service design versions. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkServiceDesignVersionPropertiesFormat(_serialization.Model): + """network service design version properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the network service design version + resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar version_state: The network service design version state. Known values are: "Unknown", + "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + :ivar description: The network service design version description. + :vartype description: str + :ivar configuration_group_schema_references: The configuration schemas to used to define the + values. + :vartype configuration_group_schema_references: dict[str, + ~azure.mgmt.hybridnetwork.models.ReferencedResource] + :ivar nfvis_from_site: The nfvis from the site. + :vartype nfvis_from_site: dict[str, ~azure.mgmt.hybridnetwork.models.NfviDetails] + :ivar resource_element_templates: List of resource element template. + :vartype resource_element_templates: + list[~azure.mgmt.hybridnetwork.models.ResourceElementTemplate] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "version_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "version_state": {"key": "versionState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "configuration_group_schema_references": { + "key": "configurationGroupSchemaReferences", + "type": "{ReferencedResource}", + }, + "nfvis_from_site": {"key": "nfvisFromSite", "type": "{NfviDetails}"}, + "resource_element_templates": {"key": "resourceElementTemplates", "type": "[ResourceElementTemplate]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + configuration_group_schema_references: Optional[Dict[str, "_models.ReferencedResource"]] = None, + nfvis_from_site: Optional[Dict[str, "_models.NfviDetails"]] = None, + resource_element_templates: Optional[List["_models.ResourceElementTemplate"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: The network service design version description. + :paramtype description: str + :keyword configuration_group_schema_references: The configuration schemas to used to define the + values. + :paramtype configuration_group_schema_references: dict[str, + ~azure.mgmt.hybridnetwork.models.ReferencedResource] + :keyword nfvis_from_site: The nfvis from the site. + :paramtype nfvis_from_site: dict[str, ~azure.mgmt.hybridnetwork.models.NfviDetails] + :keyword resource_element_templates: List of resource element template. + :paramtype resource_element_templates: + list[~azure.mgmt.hybridnetwork.models.ResourceElementTemplate] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = description + self.configuration_group_schema_references = configuration_group_schema_references + self.nfvis_from_site = nfvis_from_site + self.resource_element_templates = resource_element_templates + + +class NetworkServiceDesignVersionUpdateState(_serialization.Model): + """Publisher network service design version update request definition. + + :ivar version_state: The network service design version state. Known values are: "Unknown", + "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + """ + + _attribute_map = { + "version_state": {"key": "versionState", "type": "str"}, + } + + def __init__(self, *, version_state: Optional[Union[str, "_models.VersionState"]] = None, **kwargs: Any) -> None: + """ + :keyword version_state: The network service design version state. Known values are: "Unknown", + "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :paramtype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + """ + super().__init__(**kwargs) + self.version_state = version_state + + +class NfviDetails(_serialization.Model): + """The nfvi details. + + :ivar name: The nfvi name. + :vartype name: str + :ivar type: The nfvi type. + :vartype type: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The nfvi name. + :paramtype name: str + :keyword type: The nfvi type. + :paramtype type: str + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class NSDArtifactProfile(_serialization.Model): + """Artifact profile properties. + + :ivar artifact_store_reference: The artifact store resource id. + :vartype artifact_store_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar artifact_name: Artifact name. + :vartype artifact_name: str + :ivar artifact_version: Artifact version. + :vartype artifact_version: str + """ + + _attribute_map = { + "artifact_store_reference": {"key": "artifactStoreReference", "type": "ReferencedResource"}, + "artifact_name": {"key": "artifactName", "type": "str"}, + "artifact_version": {"key": "artifactVersion", "type": "str"}, + } + + def __init__( + self, + *, + artifact_store_reference: Optional["_models.ReferencedResource"] = None, + artifact_name: Optional[str] = None, + artifact_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_store_reference: The artifact store resource id. + :paramtype artifact_store_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword artifact_name: Artifact name. + :paramtype artifact_name: str + :keyword artifact_version: Artifact version. + :paramtype artifact_version: str + """ + super().__init__(**kwargs) + self.artifact_store_reference = artifact_store_reference + self.artifact_name = artifact_name + self.artifact_version = artifact_version + + +class OpenDeploymentResourceReference(DeploymentResourceIdReference): + """Non secret deployment resource id reference. + + All required parameters must be populated in order to send to Azure. + + :ivar id_type: The resource reference arm id type. Known values are: "Unknown", "Open", and + "Secret". + :vartype id_type: str or ~azure.mgmt.hybridnetwork.models.IdType + :ivar id: Resource ID. + :vartype id: str + """ + + _validation = { + "id_type": {"required": True}, + } + + _attribute_map = { + "id_type": {"key": "idType", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id_type: str = "Open" + self.id = id + + +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.hybridnetwork.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.hybridnetwork.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.hybridnetwork.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.hybridnetwork.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}, @@ -1442,7 +4937,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1452,7 +4947,8 @@ def __init__(self, **kwargs): 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. + """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. @@ -1472,216 +4968,353 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Pod(_serialization.Model): + """Helm Pod status properties. + + :ivar name: The name of the Pod. + :vartype name: str + :ivar namespace: The namespace of the Pod. + :vartype namespace: str + :ivar desired: Desired number of containers. + :vartype desired: int + :ivar ready: Number of ready containers. + :vartype ready: int + :ivar status: The status of a pod. Known values are: "Unknown", "Succeeded", "Failed", + "Running", "Pending", "Terminating", and "NotReady". + :vartype status: str or ~azure.mgmt.hybridnetwork.models.PodStatus + :ivar creation_time: Creation Time of Pod. + :vartype creation_time: ~datetime.datetime + :ivar events: Last 5 Pod events. + :vartype events: list[~azure.mgmt.hybridnetwork.models.PodEvent] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "desired": {"key": "desired", "type": "int"}, + "ready": {"key": "ready", "type": "int"}, + "status": {"key": "status", "type": "str"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + "events": {"key": "events", "type": "[PodEvent]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + desired: Optional[int] = None, + ready: Optional[int] = None, + status: Optional[Union[str, "_models.PodStatus"]] = None, + creation_time: Optional[datetime.datetime] = None, + events: Optional[List["_models.PodEvent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the Pod. + :paramtype name: str + :keyword namespace: The namespace of the Pod. + :paramtype namespace: str + :keyword desired: Desired number of containers. + :paramtype desired: int + :keyword ready: Number of ready containers. + :paramtype ready: int + :keyword status: The status of a pod. Known values are: "Unknown", "Succeeded", "Failed", + "Running", "Pending", "Terminating", and "NotReady". + :paramtype status: str or ~azure.mgmt.hybridnetwork.models.PodStatus + :keyword creation_time: Creation Time of Pod. + :paramtype creation_time: ~datetime.datetime + :keyword events: Last 5 Pod events. + :paramtype events: list[~azure.mgmt.hybridnetwork.models.PodEvent] + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.desired = desired + self.ready = ready + self.status = status + self.creation_time = creation_time + self.events = events + + +class PodEvent(_serialization.Model): + """Pod Event properties. + + :ivar type: The type of pod event. Known values are: "Normal" and "Warning". + :vartype type: str or ~azure.mgmt.hybridnetwork.models.PodEventType + :ivar reason: Event reason. + :vartype reason: str + :ivar message: Event message. + :vartype message: str + :ivar last_seen_time: Event Last seen. + :vartype last_seen_time: ~datetime.datetime + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "last_seen_time": {"key": "lastSeenTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.PodEventType"]] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + last_seen_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of pod event. Known values are: "Normal" and "Warning". + :paramtype type: str or ~azure.mgmt.hybridnetwork.models.PodEventType + :keyword reason: Event reason. + :paramtype reason: str + :keyword message: Event message. + :paramtype message: str + :keyword last_seen_time: Event Last seen. + :paramtype last_seen_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.type = type + self.reason = reason + self.message = message + self.last_seen_time = last_seen_time + + +class ProxyArtifactListOverview(ProxyResource): + """The proxy artifact overview. + + 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.hybridnetwork.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 ProxyArtifactOverview(ProxyResource): + """The proxy artifact overview. + + 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.hybridnetwork.models.SystemData + :ivar properties: Proxy Artifact properties overview. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ProxyArtifactOverviewPropertiesFormat + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"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"}, + "properties": {"key": "properties", "type": "ProxyArtifactOverviewPropertiesFormat"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + + +class ProxyArtifactOverviewListResult(_serialization.Model): + """The proxy artifact list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy artifacts. + :vartype value: list[~azure.mgmt.hybridnetwork.models.ProxyArtifactListOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ProxyArtifactListOverview]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ProxyArtifactListOverview"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of available proxy artifacts. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.ProxyArtifactListOverview] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyArtifactOverviewPropertiesFormat(_serialization.Model): + """Proxy Artifact overview properties. + + :ivar artifact_versions: The proxy artifact overview properties. + :vartype artifact_versions: + list[~azure.mgmt.hybridnetwork.models.ProxyArtifactOverviewPropertiesValue] + """ + + _attribute_map = { + "artifact_versions": {"key": "artifactVersions", "type": "[ProxyArtifactOverviewPropertiesValue]"}, + } + + def __init__( + self, *, artifact_versions: Optional[List["_models.ProxyArtifactOverviewPropertiesValue"]] = None, **kwargs: Any + ) -> None: + """ + :keyword artifact_versions: The proxy artifact overview properties. + :paramtype artifact_versions: + list[~azure.mgmt.hybridnetwork.models.ProxyArtifactOverviewPropertiesValue] + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.artifact_versions = artifact_versions -class OsDisk(_serialization.Model): - """Specifies information about the operating system disk used by the virtual machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. +class ProxyArtifactOverviewPropertiesValue(_serialization.Model): + """ProxyArtifactOverviewPropertiesValue. - :ivar os_type: The OS type. Known values are: "Unknown", "Windows", and "Linux". - :vartype os_type: str or ~azure.mgmt.hybridnetwork.models.OperatingSystemTypes - :ivar name: The VHD name. - :vartype name: str - :ivar vhd: The virtual hard disk. - :vartype vhd: ~azure.mgmt.hybridnetwork.models.VirtualHardDisk - :ivar disk_size_gb: Specifies the size of os disk in gigabytes. This is the fully expanded disk - size needed of the VHD image on the ASE. This disk size should be greater than the size of the - VHD provided in vhdUri. - :vartype disk_size_gb: int + :ivar artifact_type: The artifact type. Known values are: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", and "ImageFile". + :vartype artifact_type: str or ~azure.mgmt.hybridnetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + :ivar artifact_state: The artifact state. Known values are: "Unknown", "Preview", "Active", and + "Deprecated". + :vartype artifact_state: str or ~azure.mgmt.hybridnetwork.models.ArtifactState """ _attribute_map = { - "os_type": {"key": "osType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "vhd": {"key": "vhd", "type": "VirtualHardDisk"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + "artifact_version": {"key": "artifactVersion", "type": "str"}, + "artifact_state": {"key": "artifactState", "type": "str"}, } def __init__( self, *, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - name: Optional[str] = None, - vhd: Optional["_models.VirtualHardDisk"] = None, - disk_size_gb: Optional[int] = None, - **kwargs - ): - """ - :keyword os_type: The OS type. Known values are: "Unknown", "Windows", and "Linux". - :paramtype os_type: str or ~azure.mgmt.hybridnetwork.models.OperatingSystemTypes - :keyword name: The VHD name. - :paramtype name: str - :keyword vhd: The virtual hard disk. - :paramtype vhd: ~azure.mgmt.hybridnetwork.models.VirtualHardDisk - :keyword disk_size_gb: Specifies the size of os disk in gigabytes. This is the fully expanded - disk size needed of the VHD image on the ASE. This disk size should be greater than the size of - the VHD provided in vhdUri. - :paramtype disk_size_gb: int + artifact_type: Optional[Union[str, "_models.ArtifactType"]] = None, + artifact_version: Optional[str] = None, + artifact_state: Optional[Union[str, "_models.ArtifactState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword artifact_type: The artifact type. Known values are: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", and "ImageFile". + :paramtype artifact_type: str or ~azure.mgmt.hybridnetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + :keyword artifact_state: The artifact state. Known values are: "Unknown", "Preview", "Active", + and "Deprecated". + :paramtype artifact_state: str or ~azure.mgmt.hybridnetwork.models.ArtifactState """ super().__init__(**kwargs) - self.os_type = os_type - self.name = name - self.vhd = vhd - self.disk_size_gb = disk_size_gb - - -class OsProfile(_serialization.Model): - """Specifies the operating system settings for the role instance. - - :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` - **Windows-only restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** - "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", - "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", - "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", - "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length (Linux):** 1 character - :code:`
`:code:`
` **Max-length (Linux):** 64 characters :code:`
`:code:`
` - **Max-length (Windows):** 20 characters :code:`
`:code:`
`:code:`
  • ` For root access - to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\ - :code:`
    `:code:`
  • ` For a list of built-in system users on Linux that should not be used - in this field, see `Selecting User Names for Linux on Azure - `_. - :vartype admin_username: str - :ivar linux_configuration: Specifies the Linux operating system settings on the virtual - machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on - Azure-Endorsed Distributions - `_ - :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for - Non-Endorsed Distributions - `_. - :vartype linux_configuration: ~azure.mgmt.hybridnetwork.models.LinuxConfiguration - :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded - string is decoded to a binary array that is saved as a file on the virtual machine. The maximum - length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any - secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be - updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be - saved as a file. For more information see `Custom Data on Azure VMs - `_ - :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to - customize a Linux VM during creation - `_. - :vartype custom_data: str - :ivar custom_data_required: Indicates if custom data is required to deploy this role. - :vartype custom_data_required: bool - """ - - _attribute_map = { - "admin_username": {"key": "adminUsername", "type": "str"}, - "linux_configuration": {"key": "linuxConfiguration", "type": "LinuxConfiguration"}, - "custom_data": {"key": "customData", "type": "str"}, - "custom_data_required": {"key": "customDataRequired", "type": "bool"}, - } - - def __init__( - self, - *, - admin_username: Optional[str] = None, - linux_configuration: Optional["_models.LinuxConfiguration"] = None, - custom_data: Optional[str] = None, - custom_data_required: bool = True, - **kwargs - ): - """ - :keyword admin_username: Specifies the name of the administrator account. - :code:`
    `:code:`
    ` **Windows-only restriction:** Cannot end in "." - :code:`
    `:code:`
    ` **Disallowed values:** "administrator", "admin", "user", "user1", - "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", - "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", - "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". - :code:`
    `:code:`
    ` **Minimum-length (Linux):** 1 character :code:`
    `:code:`
    ` - **Max-length (Linux):** 64 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 20 - characters :code:`
    `:code:`
    `:code:`
  • ` For root access to the Linux VM, see `Using - root privileges on Linux virtual machines in Azure - `_\ - :code:`
    `:code:`
  • ` For a list of built-in system users on Linux that should not be used - in this field, see `Selecting User Names for Linux on Azure - `_. - :paramtype admin_username: str - :keyword linux_configuration: Specifies the Linux operating system settings on the virtual - machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on - Azure-Endorsed Distributions - `_ - :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for - Non-Endorsed Distributions - `_. - :paramtype linux_configuration: ~azure.mgmt.hybridnetwork.models.LinuxConfiguration - :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded - string is decoded to a binary array that is saved as a file on the virtual machine. The maximum - length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any - secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be - updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be - saved as a file. For more information see `Custom Data on Azure VMs - `_ - :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to - customize a Linux VM during creation - `_. - :paramtype custom_data: str - :keyword custom_data_required: Indicates if custom data is required to deploy this role. - :paramtype custom_data_required: bool - """ - super().__init__(**kwargs) - self.admin_username = admin_username - self.linux_configuration = linux_configuration - self.custom_data = custom_data - self.custom_data_required = custom_data_required - - -class PreviewSubscription(_serialization.Model): - """Customer subscription which can use a sku. + self.artifact_type = artifact_type + self.artifact_version = artifact_version + self.artifact_state = artifact_state + + +class ProxyArtifactVersionsListOverview(ProxyResource): + """The proxy artifact overview. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The preview subscription ID. - :vartype name: str - :ivar id: The ARM ID of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar type: The type of the resource. + :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: The system meta data relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar provisioning_state: The provisioning state of the PreviewSubscription resource. Known - values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and - "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar properties: Proxy Artifact overview properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.ProxyArtifactOverviewPropertiesValue """ _validation = { - "name": {"readonly": True}, "id": {"readonly": True}, + "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "properties": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "ProxyArtifactOverviewPropertiesValue"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.id = None - self.type = None - self.system_data = None - self.provisioning_state = None + self.properties = None -class PreviewSubscriptionsList(_serialization.Model): - """A list of customer subscriptions which can use a sku. +class ProxyArtifactVersionsOverviewListResult(_serialization.Model): + """The proxy artifact list result. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of preview subscriptions. - :vartype value: list[~azure.mgmt.hybridnetwork.models.PreviewSubscription] + :ivar value: A list of available proxy artifacts. + :vartype value: list[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -1691,25 +5324,29 @@ class PreviewSubscriptionsList(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[PreviewSubscription]"}, + "value": {"key": "value", "type": "[ProxyArtifactVersionsListOverview]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PreviewSubscription"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.ProxyArtifactVersionsListOverview"]] = None, **kwargs: Any + ) -> None: """ - :keyword value: A list of preview subscriptions. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.PreviewSubscription] + :keyword value: A list of available proxy artifacts. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] """ super().__init__(**kwargs) self.value = value self.next_link = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +class Publisher(TrackedResource): + """publisher resource. 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 @@ -1718,23 +5355,202 @@ class ProxyResource(Resource): :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.hybridnetwork.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 properties: Publisher properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.PublisherPropertiesFormat + :ivar identity: The managed identity of the publisher, if configured. + :vartype identity: ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentity """ _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"}, + "properties": {"key": "properties", "type": "PublisherPropertiesFormat"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.PublisherPropertiesFormat"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 properties: Publisher properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.PublisherPropertiesFormat + :keyword identity: The managed identity of the publisher, if configured. + :paramtype identity: ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentity + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.identity = identity + + +class PublisherListResult(_serialization.Model): + """A list of publishers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of publishers. + :vartype value: list[~azure.mgmt.hybridnetwork.models.Publisher] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Publisher]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Publisher"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of publishers. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.Publisher] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PublisherPropertiesFormat(_serialization.Model): + """publisher properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the publisher resource. Known values are: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", and + "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar scope: The publisher scope. Known values are: "Unknown" and "Private". + :vartype scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "scope": {"key": "scope", "type": "str"}, + } + + def __init__(self, *, scope: Optional[Union[str, "_models.PublisherScope"]] = None, **kwargs: Any) -> None: + """ + :keyword scope: The publisher scope. Known values are: "Unknown" and "Private". + :paramtype scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.scope = scope + + +class ReferencedResource(_serialization.Model): + """Reference to another resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class ReplicaSet(_serialization.Model): + """Helm ReplicaSet status properties. + + :ivar name: The name of the replicaSet. + :vartype name: str + :ivar namespace: The namespace of the replicaSet. + :vartype namespace: str + :ivar desired: Desired number of pods. + :vartype desired: int + :ivar ready: Number of ready pods. + :vartype ready: int + :ivar current: Number of current pods. + :vartype current: int + :ivar creation_time: Creation Time of replicaSet. + :vartype creation_time: ~datetime.datetime + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "desired": {"key": "desired", "type": "int"}, + "ready": {"key": "ready", "type": "int"}, + "current": {"key": "current", "type": "int"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + desired: Optional[int] = None, + ready: Optional[int] = None, + current: Optional[int] = None, + creation_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the replicaSet. + :paramtype name: str + :keyword namespace: The namespace of the replicaSet. + :paramtype namespace: str + :keyword desired: Desired number of pods. + :paramtype desired: int + :keyword ready: Number of ready pods. + :paramtype ready: int + :keyword current: Number of current pods. + :paramtype current: int + :keyword creation_time: Creation Time of replicaSet. + :paramtype creation_time: ~datetime.datetime + """ super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.desired = desired + self.ready = ready + self.current = current + self.creation_time = creation_time class RequestMetadata(_serialization.Model): @@ -1773,8 +5589,8 @@ def __init__( http_method: Union[str, "_models.HttpMethod"], serialized_body: str, api_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword relative_path: The relative path of the request. Required. :paramtype relative_path: str @@ -1793,270 +5609,543 @@ def __init__( self.api_version = api_version -class RoleInstance(_serialization.Model): - """The role instance sub resource. +class Resources(_serialization.Model): + """The resources of the network function component. + + :ivar deployments: Deployments that are related to component resource. + :vartype deployments: list[~azure.mgmt.hybridnetwork.models.Deployment] + :ivar pods: Pods related to component resource. + :vartype pods: list[~azure.mgmt.hybridnetwork.models.Pod] + :ivar replica_sets: Replica sets related to component resource. + :vartype replica_sets: list[~azure.mgmt.hybridnetwork.models.ReplicaSet] + :ivar stateful_sets: Stateful sets related to component resource. + :vartype stateful_sets: list[~azure.mgmt.hybridnetwork.models.StatefulSet] + :ivar daemon_sets: Daemonsets related to component resource. + :vartype daemon_sets: list[~azure.mgmt.hybridnetwork.models.DaemonSet] + """ + + _attribute_map = { + "deployments": {"key": "deployments", "type": "[Deployment]"}, + "pods": {"key": "pods", "type": "[Pod]"}, + "replica_sets": {"key": "replicaSets", "type": "[ReplicaSet]"}, + "stateful_sets": {"key": "statefulSets", "type": "[StatefulSet]"}, + "daemon_sets": {"key": "daemonSets", "type": "[DaemonSet]"}, + } + + def __init__( + self, + *, + deployments: Optional[List["_models.Deployment"]] = None, + pods: Optional[List["_models.Pod"]] = None, + replica_sets: Optional[List["_models.ReplicaSet"]] = None, + stateful_sets: Optional[List["_models.StatefulSet"]] = None, + daemon_sets: Optional[List["_models.DaemonSet"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword deployments: Deployments that are related to component resource. + :paramtype deployments: list[~azure.mgmt.hybridnetwork.models.Deployment] + :keyword pods: Pods related to component resource. + :paramtype pods: list[~azure.mgmt.hybridnetwork.models.Pod] + :keyword replica_sets: Replica sets related to component resource. + :paramtype replica_sets: list[~azure.mgmt.hybridnetwork.models.ReplicaSet] + :keyword stateful_sets: Stateful sets related to component resource. + :paramtype stateful_sets: list[~azure.mgmt.hybridnetwork.models.StatefulSet] + :keyword daemon_sets: Daemonsets related to component resource. + :paramtype daemon_sets: list[~azure.mgmt.hybridnetwork.models.DaemonSet] + """ + super().__init__(**kwargs) + self.deployments = deployments + self.pods = pods + self.replica_sets = replica_sets + self.stateful_sets = stateful_sets + self.daemon_sets = daemon_sets + + +class SecretDeploymentResourceReference(DeploymentResourceIdReference): + """Secret deployment resource id reference. + + All required parameters must be populated in order to send to Azure. + + :ivar id_type: The resource reference arm id type. Known values are: "Unknown", "Open", and + "Secret". + :vartype id_type: str or ~azure.mgmt.hybridnetwork.models.IdType + :ivar id: Resource ID. + :vartype id: str + """ + + _validation = { + "id_type": {"required": True}, + } + + _attribute_map = { + "id_type": {"key": "idType", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id_type: str = "Secret" + self.id = id + + +class Site(TrackedResource): + """Site resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The role instance name. - :vartype name: str - :ivar id: The ARM ID of the resource. + 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 type: The type of the resource. + :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: The system meta data relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar provisioning_state: The provisioning state of the RoleInstance resource. Known values - are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar operational_state: The operational state of the role instance. Known values are: - "Unknown", "Stopped", "Running", "Stopping", and "Starting". - :vartype operational_state: str or ~azure.mgmt.hybridnetwork.models.OperationalState + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Site properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.SitePropertiesFormat """ _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "operational_state": {"key": "properties.operationalState", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "SitePropertiesFormat"}, } def __init__( self, *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - type: Optional[str] = None, - operational_state: Optional[Union[str, "_models.OperationalState"]] = None, - **kwargs - ): + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SitePropertiesFormat"] = None, + **kwargs: Any + ) -> None: """ - :keyword name: The role instance name. - :paramtype name: str - :keyword id: The ARM ID of the resource. - :paramtype id: str - :keyword type: The type of the resource. - :paramtype type: str - :keyword operational_state: The operational state of the role instance. Known values are: - "Unknown", "Stopped", "Running", "Stopping", and "Starting". - :paramtype operational_state: str or ~azure.mgmt.hybridnetwork.models.OperationalState + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Site properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.SitePropertiesFormat + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class SiteListResult(_serialization.Model): + """Response for sites API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of sites in a resource group. + :vartype value: list[~azure.mgmt.hybridnetwork.models.Site] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Site]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Site"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of sites in a resource group. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.Site] """ super().__init__(**kwargs) - self.name = name - self.id = id - self.type = type - self.system_data = None - self.provisioning_state = None - self.operational_state = operational_state + self.value = value + self.next_link = None -class SkuCredential(_serialization.Model): - """The Sku credential definition. +class SiteNetworkService(TrackedResource): + """Site network service resource. - :ivar username: The username of the sku credential. - :vartype username: str - :ivar acr_token: The credential value. - :vartype acr_token: str - :ivar acr_server_url: The Acr server url. - :vartype acr_server_url: str - :ivar repositories: The repositories that could be accessed using the current credential. - :vartype repositories: list[str] - :ivar expiry: The UTC time when credential will expire. - :vartype expiry: ~datetime.datetime + 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.hybridnetwork.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 properties: Site network service properties. + :vartype properties: ~azure.mgmt.hybridnetwork.models.SiteNetworkServicePropertiesFormat + :ivar identity: The managed identity of the Site network service, if configured. + :vartype identity: ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentity + :ivar sku: Sku of the site network service. + :vartype sku: ~azure.mgmt.hybridnetwork.models.Sku """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + _attribute_map = { - "username": {"key": "username", "type": "str"}, - "acr_token": {"key": "acrToken", "type": "str"}, - "acr_server_url": {"key": "acrServerUrl", "type": "str"}, - "repositories": {"key": "repositories", "type": "[str]"}, - "expiry": {"key": "expiry", "type": "iso-8601"}, + "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"}, + "properties": {"key": "properties", "type": "SiteNetworkServicePropertiesFormat"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, } def __init__( self, *, - username: Optional[str] = None, - acr_token: Optional[str] = None, - acr_server_url: Optional[str] = None, - repositories: Optional[List[str]] = None, - expiry: Optional[datetime.datetime] = None, - **kwargs - ): + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SiteNetworkServicePropertiesFormat"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: """ - :keyword username: The username of the sku credential. - :paramtype username: str - :keyword acr_token: The credential value. - :paramtype acr_token: str - :keyword acr_server_url: The Acr server url. - :paramtype acr_server_url: str - :keyword repositories: The repositories that could be accessed using the current credential. - :paramtype repositories: list[str] - :keyword expiry: The UTC time when credential will expire. - :paramtype expiry: ~datetime.datetime + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Site network service properties. + :paramtype properties: ~azure.mgmt.hybridnetwork.models.SiteNetworkServicePropertiesFormat + :keyword identity: The managed identity of the Site network service, if configured. + :paramtype identity: ~azure.mgmt.hybridnetwork.models.ManagedServiceIdentity + :keyword sku: Sku of the site network service. + :paramtype sku: ~azure.mgmt.hybridnetwork.models.Sku """ - super().__init__(**kwargs) - self.username = username - self.acr_token = acr_token - self.acr_server_url = acr_server_url - self.repositories = repositories - self.expiry = expiry + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.identity = identity + self.sku = sku + +class SiteNetworkServiceListResult(_serialization.Model): + """Response for site network services API service call. -class SkuOverview(_serialization.Model): - """The network function sku overview. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar sku_name: The vendor sku name. - :vartype sku_name: str - :ivar sku_type: The vendor sku type. Known values are: "Unknown", "EvolvedPacketCore", "SDWAN", - and "Firewall". - :vartype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType + :ivar value: A list of site network services in a resource group. + :vartype value: list[~azure.mgmt.hybridnetwork.models.SiteNetworkService] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { - "sku_name": {"key": "skuName", "type": "str"}, - "sku_type": {"key": "skuType", "type": "str"}, + "value": {"key": "value", "type": "[SiteNetworkService]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, sku_name: Optional[str] = None, sku_type: Optional[Union[str, "_models.SkuType"]] = None, **kwargs - ): + def __init__(self, *, value: Optional[List["_models.SiteNetworkService"]] = None, **kwargs: Any) -> None: """ - :keyword sku_name: The vendor sku name. - :paramtype sku_name: str - :keyword sku_type: The vendor sku type. Known values are: "Unknown", "EvolvedPacketCore", - "SDWAN", and "Firewall". - :paramtype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType + :keyword value: A list of site network services in a resource group. + :paramtype value: list[~azure.mgmt.hybridnetwork.models.SiteNetworkService] """ super().__init__(**kwargs) - self.sku_name = sku_name - self.sku_type = sku_type + self.value = value + self.next_link = None + +class SiteNetworkServicePropertiesFormat(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Site network service properties. -class SshConfiguration(_serialization.Model): - """SSH configuration for Linux based VMs running on Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. - :vartype public_keys: list[~azure.mgmt.hybridnetwork.models.SshPublicKey] + :ivar provisioning_state: The provisioning state of the site network service resource. Known + values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", + and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~azure.mgmt.hybridnetwork.models.ManagedResourceGroupConfiguration + :ivar site_reference: The site details. + :vartype site_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :ivar publisher_name: The publisher name for the site network service. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Known values are: "Unknown" and "Private". + :vartype publisher_scope: str or ~azure.mgmt.hybridnetwork.models.PublisherScope + :ivar network_service_design_group_name: The network service design group name for the site + network service. + :vartype network_service_design_group_name: str + :ivar network_service_design_version_name: The network service design version for the site + network service. + :vartype network_service_design_version_name: str + :ivar network_service_design_version_offering_location: The location of the network service + design offering. + :vartype network_service_design_version_offering_location: str + :ivar network_service_design_version_resource_reference: The network service design version + resource reference. + :vartype network_service_design_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :ivar desired_state_configuration_group_value_references: The goal state of the site network + service resource. This has references to the configuration group value objects that describe + the desired state of the site network service. + :vartype desired_state_configuration_group_value_references: dict[str, + ~azure.mgmt.hybridnetwork.models.ReferencedResource] + :ivar last_state_network_service_design_version_name: The network service design version for + the site network service. + :vartype last_state_network_service_design_version_name: str + :ivar last_state_configuration_group_value_references: The last state of the site network + service resource. + :vartype last_state_configuration_group_value_references: dict[str, + ~azure.mgmt.hybridnetwork.models.ReferencedResource] """ + _validation = { + "provisioning_state": {"readonly": True}, + "publisher_name": {"readonly": True}, + "publisher_scope": {"readonly": True}, + "network_service_design_group_name": {"readonly": True}, + "network_service_design_version_name": {"readonly": True}, + "network_service_design_version_offering_location": {"readonly": True}, + "last_state_network_service_design_version_name": {"readonly": True}, + "last_state_configuration_group_value_references": {"readonly": True}, + } + _attribute_map = { - "public_keys": {"key": "publicKeys", "type": "[SshPublicKey]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "managed_resource_group_configuration": { + "key": "managedResourceGroupConfiguration", + "type": "ManagedResourceGroupConfiguration", + }, + "site_reference": {"key": "siteReference", "type": "ReferencedResource"}, + "publisher_name": {"key": "publisherName", "type": "str"}, + "publisher_scope": {"key": "publisherScope", "type": "str"}, + "network_service_design_group_name": {"key": "networkServiceDesignGroupName", "type": "str"}, + "network_service_design_version_name": {"key": "networkServiceDesignVersionName", "type": "str"}, + "network_service_design_version_offering_location": { + "key": "networkServiceDesignVersionOfferingLocation", + "type": "str", + }, + "network_service_design_version_resource_reference": { + "key": "networkServiceDesignVersionResourceReference", + "type": "DeploymentResourceIdReference", + }, + "desired_state_configuration_group_value_references": { + "key": "desiredStateConfigurationGroupValueReferences", + "type": "{ReferencedResource}", + }, + "last_state_network_service_design_version_name": { + "key": "lastStateNetworkServiceDesignVersionName", + "type": "str", + }, + "last_state_configuration_group_value_references": { + "key": "lastStateConfigurationGroupValueReferences", + "type": "{ReferencedResource}", + }, } - def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs): + def __init__( + self, + *, + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = None, + site_reference: Optional["_models.ReferencedResource"] = None, + network_service_design_version_resource_reference: Optional["_models.DeploymentResourceIdReference"] = None, + desired_state_configuration_group_value_references: Optional[Dict[str, "_models.ReferencedResource"]] = None, + **kwargs: Any + ) -> None: """ - :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. - :paramtype public_keys: list[~azure.mgmt.hybridnetwork.models.SshPublicKey] + :keyword managed_resource_group_configuration: Managed resource group configuration. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.hybridnetwork.models.ManagedResourceGroupConfiguration + :keyword site_reference: The site details. + :paramtype site_reference: ~azure.mgmt.hybridnetwork.models.ReferencedResource + :keyword network_service_design_version_resource_reference: The network service design version + resource reference. + :paramtype network_service_design_version_resource_reference: + ~azure.mgmt.hybridnetwork.models.DeploymentResourceIdReference + :keyword desired_state_configuration_group_value_references: The goal state of the site network + service resource. This has references to the configuration group value objects that describe + the desired state of the site network service. + :paramtype desired_state_configuration_group_value_references: dict[str, + ~azure.mgmt.hybridnetwork.models.ReferencedResource] """ super().__init__(**kwargs) - self.public_keys = public_keys - + self.provisioning_state = None + self.managed_resource_group_configuration = managed_resource_group_configuration + self.site_reference = site_reference + self.publisher_name = None + self.publisher_scope = None + self.network_service_design_group_name = None + self.network_service_design_version_name = None + self.network_service_design_version_offering_location = None + self.network_service_design_version_resource_reference = network_service_design_version_resource_reference + self.desired_state_configuration_group_value_references = desired_state_configuration_group_value_references + self.last_state_network_service_design_version_name = None + self.last_state_configuration_group_value_references = None + + +class SitePropertiesFormat(_serialization.Model): + """Site properties. -class SshPublicKey(_serialization.Model): - """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar path: Specifies the full path on the created VM where ssh public key is stored. If the - file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :vartype path: str - :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The - key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `:code:`
    ` For creating - ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. - :vartype key_data: str + :ivar provisioning_state: The provisioning state of the site resource. **TODO**\ : Confirm if + this is needed. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", and "Converging". + :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState + :ivar nfvis: List of NFVIs. + :vartype nfvis: list[~azure.mgmt.hybridnetwork.models.NFVIs] + :ivar site_network_service_references: The list of site network services on the site. + :vartype site_network_service_references: + list[~azure.mgmt.hybridnetwork.models.ReferencedResource] """ + _validation = { + "provisioning_state": {"readonly": True}, + "site_network_service_references": {"readonly": True}, + } + _attribute_map = { - "path": {"key": "path", "type": "str"}, - "key_data": {"key": "keyData", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "nfvis": {"key": "nfvis", "type": "[NFVIs]"}, + "site_network_service_references": {"key": "siteNetworkServiceReferences", "type": "[ReferencedResource]"}, } - def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None, **kwargs): + def __init__(self, *, nfvis: Optional[List["_models.NFVIs"]] = None, **kwargs: Any) -> None: """ - :keyword path: Specifies the full path on the created VM where ssh public key is stored. If the - file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :paramtype path: str - :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The - key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `:code:`
    ` For creating - ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. - :paramtype key_data: str + :keyword nfvis: List of NFVIs. + :paramtype nfvis: list[~azure.mgmt.hybridnetwork.models.NFVIs] """ super().__init__(**kwargs) - self.path = path - self.key_data = key_data + self.provisioning_state = None + self.nfvis = nfvis + self.site_network_service_references = None -class StorageProfile(_serialization.Model): - """Specifies the storage settings for the virtual machine disks. +class Sku(_serialization.Model): + """Sku, to be associated with a SiteNetworkService. - :ivar image_reference: The image reference properties. - :vartype image_reference: ~azure.mgmt.hybridnetwork.models.ImageReference - :ivar os_disk: Specifies information about the operating system disk used by the virtual - machine. - :vartype os_disk: ~azure.mgmt.hybridnetwork.models.OsDisk - :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual - machine. - :vartype data_disks: list[~azure.mgmt.hybridnetwork.models.DataDisk] + 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 name: Name of this Sku. Required. Known values are: "Basic" and "Standard". + :vartype name: str or ~azure.mgmt.hybridnetwork.models.SkuName + :ivar tier: The SKU tier based on the SKU name. Known values are: "Basic" and "Standard". + :vartype tier: str or ~azure.mgmt.hybridnetwork.models.SkuTier """ + _validation = { + "name": {"required": True}, + "tier": {"readonly": True}, + } + _attribute_map = { - "image_reference": {"key": "imageReference", "type": "ImageReference"}, - "os_disk": {"key": "osDisk", "type": "OsDisk"}, - "data_disks": {"key": "dataDisks", "type": "[DataDisk]"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } - def __init__( - self, - *, - image_reference: Optional["_models.ImageReference"] = None, - os_disk: Optional["_models.OsDisk"] = None, - data_disks: Optional[List["_models.DataDisk"]] = None, - **kwargs - ): + def __init__(self, *, name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: """ - :keyword image_reference: The image reference properties. - :paramtype image_reference: ~azure.mgmt.hybridnetwork.models.ImageReference - :keyword os_disk: Specifies information about the operating system disk used by the virtual - machine. - :paramtype os_disk: ~azure.mgmt.hybridnetwork.models.OsDisk - :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual - machine. - :paramtype data_disks: list[~azure.mgmt.hybridnetwork.models.DataDisk] + :keyword name: Name of this Sku. Required. Known values are: "Basic" and "Standard". + :paramtype name: str or ~azure.mgmt.hybridnetwork.models.SkuName """ super().__init__(**kwargs) - self.image_reference = image_reference - self.os_disk = os_disk - self.data_disks = data_disks + self.name = name + self.tier = None -class SubResource(_serialization.Model): - """Reference to another sub resource. +class StatefulSet(_serialization.Model): + """Helm StatefulSet status properties. - :ivar id: Resource ID. - :vartype id: str + :ivar name: The name of the statefulset. + :vartype name: str + :ivar namespace: The namespace of the statefulset. + :vartype namespace: str + :ivar desired: Desired number of pods. + :vartype desired: int + :ivar ready: Number of ready pods. + :vartype ready: int + :ivar creation_time: Creation Time of statefulset. + :vartype creation_time: ~datetime.datetime """ _attribute_map = { - "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "desired": {"key": "desired", "type": "int"}, + "ready": {"key": "ready", "type": "int"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + desired: Optional[int] = None, + ready: Optional[int] = None, + creation_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword id: Resource ID. - :paramtype id: str + :keyword name: The name of the statefulset. + :paramtype name: str + :keyword namespace: The namespace of the statefulset. + :paramtype namespace: str + :keyword desired: Desired number of pods. + :paramtype desired: int + :keyword ready: Number of ready pods. + :paramtype ready: int + :keyword creation_time: Creation Time of statefulset. + :paramtype creation_time: ~datetime.datetime """ super().__init__(**kwargs) - self.id = id + self.name = name + self.namespace = namespace + self.desired = desired + self.ready = ready + self.creation_time = creation_time class SystemData(_serialization.Model): @@ -2096,8 +6185,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2134,7 +6223,7 @@ class TagsObject(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2143,351 +6232,139 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): self.tags = tags -class Vendor(ProxyResource): - """Vendor resource. +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. 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: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar provisioning_state: The provisioning state of the vendor resource. Known values are: - "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar skus: A list of IDs of the vendor skus offered by the vendor. - :vartype skus: list[~azure.mgmt.hybridnetwork.models.SubResource] + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "skus": {"readonly": True}, + "principal_id": {"readonly": True}, + "client_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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "skus": {"key": "properties.skus", "type": "[SubResource]"}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.system_data = None - self.provisioning_state = None - self.skus = None - + self.principal_id = None + self.client_id = None -class VendorListResult(_serialization.Model): - """Response for vendors API service call. - Variables are only populated by the server, and will be ignored when sending a request. +class VhdImageArtifactProfile(_serialization.Model): + """Vhd artifact profile. - :ivar value: A list of vendors. - :vartype value: list[~azure.mgmt.hybridnetwork.models.Vendor] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str + :ivar vhd_name: Vhd name. + :vartype vhd_name: str + :ivar vhd_version: Vhd version. + :vartype vhd_version: str """ - _validation = { - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Vendor]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "vhd_name": {"key": "vhdName", "type": "str"}, + "vhd_version": {"key": "vhdVersion", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Vendor"]] = None, **kwargs): + def __init__(self, *, vhd_name: Optional[str] = None, vhd_version: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: A list of vendors. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.Vendor] + :keyword vhd_name: Vhd name. + :paramtype vhd_name: str + :keyword vhd_version: Vhd version. + :paramtype vhd_version: str """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.vhd_name = vhd_name + self.vhd_version = vhd_version -class VendorNetworkFunction(ProxyResource): - """Vendor network function sub resource. - - Variables are only populated by the server, and will be ignored when sending a request. +class VhdImageMappingRuleProfile(_serialization.Model): + """Vhd mapping rule profile. - :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: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar provisioning_state: The provisioning state of the vendor network function sub resource. - Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and - "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar vendor_provisioning_state: The vendor controlled provisioning state of the vendor network - function. Known values are: "Unknown", "NotProvisioned", "Provisioning", "Provisioned", - "Deprovisioned", and "UserDataValidationFailed". - :vartype vendor_provisioning_state: str or - ~azure.mgmt.hybridnetwork.models.VendorProvisioningState - :ivar sku_name: The name of the sku. Once set, it cannot be updated. - :vartype sku_name: str - :ivar sku_type: The sku type. Known values are: "Unknown", "EvolvedPacketCore", "SDWAN", and - "Firewall". - :vartype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType - :ivar network_function_vendor_configurations: An array of network function vendor - configurations. - :vartype network_function_vendor_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkFunctionVendorConfiguration] + :ivar user_configuration: List of values. + :vartype user_configuration: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "sku_name": {"readonly": True}, - "sku_type": {"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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "vendor_provisioning_state": {"key": "properties.vendorProvisioningState", "type": "str"}, - "sku_name": {"key": "properties.skuName", "type": "str"}, - "sku_type": {"key": "properties.skuType", "type": "str"}, - "network_function_vendor_configurations": { - "key": "properties.networkFunctionVendorConfigurations", - "type": "[NetworkFunctionVendorConfiguration]", - }, + "user_configuration": {"key": "userConfiguration", "type": "str"}, } - def __init__( - self, - *, - vendor_provisioning_state: Optional[Union[str, "_models.VendorProvisioningState"]] = None, - network_function_vendor_configurations: Optional[List["_models.NetworkFunctionVendorConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, user_configuration: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword vendor_provisioning_state: The vendor controlled provisioning state of the vendor - network function. Known values are: "Unknown", "NotProvisioned", "Provisioning", "Provisioned", - "Deprovisioned", and "UserDataValidationFailed". - :paramtype vendor_provisioning_state: str or - ~azure.mgmt.hybridnetwork.models.VendorProvisioningState - :keyword network_function_vendor_configurations: An array of network function vendor - configurations. - :paramtype network_function_vendor_configurations: - list[~azure.mgmt.hybridnetwork.models.NetworkFunctionVendorConfiguration] + :keyword user_configuration: List of values. + :paramtype user_configuration: str """ super().__init__(**kwargs) - self.system_data = None - self.provisioning_state = None - self.vendor_provisioning_state = vendor_provisioning_state - self.sku_name = None - self.sku_type = None - self.network_function_vendor_configurations = network_function_vendor_configurations + self.user_configuration = user_configuration -class VendorNetworkFunctionListResult(_serialization.Model): - """Response for vendors API service call. +class VirtualNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Virtual network function network function definition version properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of vendor network functions. - :vartype value: list[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[VendorNetworkFunction]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.VendorNetworkFunction"]] = None, **kwargs): - """ - :keyword value: A list of vendor network functions. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class VendorSku(ProxyResource): # pylint: disable=too-many-instance-attributes - """Sku sub resource. - - 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: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridnetwork.models.SystemData - :ivar provisioning_state: The provisioning state of the vendor sku sub resource. Known values - are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", and "Converging". :vartype provisioning_state: str or ~azure.mgmt.hybridnetwork.models.ProvisioningState - :ivar sku_type: The sku type. Known values are: "Unknown", "EvolvedPacketCore", "SDWAN", and - "Firewall". - :vartype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType - :ivar deployment_mode: The sku deployment mode. Known values are: "Unknown", "Azure", and - "PrivateEdgeZone". - :vartype deployment_mode: str or ~azure.mgmt.hybridnetwork.models.SkuDeploymentMode - :ivar network_function_type: The network function type. Known values are: "Unknown", + :ivar version_state: The network function definition version state. Known values are: + "Unknown", "Preview", "Active", "Deprecated", "Validating", and "ValidationFailed". + :vartype version_state: str or ~azure.mgmt.hybridnetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: The network function type. Required. Known values are: "Unknown", "VirtualNetworkFunction", and "ContainerizedNetworkFunction". :vartype network_function_type: str or ~azure.mgmt.hybridnetwork.models.NetworkFunctionType - :ivar preview: Indicates if the vendor sku is in preview mode. - :vartype preview: bool - :ivar managed_application_parameters: The parameters for the managed application to be supplied - by the vendor. - :vartype managed_application_parameters: JSON - :ivar managed_application_template: The template for the managed application deployment. - :vartype managed_application_template: JSON - :ivar network_function_template: The template definition of the network function. - :vartype network_function_template: ~azure.mgmt.hybridnetwork.models.NetworkFunctionTemplate + :ivar network_function_template: Virtual network function template. + :vartype network_function_template: + ~azure.mgmt.hybridnetwork.models.VirtualNetworkFunctionTemplate """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, + "version_state": {"readonly": True}, + "network_function_type": {"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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sku_type": {"key": "properties.skuType", "type": "str"}, - "deployment_mode": {"key": "properties.deploymentMode", "type": "str"}, - "network_function_type": {"key": "properties.networkFunctionType", "type": "str"}, - "preview": {"key": "properties.preview", "type": "bool"}, - "managed_application_parameters": {"key": "properties.managedApplicationParameters", "type": "object"}, - "managed_application_template": {"key": "properties.managedApplicationTemplate", "type": "object"}, - "network_function_template": {"key": "properties.networkFunctionTemplate", "type": "NetworkFunctionTemplate"}, - } - - def __init__( - self, - *, - sku_type: Optional[Union[str, "_models.SkuType"]] = None, - deployment_mode: Optional[Union[str, "_models.SkuDeploymentMode"]] = None, - network_function_type: Optional[Union[str, "_models.NetworkFunctionType"]] = None, - preview: Optional[bool] = None, - managed_application_parameters: Optional[JSON] = None, - managed_application_template: Optional[JSON] = None, - network_function_template: Optional["_models.NetworkFunctionTemplate"] = None, - **kwargs - ): - """ - :keyword sku_type: The sku type. Known values are: "Unknown", "EvolvedPacketCore", "SDWAN", and - "Firewall". - :paramtype sku_type: str or ~azure.mgmt.hybridnetwork.models.SkuType - :keyword deployment_mode: The sku deployment mode. Known values are: "Unknown", "Azure", and - "PrivateEdgeZone". - :paramtype deployment_mode: str or ~azure.mgmt.hybridnetwork.models.SkuDeploymentMode - :keyword network_function_type: The network function type. Known values are: "Unknown", - "VirtualNetworkFunction", and "ContainerizedNetworkFunction". - :paramtype network_function_type: str or ~azure.mgmt.hybridnetwork.models.NetworkFunctionType - :keyword preview: Indicates if the vendor sku is in preview mode. - :paramtype preview: bool - :keyword managed_application_parameters: The parameters for the managed application to be - supplied by the vendor. - :paramtype managed_application_parameters: JSON - :keyword managed_application_template: The template for the managed application deployment. - :paramtype managed_application_template: JSON - :keyword network_function_template: The template definition of the network function. - :paramtype network_function_template: ~azure.mgmt.hybridnetwork.models.NetworkFunctionTemplate - """ - super().__init__(**kwargs) - self.system_data = None - self.provisioning_state = None - self.sku_type = sku_type - self.deployment_mode = deployment_mode - self.network_function_type = network_function_type - self.preview = preview - self.managed_application_parameters = managed_application_parameters - self.managed_application_template = managed_application_template - self.network_function_template = network_function_template - - -class VendorSkuListResult(_serialization.Model): - """Response for list vendor sku API service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of vendor skus offered by the vendor. - :vartype value: list[~azure.mgmt.hybridnetwork.models.VendorSku] - :ivar next_link: The URI to get the next set of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[VendorSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.VendorSku"]] = None, **kwargs): - """ - :keyword value: A list of vendor skus offered by the vendor. - :paramtype value: list[~azure.mgmt.hybridnetwork.models.VendorSku] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class VirtualHardDisk(_serialization.Model): - """Describes the uri of a disk. - - :ivar uri: Specifies the virtual hard disk's uri. - :vartype uri: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "version_state": {"key": "versionState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "deploy_parameters": {"key": "deployParameters", "type": "str"}, + "network_function_type": {"key": "networkFunctionType", "type": "str"}, + "network_function_template": {"key": "networkFunctionTemplate", "type": "VirtualNetworkFunctionTemplate"}, } - def __init__(self, *, uri: Optional[str] = None, **kwargs): + def __init__( + self, + *, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + network_function_template: Optional["_models.VirtualNetworkFunctionTemplate"] = None, + **kwargs: Any + ) -> None: """ - :keyword uri: Specifies the virtual hard disk's uri. - :paramtype uri: str + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Virtual network function template. + :paramtype network_function_template: + ~azure.mgmt.hybridnetwork.models.VirtualNetworkFunctionTemplate """ - super().__init__(**kwargs) - self.uri = uri + super().__init__(description=description, deploy_parameters=deploy_parameters, **kwargs) + self.network_function_type: str = "VirtualNetworkFunction" + self.network_function_template = network_function_template diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py index 934a7dba455c..03fe34722de3 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py @@ -6,32 +6,42 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._devices_operations import DevicesOperations +from ._configuration_group_schemas_operations import ConfigurationGroupSchemasOperations +from ._configuration_group_values_operations import ConfigurationGroupValuesOperations from ._network_functions_operations import NetworkFunctionsOperations -from ._network_function_vendors_operations import NetworkFunctionVendorsOperations -from ._network_function_vendor_skus_operations import NetworkFunctionVendorSkusOperations +from ._components_operations import ComponentsOperations +from ._network_function_definition_groups_operations import NetworkFunctionDefinitionGroupsOperations +from ._network_function_definition_versions_operations import NetworkFunctionDefinitionVersionsOperations +from ._network_service_design_groups_operations import NetworkServiceDesignGroupsOperations +from ._network_service_design_versions_operations import NetworkServiceDesignVersionsOperations from ._operations import Operations -from ._vendors_operations import VendorsOperations -from ._vendor_skus_operations import VendorSkusOperations -from ._vendor_sku_preview_operations import VendorSkuPreviewOperations -from ._vendor_network_functions_operations import VendorNetworkFunctionsOperations -from ._role_instances_operations import RoleInstancesOperations +from ._publishers_operations import PublishersOperations +from ._artifact_stores_operations import ArtifactStoresOperations +from ._artifact_manifests_operations import ArtifactManifestsOperations +from ._proxy_artifact_operations import ProxyArtifactOperations +from ._sites_operations import SitesOperations +from ._site_network_services_operations import SiteNetworkServicesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DevicesOperations", + "ConfigurationGroupSchemasOperations", + "ConfigurationGroupValuesOperations", "NetworkFunctionsOperations", - "NetworkFunctionVendorsOperations", - "NetworkFunctionVendorSkusOperations", + "ComponentsOperations", + "NetworkFunctionDefinitionGroupsOperations", + "NetworkFunctionDefinitionVersionsOperations", + "NetworkServiceDesignGroupsOperations", + "NetworkServiceDesignVersionsOperations", "Operations", - "VendorsOperations", - "VendorSkusOperations", - "VendorSkuPreviewOperations", - "VendorNetworkFunctionsOperations", - "RoleInstancesOperations", + "PublishersOperations", + "ArtifactStoresOperations", + "ArtifactManifestsOperations", + "ProxyArtifactOperations", + "SitesOperations", + "SiteNetworkServicesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_manifests_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_manifests_operations.py new file mode 100644 index 000000000000..c4d7e6dc769a --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_manifests_operations.py @@ -0,0 +1,1443 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_artifact_store_request( + resource_group_name: str, publisher_name: str, artifact_store_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactManifestName": _SERIALIZER.url( + "artifact_manifest_name", artifact_manifest_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactManifestName": _SERIALIZER.url( + "artifact_manifest_name", artifact_manifest_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactManifestName": _SERIALIZER.url( + "artifact_manifest_name", artifact_manifest_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactManifestName": _SERIALIZER.url( + "artifact_manifest_name", artifact_manifest_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_list_credential_request( + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactManifestName": _SERIALIZER.url( + "artifact_manifest_name", artifact_manifest_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_state_request( + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactManifestName": _SERIALIZER.url( + "artifact_manifest_name", artifact_manifest_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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 ArtifactManifestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`artifact_manifests` 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_by_artifact_store( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> Iterable["_models.ArtifactManifest"]: + """Gets information about the artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactManifest or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :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.ArtifactManifestListResult] = 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_artifact_store_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_artifact_store.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("ArtifactManifestListResult", 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_artifact_store.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_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, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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) + + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_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, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifest, IO], + **kwargs: Any + ) -> _models.ArtifactManifest: + 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.ArtifactManifest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArtifactManifest") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("ArtifactManifest", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ArtifactManifest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: _models.ArtifactManifest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ArtifactManifest]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :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 ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ArtifactManifest]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: 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 ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifest, IO], + **kwargs: Any + ) -> LROPoller[_models.ArtifactManifest]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. Is + either a ArtifactManifest type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifest 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 ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifest] + :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.ArtifactManifest] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + 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("ArtifactManifest", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> _models.ArtifactManifest: + """Gets information about a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :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.ArtifactManifest] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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("ArtifactManifest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactManifest: + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactManifest: + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + Required. + :type parameters: 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: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ArtifactManifest: + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: ArtifactManifest or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactManifest + :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.ArtifactManifest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_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("ArtifactManifest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}" + } + + @distributed_trace + def list_credential( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> _models.ArtifactAccessCredential: + """List credential for publishing artifacts defined in artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactAccessCredential or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactAccessCredential + :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.ArtifactAccessCredential] = kwargs.pop("cls", None) + + request = build_list_credential_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credential.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("ArtifactAccessCredential", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credential.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential" + } + + def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifestUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.ArtifactManifestUpdateState]: + 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.ArtifactManifestUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArtifactManifestUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("ArtifactManifestUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState" + } + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: _models.ArtifactManifestUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ArtifactManifestUpdateState]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState + :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 ArtifactManifestUpdateState or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ArtifactManifestUpdateState]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: 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 ArtifactManifestUpdateState or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: Union[_models.ArtifactManifestUpdateState, IO], + **kwargs: Any + ) -> LROPoller[_models.ArtifactManifestUpdateState]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. Required. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Is either a + ArtifactManifestUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState 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 ArtifactManifestUpdateState or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactManifestUpdateState] + :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.ArtifactManifestUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + 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("ArtifactManifestUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_stores_operations.py similarity index 54% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_skus_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_stores_operations.py index 94b10a5ba563..eae73e1059ac 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_skus_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_artifact_stores_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,27 +39,31 @@ _SERIALIZER.client_side_validation = False -def build_delete_request(vendor_name: str, sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_by_publisher_request( + resource_group_name: str, publisher_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,30 +71,37 @@ def build_delete_request(vendor_name: str, sku_name: str, subscription_id: str, # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(vendor_name: str, sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_request( + resource_group_name: str, publisher_name: str, artifact_store_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,31 +109,38 @@ def build_get_request(vendor_name: str, sku_name: str, subscription_id: str, **k # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request(vendor_name: str, sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request( + resource_group_name: str, publisher_name: str, artifact_store_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,26 +153,34 @@ def build_create_or_update_request(vendor_name: str, sku_name: str, subscription return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request(vendor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request( + resource_group_name: str, publisher_name: str, artifact_store_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,45 +191,55 @@ def build_list_request(vendor_name: str, subscription_id: str, **kwargs: Any) -> return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_credential_request(vendor_name: str, sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_update_request( + resource_group_name: str, publisher_name: str, artifact_store_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/listCredential", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -class VendorSkusOperations: +class ArtifactStoresOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`vendor_skus` attribute. + :attr:`artifact_stores` attribute. """ models = _models @@ -219,8 +251,100 @@ def __init__(self, *args, **kwargs): 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> Iterable["_models.ArtifactStore"]: + """Gets information of the ArtifactStores under publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactStore or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ArtifactStore] + :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.ArtifactStoreListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("ArtifactStoreListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores" + } + def _delete_initial( # pylint: disable=inconsistent-return-statements - self, vendor_name: str, sku_name: str, **kwargs: Any + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -233,14 +357,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -250,33 +373,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } @distributed_trace - def begin_delete(self, vendor_name: str, sku_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the specified sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str + def begin_delete( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_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 @@ -292,17 +424,16 @@ def begin_delete(self, vendor_name: str, sku_name: str, **kwargs: Any) -> LROPol _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -333,75 +464,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" - } - - @distributed_trace - def get(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _models.VendorSku: - """Gets information about the specified sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VendorSku or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.VendorSku - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorSku] = kwargs.pop("cls", None) - - request = build_get_request( - vendor_name=vendor_name, - sku_name=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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VendorSku", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } def _create_or_update_initial( - self, vendor_name: str, sku_name: str, parameters: Union[_models.VendorSku, IO], **kwargs: Any - ) -> _models.VendorSku: + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: Union[_models.ArtifactStore, IO], + **kwargs: Any + ) -> _models.ArtifactStore: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -413,23 +486,22 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VendorSku] = kwargs.pop("cls", None) + cls: ClsType[_models.ArtifactStore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VendorSku") + _json = self._serialize.body(parameters, "ArtifactStore") request = build_create_or_update_request( - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -442,8 +514,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,10 +527,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VendorSku", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VendorSku", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -465,28 +538,32 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } @overload def begin_create_or_update( self, - vendor_name: str, - sku_name: str, - parameters: _models.VendorSku, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: _models.ArtifactStore, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VendorSku]: - """Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :param parameters: Parameters supplied to the create or update sku operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorSku + ) -> LROPoller[_models.ArtifactStore]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactStore :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -498,23 +575,34 @@ def begin_create_or_update( :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 VendorSku or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.VendorSku] + :return: An instance of LROPoller that returns either ArtifactStore or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactStore] :raises ~azure.core.exceptions.HttpResponseError: """ @overload def begin_create_or_update( - self, vendor_name: str, sku_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VendorSku]: - """Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :param parameters: Parameters supplied to the create or update sku operation. Required. + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ArtifactStore]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -527,25 +615,33 @@ def begin_create_or_update( :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 VendorSku or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.VendorSku] + :return: An instance of LROPoller that returns either ArtifactStore or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactStore] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_create_or_update( - self, vendor_name: str, sku_name: str, parameters: Union[_models.VendorSku, IO], **kwargs: Any - ) -> LROPoller[_models.VendorSku]: - """Creates or updates a sku. This operation can take up to 2 hours to complete. This is expected - service behavior. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :param parameters: Parameters supplied to the create or update sku operation. Is either a model - type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorSku or IO + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: Union[_models.ArtifactStore, IO], + **kwargs: Any + ) -> LROPoller[_models.ArtifactStore]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. Is + either a ArtifactStore type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactStore or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -557,25 +653,25 @@ def begin_create_or_update( :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 VendorSku or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.VendorSku] + :return: An instance of LROPoller that returns either ArtifactStore or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ArtifactStore] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VendorSku] = kwargs.pop("cls", None) + cls: ClsType[_models.ArtifactStore] = 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_or_update_initial( - vendor_name=vendor_name, - sku_name=sku_name, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -587,7 +683,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VendorSku", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -610,28 +706,27 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } @distributed_trace - def list(self, vendor_name: str, **kwargs: Any) -> Iterable["_models.VendorSku"]: - """Lists all the skus of a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str + def get( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> _models.ArtifactStore: + """Gets information about the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VendorSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.VendorSku] + :return: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorSkuListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -640,77 +735,139 @@ def list(self, vendor_name: str, **kwargs: Any) -> Iterable["_models.VendorSku"] } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_request( - vendor_name=vendor_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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactStore] = kwargs.pop("cls", None) - 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 + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_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) - def extract_data(pipeline_response): - deserialized = self._deserialize("VendorSkuListResult", 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - 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("ArtifactStore", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return ItemPaged(get_next, extract_data) + return deserialized - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } - @distributed_trace - def list_credential(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _models.SkuCredential: - """Generate credentials for publishing SKU images. + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactStore: + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArtifactStore: + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + Required. + :type parameters: 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: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore + :raises ~azure.core.exceptions.HttpResponseError: + """ - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ArtifactStore: + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: SkuCredential or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.SkuCredential + :return: ArtifactStore or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ArtifactStore :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -721,28 +878,40 @@ def list_credential(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _mo } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.SkuCredential] = kwargs.pop("cls", None) + 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.ArtifactStore] = kwargs.pop("cls", None) - request = build_list_credential_request( - vendor_name=vendor_name, - sku_name=sku_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_credential.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,13 +921,13 @@ def list_credential(self, vendor_name: str, sku_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuCredential", pipeline_response) + deserialized = self._deserialize("ArtifactStore", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_credential.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/listCredential" + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_components_operations.py similarity index 52% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendor_skus_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_components_operations.py index 7179277ffff7..02e09e2959ee 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendor_skus_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_components_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,26 +36,34 @@ _SERIALIZER.client_side_validation = False -def build_list_by_vendor_request(vendor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request( + resource_group_name: str, network_function_name: str, component_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "networkFunctionName": _SERIALIZER.url( + "network_function_name", network_function_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "componentName": _SERIALIZER.url( + "component_name", component_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,29 +74,31 @@ def build_list_by_vendor_request(vendor_name: str, subscription_id: str, **kwarg return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_sku_request( - vendor_name: str, vendor_sku_name: str, subscription_id: str, **kwargs: Any +def build_list_by_network_function_request( + resource_group_name: str, network_function_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus/{vendorSkuName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components", ) # pylint: disable=line-too-long path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "vendorSkuName": _SERIALIZER.url("vendor_sku_name", vendor_sku_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "networkFunctionName": _SERIALIZER.url( + "network_function_name", network_function_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,14 +109,14 @@ def build_list_by_sku_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class NetworkFunctionVendorSkusOperations: +class ComponentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`network_function_vendor_skus` attribute. + :attr:`components` attribute. """ models = _models @@ -124,24 +129,23 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_vendor(self, vendor_name: str, **kwargs: Any) -> Iterable["_models.SkuOverview"]: - """Lists all network function vendor sku details in a vendor. - - :param vendor_name: The name of the network function vendor. Required. - :type vendor_name: str + def get( + self, resource_group_name: str, network_function_name: str, component_name: str, **kwargs: Any + ) -> _models.Component: + """Gets information about the specified application instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_function_name: The name of the network function. Required. + :type network_function_name: str + :param component_name: The name of the component. Required. + :type component_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SkuOverview or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.SkuOverview] + :return: Component or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Component :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionSkuListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -150,90 +154,69 @@ def list_by_vendor(self, vendor_name: str, **kwargs: Any) -> Iterable["_models.S } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_vendor_request( - vendor_name=vendor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_vendor.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Component] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + component_name=component_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) - def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkFunctionSkuListResult", 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - 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("Component", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return ItemPaged(get_next, extract_data) + return deserialized - list_by_vendor.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}" } @distributed_trace - def list_by_sku( - self, vendor_name: str, vendor_sku_name: str, **kwargs: Any - ) -> Iterable["_models.NetworkFunctionSkuRoleDetails"]: - """Lists information about network function vendor sku details. - - :param vendor_name: The name of the network function vendor. Required. - :type vendor_name: str - :param vendor_sku_name: The name of the network function sku. Required. - :type vendor_sku_name: str + def list_by_network_function( + self, resource_group_name: str, network_function_name: str, **kwargs: Any + ) -> Iterable["_models.Component"]: + """Lists all the component resources in a network function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param network_function_name: The name of the network function. Required. + :type network_function_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkFunctionSkuRoleDetails or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionSkuRoleDetails] + :return: An iterator like instance of either Component or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Component] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionSkuDetails] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -246,12 +229,12 @@ def list_by_sku( def prepare_request(next_link=None): if not next_link: - request = build_list_by_sku_request( - vendor_name=vendor_name, - vendor_sku_name=vendor_sku_name, + request = build_list_by_network_function_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_sku.metadata["url"], + template_url=self.list_by_network_function.metadata["url"], headers=_headers, params=_params, ) @@ -277,7 +260,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkFunctionSkuDetails", pipeline_response) + deserialized = self._deserialize("ComponentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -286,8 +269,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,6 +284,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_sku.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus/{vendorSkuName}" + list_by_network_function.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_schemas_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_schemas_operations.py new file mode 100644 index 000000000000..d814dd2b3150 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_schemas_operations.py @@ -0,0 +1,1266 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_publisher_request( + resource_group_name: str, publisher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + configuration_group_schema_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "configurationGroupSchemaName": _SERIALIZER.url( + "configuration_group_schema_name", + configuration_group_schema_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, + publisher_name: str, + configuration_group_schema_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "configurationGroupSchemaName": _SERIALIZER.url( + "configuration_group_schema_name", + configuration_group_schema_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + configuration_group_schema_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "configurationGroupSchemaName": _SERIALIZER.url( + "configuration_group_schema_name", + configuration_group_schema_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + configuration_group_schema_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "configurationGroupSchemaName": _SERIALIZER.url( + "configuration_group_schema_name", + configuration_group_schema_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_update_state_request( + resource_group_name: str, + publisher_name: str, + configuration_group_schema_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "configurationGroupSchemaName": _SERIALIZER.url( + "configuration_group_schema_name", + configuration_group_schema_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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 ConfigurationGroupSchemasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`configuration_group_schemas` 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> Iterable["_models.ConfigurationGroupSchema"]: + """Gets information of the configuration group schemas under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupSchema or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :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.ConfigurationGroupSchemaListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("ConfigurationGroupSchemaListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_name: str, configuration_group_schema_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, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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) + + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, publisher_name: str, configuration_group_schema_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_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, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchema, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + 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.ConfigurationGroupSchema] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ConfigurationGroupSchema") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("ConfigurationGroupSchema", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConfigurationGroupSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: _models.ConfigurationGroupSchema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupSchema]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :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 ConfigurationGroupSchema or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupSchema]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. Required. + :type parameters: 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 ConfigurationGroupSchema or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchema, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupSchema]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. Is either a ConfigurationGroupSchema type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema 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 ConfigurationGroupSchema or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema] + :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.ConfigurationGroupSchema] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + 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("ConfigurationGroupSchema", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, publisher_name: str, configuration_group_schema_name: str, **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Gets information about the specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :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.ConfigurationGroupSchema] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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("ConfigurationGroupSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: 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: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupSchema: + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: ConfigurationGroupSchema or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchema + :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.ConfigurationGroupSchema] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_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("ConfigurationGroupSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}" + } + + def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchemaVersionUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.ConfigurationGroupSchemaVersionUpdateState]: + 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.ConfigurationGroupSchemaVersionUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ConfigurationGroupSchemaVersionUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("ConfigurationGroupSchemaVersionUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState" + } + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: _models.ConfigurationGroupSchemaVersionUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupSchemaVersionUpdateState]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState + :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 + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupSchemaVersionUpdateState]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. + Required. + :type parameters: 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 + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: Union[_models.ConfigurationGroupSchemaVersionUpdateState, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupSchemaVersionUpdateState]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. Required. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. Is + either a ConfigurationGroupSchemaVersionUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState + 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 + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :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.ConfigurationGroupSchemaVersionUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + 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("ConfigurationGroupSchemaVersionUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_values_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_values_operations.py new file mode 100644 index 000000000000..0541f95edfb9 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_configuration_group_values_operations.py @@ -0,0 +1,1009 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, configuration_group_value_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}", + ) # 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 + ), + "configurationGroupValueName": _SERIALIZER.url( + "configuration_group_value_name", + configuration_group_value_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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_get_request( + resource_group_name: str, configuration_group_value_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}", + ) # 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 + ), + "configurationGroupValueName": _SERIALIZER.url( + "configuration_group_value_name", + configuration_group_value_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, configuration_group_value_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-09-01")) + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName}", + ) # 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 + ), + "configurationGroupValueName": _SERIALIZER.url( + "configuration_group_value_name", + configuration_group_value_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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_update_tags_request( + resource_group_name: str, configuration_group_value_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-09-01")) + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName}", + ) # 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 + ), + "configurationGroupValueName": _SERIALIZER.url( + "configuration_group_value_name", + configuration_group_value_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues", + ) # 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 = _url.format(**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 ConfigurationGroupValuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`configuration_group_values` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, configuration_group_value_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, + configuration_group_value_name=configuration_group_value_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) + + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, configuration_group_value_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_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, + configuration_group_value_name=configuration_group_value_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.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, configuration_group_value_name: str, **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Gets information about the specified hybrid configuration group values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :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.ConfigurationGroupValue] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_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("ConfigurationGroupValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: Union[_models.ConfigurationGroupValue, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + 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.ConfigurationGroupValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ConfigurationGroupValue") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("ConfigurationGroupValue", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConfigurationGroupValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: _models.ConfigurationGroupValue, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupValue]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :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 ConfigurationGroupValue or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupValue]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. Required. + :type parameters: 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 ConfigurationGroupValue or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: Union[_models.ConfigurationGroupValue, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationGroupValue]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. Is either a ConfigurationGroupValue type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue 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 ConfigurationGroupValue or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :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.ConfigurationGroupValue] = 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_or_update_initial( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + parameters=parameters, + 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("ConfigurationGroupValue", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. Required. + :type parameters: 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: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ConfigurationGroupValue: + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. Required. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: ConfigurationGroupValue or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue + :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.ConfigurationGroupValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("ConfigurationGroupValue", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConfigurationGroupValue"]: + """Lists all sites in the configuration group value in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupValue or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :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.ConfigurationGroupValueListResult] = 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("ConfigurationGroupValueListResult", 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.HybridNetwork/configurationGroupValues" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ConfigurationGroupValue"]: + """Lists all the hybrid network configurationGroupValues in a 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 ConfigurationGroupValue or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ConfigurationGroupValue] + :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.ConfigurationGroupValueListResult] = 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("ConfigurationGroupValueListResult", 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.HybridNetwork/configurationGroupValues" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_groups_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_groups_operations.py new file mode 100644 index 000000000000..ee55442848ea --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_groups_operations.py @@ -0,0 +1,979 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_publisher_request( + resource_group_name: str, publisher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_function_definition_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, + publisher_name: str, + network_function_definition_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_function_definition_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_function_definition_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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) + + +class NetworkFunctionDefinitionGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`network_function_definition_groups` 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkFunctionDefinitionGroup"]: + """Gets information of the network function definition groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :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.NetworkFunctionDefinitionGroupListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("NetworkFunctionDefinitionGroupListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_name: str, network_function_definition_group_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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) + + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, publisher_name: str, network_function_definition_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a specified network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: Union[_models.NetworkFunctionDefinitionGroup, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + 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.NetworkFunctionDefinitionGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkFunctionDefinitionGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkFunctionDefinitionGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkFunctionDefinitionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: _models.NetworkFunctionDefinitionGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionGroup]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :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 NetworkFunctionDefinitionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionGroup]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: 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 NetworkFunctionDefinitionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: Union[_models.NetworkFunctionDefinitionGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionGroup]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Is either a NetworkFunctionDefinitionGroup type or a IO type. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup 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 NetworkFunctionDefinitionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup] + :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.NetworkFunctionDefinitionGroup] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + parameters=parameters, + 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("NetworkFunctionDefinitionGroup", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, publisher_name: str, network_function_definition_group_name: str, **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Gets information about the specified networkFunctionDefinition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :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.NetworkFunctionDefinitionGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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("NetworkFunctionDefinitionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Required. + :type parameters: 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: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionGroup: + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkFunctionDefinitionGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionGroup + :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.NetworkFunctionDefinitionGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_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("NetworkFunctionDefinitionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_versions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_versions_operations.py new file mode 100644 index 000000000000..862323b42be1 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_definition_versions_operations.py @@ -0,0 +1,1412 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkFunctionDefinitionVersionName": _SERIALIZER.url( + "network_function_definition_version_name", + network_function_definition_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkFunctionDefinitionVersionName": _SERIALIZER.url( + "network_function_definition_version_name", + network_function_definition_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkFunctionDefinitionVersionName": _SERIALIZER.url( + "network_function_definition_version_name", + network_function_definition_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkFunctionDefinitionVersionName": _SERIALIZER.url( + "network_function_definition_version_name", + network_function_definition_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_list_by_network_function_definition_group_request( + resource_group_name: str, + publisher_name: str, + network_function_definition_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_state_request( + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkFunctionDefinitionGroupName": _SERIALIZER.url( + "network_function_definition_group_name", + network_function_definition_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkFunctionDefinitionVersionName": _SERIALIZER.url( + "network_function_definition_version_name", + network_function_definition_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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 NetworkFunctionDefinitionVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`network_function_definition_versions` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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) + + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_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, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersion, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + 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.NetworkFunctionDefinitionVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkFunctionDefinitionVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkFunctionDefinitionVersion", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkFunctionDefinitionVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: _models.NetworkFunctionDefinitionVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionVersion]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :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 NetworkFunctionDefinitionVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionVersion]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: 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 NetworkFunctionDefinitionVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionVersion]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Is either a NetworkFunctionDefinitionVersion type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion 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 NetworkFunctionDefinitionVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :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.NetworkFunctionDefinitionVersion] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + 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("NetworkFunctionDefinitionVersion", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Gets information about a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :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.NetworkFunctionDefinitionVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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("NetworkFunctionDefinitionVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Required. + :type parameters: 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: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkFunctionDefinitionVersion: + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkFunctionDefinitionVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion + :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.NetworkFunctionDefinitionVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_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("NetworkFunctionDefinitionVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}" + } + + @distributed_trace + def list_by_network_function_definition_group( + self, resource_group_name: str, publisher_name: str, network_function_definition_group_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkFunctionDefinitionVersion"]: + """Gets information about a list of network function definition versions under a network function + definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_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 NetworkFunctionDefinitionVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersion] + :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.NetworkFunctionDefinitionVersionListResult] = 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_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_function_definition_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("NetworkFunctionDefinitionVersionListResult", 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_network_function_definition_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions" + } + + def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersionUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.NetworkFunctionDefinitionVersionUpdateState]: + 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.NetworkFunctionDefinitionVersionUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkFunctionDefinitionVersionUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("NetworkFunctionDefinitionVersionUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState" + } + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: _models.NetworkFunctionDefinitionVersionUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionVersionUpdateState]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState + :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 + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionVersionUpdateState]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. Required. + :type parameters: 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 + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: Union[_models.NetworkFunctionDefinitionVersionUpdateState, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkFunctionDefinitionVersionUpdateState]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. Required. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. Required. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. Is either a NetworkFunctionDefinitionVersionUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState + 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 + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :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.NetworkFunctionDefinitionVersionUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + 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("NetworkFunctionDefinitionVersionUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py deleted file mode 100644 index 0f90429ea3fe..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py +++ /dev/null @@ -1,172 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -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(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors" - ) # 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 NetworkFunctionVendorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`network_function_vendors` 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.NetworkFunctionVendor"]: - """Lists all the available vendor and sku information. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkFunctionVendor or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.NetworkFunctionVendor] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionVendorListResult] = 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( - 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("NetworkFunctionVendorListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/networkFunctionVendors"} diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py index ab0b61bfcf32..782c42dc7d9f 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,11 +57,13 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, "str"), + "networkFunctionName": _SERIALIZER.url( + "network_function_name", network_function_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +96,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,9 +113,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,7 +130,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,9 +149,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +166,7 @@ def build_update_tags_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,9 +183,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,7 +194,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -221,9 +209,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +224,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,9 +241,7 @@ def build_execute_request_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -270,11 +254,13 @@ def build_execute_request_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, "str"), + "networkFunctionName": _SERIALIZER.url( + "network_function_name", network_function_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,9 +306,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -337,8 +321,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,8 +333,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}" @@ -357,8 +346,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete(self, resource_group_name: str, network_function_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the specified network function resource. This operation can take up to 1 hour to - complete. This is expected service behavior. + """Deletes the specified network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -380,9 +368,7 @@ def begin_delete(self, resource_group_name: str, network_function_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -449,9 +435,7 @@ def get(self, resource_group_name: str, network_function_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkFunction] = kwargs.pop("cls", None) request = build_get_request( @@ -466,8 +450,9 @@ def get(self, resource_group_name: str, network_function_name: str, **kwargs: An 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,16 +491,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.NetworkFunction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NetworkFunction") @@ -535,8 +518,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -571,8 +555,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NetworkFunction]: - """Creates or updates a network function resource. This operation can take up to 6 hours to - complete. This is expected service behavior. + """Creates or updates a network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -609,8 +592,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.NetworkFunction]: - """Creates or updates a network function resource. This operation can take up to 6 hours to - complete. This is expected service behavior. + """Creates or updates a network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -645,8 +627,7 @@ def begin_create_or_update( parameters: Union[_models.NetworkFunction, IO], **kwargs: Any ) -> LROPoller[_models.NetworkFunction]: - """Creates or updates a network function resource. This operation can take up to 6 hours to - complete. This is expected service behavior. + """Creates or updates a network function resource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -654,7 +635,7 @@ def begin_create_or_update( :param network_function_name: Resource name for the network function resource. Required. :type network_function_name: str :param parameters: Parameters supplied in the body to the create or update network function - operation. Is either a model type or a IO type. Required. + operation. Is either a NetworkFunction type or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkFunction or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -675,9 +656,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.NetworkFunction] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -796,7 +775,7 @@ def update_tags( :param network_function_name: Resource name for the network function resource. Required. :type network_function_name: str :param parameters: Parameters supplied to the update network function tags operation. Is either - a model type or a IO type. Required. + a TagsObject type or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -817,16 +796,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.NetworkFunction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -846,8 +823,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -880,9 +858,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NetworkFuncti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkFunctionListResult] = kwargs.pop("cls", None) error_map = { @@ -934,8 +910,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -967,9 +944,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkFunctionListResult] = kwargs.pop("cls", None) error_map = { @@ -1022,8 +997,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1058,16 +1034,14 @@ def _execute_request_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ExecuteRequestParameters") @@ -1087,8 +1061,9 @@ def _execute_request_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1098,8 +1073,12 @@ def _execute_request_initial( # pylint: disable=inconsistent-return-statements 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, {}) + return cls(pipeline_response, None, response_headers) _execute_request_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest" @@ -1115,7 +1094,7 @@ def begin_execute_request( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Execute a request to services on a network function. + """Execute a request to services on a containerized network function. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1150,7 +1129,7 @@ def begin_execute_request( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Execute a request to services on a network function. + """Execute a request to services on a containerized network function. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1183,15 +1162,15 @@ def begin_execute_request( parameters: Union[_models.ExecuteRequestParameters, IO], **kwargs: Any ) -> LROPoller[None]: - """Execute a request to services on a network function. + """Execute a request to services on a containerized network function. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param network_function_name: The name of the network function. Required. :type network_function_name: str - :param parameters: Payload for execute request post call. Is either a model type or a IO type. - Required. + :param parameters: Payload for execute request post call. Is either a ExecuteRequestParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.ExecuteRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1211,9 +1190,7 @@ def begin_execute_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_groups_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_groups_operations.py new file mode 100644 index 000000000000..e500d6e162aa --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_groups_operations.py @@ -0,0 +1,978 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_publisher_request( + resource_group_name: str, publisher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_service_design_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, + publisher_name: str, + network_service_design_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_service_design_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_service_design_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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) + + +class NetworkServiceDesignGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`network_service_design_groups` 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_by_publisher( + self, resource_group_name: str, publisher_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkServiceDesignGroup"]: + """Gets information of the network service design groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkServiceDesignGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] + :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.NetworkServiceDesignGroupListResult] = 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_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.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("NetworkServiceDesignGroupListResult", 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_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_name: str, network_service_design_group_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_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) + + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, publisher_name: str, network_service_design_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a specified network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: Union[_models.NetworkServiceDesignGroup, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + 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.NetworkServiceDesignGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkServiceDesignGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkServiceDesignGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkServiceDesignGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: _models.NetworkServiceDesignGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignGroup]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :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 NetworkServiceDesignGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignGroup]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: 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 NetworkServiceDesignGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: Union[_models.NetworkServiceDesignGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignGroup]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Is either a NetworkServiceDesignGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup 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 NetworkServiceDesignGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup] + :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.NetworkServiceDesignGroup] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + parameters=parameters, + 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("NetworkServiceDesignGroup", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, publisher_name: str, network_service_design_group_name: str, **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Gets information about the specified networkServiceDesign group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :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.NetworkServiceDesignGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_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("NetworkServiceDesignGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Required. + :type parameters: 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: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignGroup: + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkServiceDesignGroup or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignGroup + :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.NetworkServiceDesignGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_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("NetworkServiceDesignGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_versions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_versions_operations.py new file mode 100644 index 000000000000..5156bb317dc9 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_service_design_versions_operations.py @@ -0,0 +1,1411 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkServiceDesignVersionName": _SERIALIZER.url( + "network_service_design_version_name", + network_service_design_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkServiceDesignVersionName": _SERIALIZER.url( + "network_service_design_version_name", + network_service_design_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkServiceDesignVersionName": _SERIALIZER.url( + "network_service_design_version_name", + network_service_design_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + } + + _url: str = _url.format(**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, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkServiceDesignVersionName": _SERIALIZER.url( + "network_service_design_version_name", + network_service_design_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + } + + _url: str = _url.format(**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_list_by_network_service_design_group_request( + resource_group_name: str, + publisher_name: str, + network_service_design_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _url.format(**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_state_request( + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState", + ) # 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 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "networkServiceDesignGroupName": _SERIALIZER.url( + "network_service_design_group_name", + network_service_design_group_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "networkServiceDesignVersionName": _SERIALIZER.url( + "network_service_design_version_name", + network_service_design_version_name, + "str", + max_length=64, + pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + ), + } + + _url: str = _url.format(**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 NetworkServiceDesignVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`network_service_design_versions` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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) + + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_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, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersion, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + 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.NetworkServiceDesignVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkServiceDesignVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("NetworkServiceDesignVersion", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkServiceDesignVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: _models.NetworkServiceDesignVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignVersion]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :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 NetworkServiceDesignVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignVersion]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: 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 NetworkServiceDesignVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignVersion]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Is either a NetworkServiceDesignVersion type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion 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 NetworkServiceDesignVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :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.NetworkServiceDesignVersion] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + 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("NetworkServiceDesignVersion", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Gets information about a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :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.NetworkServiceDesignVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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("NetworkServiceDesignVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Required. + :type parameters: 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: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkServiceDesignVersion: + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: NetworkServiceDesignVersion or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion + :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.NetworkServiceDesignVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_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("NetworkServiceDesignVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}" + } + + @distributed_trace + def list_by_network_service_design_group( + self, resource_group_name: str, publisher_name: str, network_service_design_group_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkServiceDesignVersion"]: + """Gets information about a list of network service design versions under a network service design + group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_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 NetworkServiceDesignVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersion] + :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.NetworkServiceDesignVersionListResult] = 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_network_service_design_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_service_design_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("NetworkServiceDesignVersionListResult", 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_network_service_design_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions" + } + + def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersionUpdateState, IO], + **kwargs: Any + ) -> Optional[_models.NetworkServiceDesignVersionUpdateState]: + 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.NetworkServiceDesignVersionUpdateState]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "NetworkServiceDesignVersionUpdateState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("NetworkServiceDesignVersionUpdateState", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState" + } + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: _models.NetworkServiceDesignVersionUpdateState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignVersionUpdateState]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState + :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 NetworkServiceDesignVersionUpdateState or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignVersionUpdateState]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + Required. + :type parameters: 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 NetworkServiceDesignVersionUpdateState or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: Union[_models.NetworkServiceDesignVersionUpdateState, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkServiceDesignVersionUpdateState]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + Required. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + Required. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + Is either a NetworkServiceDesignVersionUpdateState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState 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 NetworkServiceDesignVersionUpdateState or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.NetworkServiceDesignVersionUpdateState] + :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.NetworkServiceDesignVersionUpdateState] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + 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("NetworkServiceDesignVersionUpdateState", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py index a1beb5e840aa..b4bae7550241 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_proxy_artifact_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_proxy_artifact_operations.py new file mode 100644 index 000000000000..2972b52f2275 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_proxy_artifact_operations.py @@ -0,0 +1,664 @@ +# 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 + +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( + resource_group_name: str, publisher_name: str, artifact_store_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_request( + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + subscription_id: str, + *, + artifact_name: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["artifactName"] = _SERIALIZER.query( + "artifact_name", artifact_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ) + _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_state_request( + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_version_name: str, + subscription_id: str, + *, + artifact_name: 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-09-01")) + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactStoreName": _SERIALIZER.url( + "artifact_store_name", artifact_store_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "artifactVersionName": _SERIALIZER.url( + "artifact_version_name", artifact_version_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["artifactName"] = _SERIALIZER.query( + "artifact_name", artifact_name, "str", max_length=64, pattern=r"^[^\s]*[^\s]+[^\s]*$" + ) + _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) + + +class ProxyArtifactOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`proxy_artifact` 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, resource_group_name: str, publisher_name: str, artifact_store_name: str, **kwargs: Any + ) -> Iterable["_models.ProxyArtifactListOverview"]: + """Lists all the available artifacts in the parent Artifact Store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactListOverview or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ProxyArtifactListOverview] + :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.ProxyArtifactOverviewListResult] = 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, + publisher_name=publisher_name, + artifact_store_name=artifact_store_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("ProxyArtifactOverviewListResult", 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts" + } + + @distributed_trace + def get( + self, resource_group_name: str, publisher_name: str, artifact_store_name: str, artifact_name: str, **kwargs: Any + ) -> Iterable["_models.ProxyArtifactVersionsListOverview"]: + """Get a Artifact overview information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactVersionsListOverview or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] + :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.ProxyArtifactVersionsOverviewListResult] = 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_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + artifact_name=artifact_name, + 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) + + 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("ProxyArtifactVersionsOverviewListResult", 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) + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions" + } + + def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: Union[_models.ArtifactChangeState, IO], + **kwargs: Any + ) -> Optional[_models.ProxyArtifactVersionsListOverview]: + 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.ProxyArtifactVersionsListOverview]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ArtifactChangeState") + + request = build_update_state_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_version_name=artifact_version_name, + subscription_id=self._config.subscription_id, + artifact_name=artifact_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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 [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("ProxyArtifactVersionsListOverview", 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_state_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}" + } + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: _models.ArtifactChangeState, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProxyArtifactVersionsListOverview]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. Required. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactChangeState + :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 ProxyArtifactVersionsListOverview or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProxyArtifactVersionsListOverview]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. Required. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Required. + :type parameters: 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 ProxyArtifactVersionsListOverview or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: Union[_models.ArtifactChangeState, IO], + **kwargs: Any + ) -> LROPoller[_models.ProxyArtifactVersionsListOverview]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. Required. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. Required. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. Required. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. Is either a + ArtifactChangeState type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.ArtifactChangeState 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 ProxyArtifactVersionsListOverview or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.ProxyArtifactVersionsListOverview] + :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.ProxyArtifactVersionsListOverview] = 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_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_name=artifact_name, + artifact_version_name=artifact_version_name, + parameters=parameters, + 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("ProxyArtifactVersionsListOverview", 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_state.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_publishers_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_publishers_operations.py new file mode 100644 index 000000000000..4be0c091b61a --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_publishers_operations.py @@ -0,0 +1,988 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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, publisher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_get_request( + resource_group_name: str, publisher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, publisher_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_update_request( + resource_group_name: str, publisher_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-09-01")) + 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.HybridNetwork/publishers/{publisherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publisherName": _SERIALIZER.url( + "publisher_name", publisher_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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) + + +class PublishersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`publishers` 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.Publisher"]: + """Lists all the publishers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Publisher] + :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.PublisherListResult] = 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("PublisherListResult", 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.HybridNetwork/publishers" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Publisher"]: + """Lists all the publishers in a 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 Publisher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Publisher] + :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.PublisherListResult] = 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("PublisherListResult", 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.HybridNetwork/publishers" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, publisher_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, + publisher_name=publisher_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) + + 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.HybridNetwork/publishers/{publisherName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, publisher_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_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, + publisher_name=publisher_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.HybridNetwork/publishers/{publisherName}" + } + + @distributed_trace + def get(self, resource_group_name: str, publisher_name: str, **kwargs: Any) -> _models.Publisher: + """Gets information about the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher + :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.Publisher] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_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("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[Union[_models.Publisher, IO]] = None, + **kwargs: Any + ) -> _models.Publisher: + 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.Publisher] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "Publisher") + else: + _json = None + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("Publisher", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[_models.Publisher] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Publisher]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: ~azure.mgmt.hybridnetwork.models.Publisher + :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 Publisher or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Publisher] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Publisher]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: 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 Publisher or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Publisher] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[Union[_models.Publisher, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Publisher]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Is either a Publisher + type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.hybridnetwork.models.Publisher 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 Publisher or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Publisher] + :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.Publisher] = 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_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + parameters=parameters, + 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("Publisher", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" + } + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[_models.TagsObject] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Publisher: + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Publisher: + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Default value is + None. + :type parameters: 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: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional[Union[_models.TagsObject, IO]] = None, + **kwargs: Any + ) -> _models.Publisher: + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param publisher_name: The name of the publisher. Required. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. Is either a + TagsObject type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Publisher + :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.Publisher] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "TagsObject") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_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("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py deleted file mode 100644 index 7f7ca51cba28..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py +++ /dev/null @@ -1,790 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_start_request( - location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), - "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_list_request( - location_name: str, vendor_name: str, service_key: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "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 RoleInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`role_instances` 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 _start_initial( # pylint: disable=inconsistent-return-statements - self, location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start" - } - - @distributed_trace - def begin_start( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Starts a role instance of a vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_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: Literal["2022-01-01-preview"] = 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._start_initial( # type: ignore - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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_start.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start" - } - - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_stop_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop" - } - - @distributed_trace - def begin_stop( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Powers off (stop) a role instance of a vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_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: Literal["2022-01-01-preview"] = 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._stop_initial( # type: ignore - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop" - } - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, location_name: str, vendor_name: str, service_key: str, role_instance_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_restart_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._restart_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart" - } - - @distributed_trace - def begin_restart( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Restarts a role instance of a vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_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: Literal["2022-01-01-preview"] = 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._restart_initial( # type: ignore - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart" - } - - @distributed_trace - def get( - self, location_name: str, vendor_name: str, service_key: str, role_instance_name: str, **kwargs: Any - ) -> _models.RoleInstance: - """Gets the information of role instance of vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param role_instance_name: The name of the role instance of the vendor network function. - Required. - :type role_instance_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleInstance or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.RoleInstance - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.RoleInstance] = kwargs.pop("cls", None) - - request = build_get_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - role_instance_name=role_instance_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleInstance", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}" - } - - @distributed_trace - def list( - self, location_name: str, vendor_name: str, service_key: str, **kwargs: Any - ) -> Iterable["_models.RoleInstance"]: - """Lists the information of role instances of vendor network function. - - :param location_name: The Azure region where the network function resource was created by - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleInstance or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.RoleInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkFunctionRoleInstanceListResult] = 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( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - 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("NetworkFunctionRoleInstanceListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances" - } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_devices_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_site_network_services_operations.py similarity index 69% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_devices_operations.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_site_network_services_operations.py index 50fd1808c455..e1ea9e398de0 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_devices_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_site_network_services_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,30 +40,34 @@ def build_delete_request( - resource_group_name: str, device_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, site_network_service_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}", ) # 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 ), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "siteNetworkServiceName": _SERIALIZER.url( + "site_network_service_name", + site_network_service_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,29 +78,35 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(resource_group_name: str, device_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request( + resource_group_name: str, site_network_service_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}", ) # 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 ), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "siteNetworkServiceName": _SERIALIZER.url( + "site_network_service_name", + site_network_service_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,31 +118,35 @@ def build_get_request(resource_group_name: str, device_name: str, subscription_i def build_create_or_update_request( - resource_group_name: str, device_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, site_network_service_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.HybridNetwork/devices/{deviceName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}", ) # 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 ), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "siteNetworkServiceName": _SERIALIZER.url( + "site_network_service_name", + site_network_service_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,31 +160,35 @@ def build_create_or_update_request( def build_update_tags_request( - resource_group_name: str, device_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, site_network_service_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) 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.HybridNetwork/devices/{deviceName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}", ) # 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 ), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "siteNetworkServiceName": _SERIALIZER.url( + "site_network_service_name", + site_network_service_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,50 +205,18 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices") - 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_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices", + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices" ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,31 +227,26 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_registration_key_request( - resource_group_name: str, device_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}/listRegistrationKey", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices", ) # 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 ), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,17 +254,17 @@ def build_list_registration_key_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class DevicesOperations: +class SiteNetworkServicesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`devices` attribute. + :attr:`site_network_services` attribute. """ models = _models @@ -300,7 +277,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, device_name: str, **kwargs: Any + self, resource_group_name: str, site_network_service_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -313,14 +290,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, - device_name=device_name, + site_network_service_name=site_network_service_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -330,33 +305,38 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" } @distributed_trace - def begin_delete(self, resource_group_name: str, device_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the specified device. + def begin_delete(self, resource_group_name: str, site_network_service_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified site network service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_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 @@ -372,9 +352,7 @@ def begin_delete(self, resource_group_name: str, device_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -382,7 +360,7 @@ def begin_delete(self, resource_group_name: str, device_name: str, **kwargs: Any if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, - device_name=device_name, + site_network_service_name=site_network_service_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -413,21 +391,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" } @distributed_trace - def get(self, resource_group_name: str, device_name: str, **kwargs: Any) -> _models.Device: - """Gets information about the specified device. + def get( + self, resource_group_name: str, site_network_service_name: str, **kwargs: Any + ) -> _models.SiteNetworkService: + """Gets information about the specified site network service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -441,14 +421,12 @@ def get(self, resource_group_name: str, device_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SiteNetworkService] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - device_name=device_name, + site_network_service_name=site_network_service_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -458,8 +436,9 @@ def get(self, resource_group_name: str, device_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -469,7 +448,7 @@ def get(self, resource_group_name: str, device_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("SiteNetworkService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -477,12 +456,16 @@ def get(self, resource_group_name: str, device_name: str, **kwargs: Any) -> _mod return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" } def _create_or_update_initial( - self, resource_group_name: str, device_name: str, parameters: Union[_models.Device, IO], **kwargs: Any - ) -> _models.Device: + self, + resource_group_name: str, + site_network_service_name: str, + parameters: Union[_models.SiteNetworkService, IO], + **kwargs: Any + ) -> _models.SiteNetworkService: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -494,23 +477,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.SiteNetworkService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "Device") + _json = self._serialize.body(parameters, "SiteNetworkService") request = build_create_or_update_request( resource_group_name=resource_group_name, - device_name=device_name, + site_network_service_name=site_network_service_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -523,8 +504,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,10 +517,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("SiteNetworkService", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("SiteNetworkService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -546,28 +528,29 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" } @overload def begin_create_or_update( self, resource_group_name: str, - device_name: str, - parameters: _models.Device, + site_network_service_name: str, + parameters: _models.SiteNetworkService, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: - """Creates or updates a device. + ) -> LROPoller[_models.SiteNetworkService]: + """Creates or updates a network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: Resource name for the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the create or update device operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.Device + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.SiteNetworkService :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -579,8 +562,9 @@ def begin_create_or_update( :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 Device or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Device] + :return: An instance of LROPoller that returns either SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.SiteNetworkService] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -588,20 +572,21 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - device_name: str, + site_network_service_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: - """Creates or updates a device. + ) -> LROPoller[_models.SiteNetworkService]: + """Creates or updates a network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: Resource name for the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the create or update device operation. Required. + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -614,25 +599,30 @@ def begin_create_or_update( :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 Device or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Device] + :return: An instance of LROPoller that returns either SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.SiteNetworkService] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_create_or_update( - self, resource_group_name: str, device_name: str, parameters: Union[_models.Device, IO], **kwargs: Any - ) -> LROPoller[_models.Device]: - """Creates or updates a device. + self, + resource_group_name: str, + site_network_service_name: str, + parameters: Union[_models.SiteNetworkService, IO], + **kwargs: Any + ) -> LROPoller[_models.SiteNetworkService]: + """Creates or updates a network site. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: Resource name for the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the create or update device operation. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.Device or IO + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + Is either a SiteNetworkService type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.SiteNetworkService or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -644,25 +634,24 @@ def begin_create_or_update( :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 Device or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Device] + :return: An instance of LROPoller that returns either SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.SiteNetworkService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.SiteNetworkService] = 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_or_update_initial( resource_group_name=resource_group_name, - device_name=device_name, + site_network_service_name=site_network_service_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -674,7 +663,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("SiteNetworkService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -697,34 +686,34 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" } @overload def update_tags( self, resource_group_name: str, - device_name: str, + site_network_service_name: str, parameters: _models.TagsObject, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Device: - """Updates device tags. + ) -> _models.SiteNetworkService: + """Updates a site update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the update device tags operation. Required. + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject :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: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService :raises ~azure.core.exceptions.HttpResponseError: """ @@ -732,50 +721,54 @@ def update_tags( def update_tags( self, resource_group_name: str, - device_name: str, + site_network_service_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Device: - """Updates device tags. + ) -> _models.SiteNetworkService: + """Updates a site update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the update device tags operation. Required. + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. Required. :type parameters: 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: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def update_tags( - self, resource_group_name: str, device_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any - ) -> _models.Device: - """Updates device tags. + self, + resource_group_name: str, + site_network_service_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.SiteNetworkService: + """Updates a site update tags. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :param parameters: Parameters supplied to the update device tags operation. Is either a model - type or a IO type. Required. + :param site_network_service_name: The name of the site network service. Required. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. Is either a TagsObject type + or a IO type. Required. :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: Device or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Device + :return: SiteNetworkService or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.SiteNetworkService :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -789,23 +782,21 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.SiteNetworkService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( resource_group_name=resource_group_name, - device_name=device_name, + site_network_service_name=site_network_service_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -818,8 +809,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -829,7 +821,7 @@ def update_tags( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Device", pipeline_response) + deserialized = self._deserialize("SiteNetworkService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -837,25 +829,23 @@ def update_tags( return deserialized update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}" } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Device"]: - """Lists all the devices in a subscription. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SiteNetworkService"]: + """Lists all sites in the network service in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Device or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Device] + :return: An iterator like instance of either SiteNetworkService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.SiteNetworkService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DeviceListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SiteNetworkServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -897,7 +887,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeviceListResult", pipeline_response) + deserialized = self._deserialize("SiteNetworkServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -906,8 +896,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -920,27 +911,27 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices"} + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices" + } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Device"]: - """Lists all the device resource in a resource group. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SiteNetworkService"]: + """Lists all site network services. :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 Device or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Device] + :return: An iterator like instance of either SiteNetworkService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.SiteNetworkService] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DeviceListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SiteNetworkServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -983,7 +974,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeviceListResult", pipeline_response) + deserialized = self._deserialize("SiteNetworkServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -992,8 +983,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1007,71 +999,5 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices" - } - - @distributed_trace - def list_registration_key( - self, resource_group_name: str, device_name: str, **kwargs: Any - ) -> _models.DeviceRegistrationKey: - """List the registration key for the device. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param device_name: The name of the device resource. Required. - :type device_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeviceRegistrationKey or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.DeviceRegistrationKey - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DeviceRegistrationKey] = kwargs.pop("cls", None) - - request = build_list_registration_key_request( - resource_group_name=resource_group_name, - device_name=device_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_registration_key.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeviceRegistrationKey", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_registration_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}/listRegistrationKey" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices" } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_sites_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_sites_operations.py new file mode 100644 index 000000000000..71565e68c72d --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_sites_operations.py @@ -0,0 +1,962 @@ +# 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request(resource_group_name: str, site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}", + ) # 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 + ), + "siteName": _SERIALIZER.url( + "site_name", site_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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_get_request(resource_group_name: str, site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}", + ) # 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 + ), + "siteName": _SERIALIZER.url( + "site_name", site_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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_create_or_update_request( + resource_group_name: str, site_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-09-01")) + 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.HybridNetwork/sites/{siteName}", + ) # 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 + ), + "siteName": _SERIALIZER.url( + "site_name", site_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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_update_tags_request( + resource_group_name: str, site_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-09-01")) + 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.HybridNetwork/sites/{siteName}", + ) # 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 + ), + "siteName": _SERIALIZER.url( + "site_name", site_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**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_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites", + ) # 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 = _url.format(**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 SitesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s + :attr:`sites` 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 _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, site_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, + site_name=site_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) + + 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.HybridNetwork/sites/{siteName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, site_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_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, + site_name=site_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.HybridNetwork/sites/{siteName}" + } + + @distributed_trace + def get(self, resource_group_name: str, site_name: str, **kwargs: Any) -> _models.Site: + """Gets information about the specified network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site + :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.Site] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + site_name=site_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("Site", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, site_name: str, parameters: Union[_models.Site, IO], **kwargs: Any + ) -> _models.Site: + 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.Site] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Site") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + site_name=site_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_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, 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("Site", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Site", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + site_name: str, + parameters: _models.Site, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Site]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. + Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.Site + :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 Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + site_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Site]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. + Required. + :type parameters: 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 Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Site] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, site_name: str, parameters: Union[_models.Site, IO], **kwargs: Any + ) -> LROPoller[_models.Site]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. Is + either a Site type or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.Site 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 Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Site] + :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.Site] = 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_or_update_initial( + resource_group_name=resource_group_name, + site_name=site_name, + parameters=parameters, + 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("Site", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + site_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Site: + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject + :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: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + site_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Site: + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. Required. + :type parameters: 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: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, site_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Site: + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param site_name: The name of the network service site. Required. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.hybridnetwork.models.TagsObject 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: Site or the result of cls(response) + :rtype: ~azure.mgmt.hybridnetwork.models.Site + :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.Site] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + site_name=site_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("Site", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Site"]: + """Lists all sites in the network service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Site or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Site] + :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.SiteListResult] = 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("SiteListResult", 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.HybridNetwork/sites"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Site"]: + """Lists all sites in the network service. + + :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 Site or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Site] + :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.SiteListResult] = 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("SiteListResult", 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.HybridNetwork/sites" + } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py deleted file mode 100644 index 57e33249157b..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py +++ /dev/null @@ -1,585 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -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( - location_name: str, vendor_name: str, service_key: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "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_create_or_update_request( - location_name: str, vendor_name: str, service_key: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-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}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "serviceKey": _SERIALIZER.url("service_key", service_key, "str"), - "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 - 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_list_request( - location_name: str, vendor_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _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 VendorNetworkFunctionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`vendor_network_functions` 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, location_name: str, vendor_name: str, service_key: str, **kwargs: Any - ) -> _models.VendorNetworkFunction: - """Gets information about the specified vendor network function. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VendorNetworkFunction or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.VendorNetworkFunction - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorNetworkFunction] = kwargs.pop("cls", None) - - request = build_get_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VendorNetworkFunction", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" - } - - def _create_or_update_initial( - self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: Union[_models.VendorNetworkFunction, IO], - **kwargs: Any - ) -> _models.VendorNetworkFunction: - 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: Literal["2022-01-01-preview"] = 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.VendorNetworkFunction] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VendorNetworkFunction") - - request = build_create_or_update_request( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("VendorNetworkFunction", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VendorNetworkFunction", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" - } - - @overload - def begin_create_or_update( - self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: _models.VendorNetworkFunction, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VendorNetworkFunction]: - """Creates or updates a vendor network function. This operation can take up to 6 hours to - complete. This is expected service behavior. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param parameters: Parameters supplied to the create or update vendor network function - operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorNetworkFunction - :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 VendorNetworkFunction or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VendorNetworkFunction]: - """Creates or updates a vendor network function. This operation can take up to 6 hours to - complete. This is expected service behavior. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param parameters: Parameters supplied to the create or update vendor network function - operation. Required. - :type parameters: 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 VendorNetworkFunction or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - location_name: str, - vendor_name: str, - service_key: str, - parameters: Union[_models.VendorNetworkFunction, IO], - **kwargs: Any - ) -> LROPoller[_models.VendorNetworkFunction]: - """Creates or updates a vendor network function. This operation can take up to 6 hours to - complete. This is expected service behavior. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param service_key: The GUID for the vendor network function. Required. - :type service_key: str - :param parameters: Parameters supplied to the create or update vendor network function - operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.VendorNetworkFunction 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 VendorNetworkFunction or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = 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.VendorNetworkFunction] = 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_or_update_initial( - location_name=location_name, - vendor_name=vendor_name, - service_key=service_key, - parameters=parameters, - 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("VendorNetworkFunction", 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_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}" - } - - @distributed_trace - def list( - self, location_name: str, vendor_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.VendorNetworkFunction"]: - """Lists all the vendor network function sub resources in an Azure region, filtered by skuType, - skuName, vendorProvisioningState. - - :param location_name: The Azure region where the network function resource was created by the - customer. Required. - :type location_name: str - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param filter: The filter to apply on the operation. The properties you can use for eq (equals) - are: skuType, skuName and vendorProvisioningState. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VendorNetworkFunction or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.VendorNetworkFunction] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorNetworkFunctionListResult] = 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( - location_name=location_name, - vendor_name=vendor_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("VendorNetworkFunctionListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions" - } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py deleted file mode 100644 index 0e321b094940..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py +++ /dev/null @@ -1,721 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -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(vendor_name: str, 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), - "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_create_or_update_request( - vendor_name: str, sku_name: str, preview_subscription: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), - "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, "str"), - "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 - 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( - vendor_name: str, sku_name: str, preview_subscription: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), - "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, "str"), - "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_delete_request( - vendor_name: str, sku_name: str, preview_subscription: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), - "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, "str"), - "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class VendorSkuPreviewOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`vendor_sku_preview` 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, vendor_name: str, sku_name: str, **kwargs: Any) -> Iterable["_models.PreviewSubscription"]: - """Lists all the preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the sku. Required. - :type sku_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PreviewSubscription or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.PreviewSubscription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PreviewSubscriptionsList] = 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( - vendor_name=vendor_name, - sku_name=sku_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("PreviewSubscriptionsList", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions" - } - - def _create_or_update_initial( - self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: Union[_models.PreviewSubscription, IO], - **kwargs: Any - ) -> _models.PreviewSubscription: - 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: Literal["2022-01-01-preview"] = 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.PreviewSubscription] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PreviewSubscription") - - request = build_create_or_update_request( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("PreviewSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PreviewSubscription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" - } - - @overload - def begin_create_or_update( - self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: _models.PreviewSubscription, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PreviewSubscription]: - """Creates or updates preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :param parameters: Parameters supplied to the create or update vendor preview subscription - operation. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.PreviewSubscription - :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 PreviewSubscription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.PreviewSubscription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PreviewSubscription]: - """Creates or updates preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :param parameters: Parameters supplied to the create or update vendor preview subscription - operation. Required. - :type parameters: 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 PreviewSubscription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.PreviewSubscription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - vendor_name: str, - sku_name: str, - preview_subscription: str, - parameters: Union[_models.PreviewSubscription, IO], - **kwargs: Any - ) -> LROPoller[_models.PreviewSubscription]: - """Creates or updates preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :param parameters: Parameters supplied to the create or update vendor preview subscription - operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.hybridnetwork.models.PreviewSubscription 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 PreviewSubscription or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.PreviewSubscription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = 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.PreviewSubscription] = 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_or_update_initial( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, - parameters=parameters, - 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("PreviewSubscription", 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_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" - } - - @distributed_trace - def get( - self, vendor_name: str, sku_name: str, preview_subscription: str, **kwargs: Any - ) -> _models.PreviewSubscription: - """Gets the preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PreviewSubscription or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.PreviewSubscription - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PreviewSubscription] = kwargs.pop("cls", None) - - request = build_get_request( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, - 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PreviewSubscription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, vendor_name: str, sku_name: str, preview_subscription: 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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, - 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" - } - - @distributed_trace - def begin_delete( - self, vendor_name: str, sku_name: str, preview_subscription: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the preview information of a vendor sku. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param sku_name: The name of the vendor sku. Required. - :type sku_name: str - :param preview_subscription: Preview subscription ID. Required. - :type preview_subscription: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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: Literal["2022-01-01-preview"] = 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 - vendor_name=vendor_name, - sku_name=sku_name, - preview_subscription=preview_subscription, - 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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}" - } diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py deleted file mode 100644 index 680c56dca86b..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py +++ /dev/null @@ -1,641 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import sys -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request(vendor_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(vendor_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "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_create_or_update_request(vendor_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "vendorName": _SERIALIZER.url("vendor_name", vendor_name, "str"), - "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 - 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_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-01-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors") - 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 VendorsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridnetwork.HybridNetworkManagementClient`'s - :attr:`vendors` 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 _delete_initial( # pylint: disable=inconsistent-return-statements - self, vendor_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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - vendor_name=vendor_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - } - - @distributed_trace - def begin_delete(self, vendor_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the specified vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_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: Literal["2022-01-01-preview"] = 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 - vendor_name=vendor_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}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - } - - @distributed_trace - def get(self, vendor_name: str, **kwargs: Any) -> _models.Vendor: - """Gets information about the specified vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vendor or the result of cls(response) - :rtype: ~azure.mgmt.hybridnetwork.models.Vendor - :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: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Vendor] = kwargs.pop("cls", None) - - request = build_get_request( - vendor_name=vendor_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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Vendor", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}"} - - def _create_or_update_initial( - self, vendor_name: str, parameters: Optional[Union[_models.Vendor, IO]] = None, **kwargs: Any - ) -> _models.Vendor: - 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: Literal["2022-01-01-preview"] = 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.Vendor] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "Vendor") - else: - _json = None - - request = build_create_or_update_request( - vendor_name=vendor_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("Vendor", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vendor", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - } - - @overload - def begin_create_or_update( - self, - vendor_name: str, - parameters: Optional[_models.Vendor] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Vendor]: - """Creates or updates a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param parameters: Parameters supplied to the create vendor operation. Default value is None. - :type parameters: ~azure.mgmt.hybridnetwork.models.Vendor - :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 Vendor or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Vendor] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - vendor_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Vendor]: - """Creates or updates a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param parameters: Parameters supplied to the create vendor operation. Default value is None. - :type parameters: 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 Vendor or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Vendor] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, vendor_name: str, parameters: Optional[Union[_models.Vendor, IO]] = None, **kwargs: Any - ) -> LROPoller[_models.Vendor]: - """Creates or updates a vendor. - - :param vendor_name: The name of the vendor. Required. - :type vendor_name: str - :param parameters: Parameters supplied to the create vendor operation. Is either a model type - or a IO type. Default value is None. - :type parameters: ~azure.mgmt.hybridnetwork.models.Vendor 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 Vendor or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridnetwork.models.Vendor] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = 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.Vendor] = 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_or_update_initial( - vendor_name=vendor_name, - parameters=parameters, - 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("Vendor", 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_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Vendor"]: - """Lists all the vendors in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Vendor or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridnetwork.models.Vendor] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-01-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VendorListResult] = 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("VendorListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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.HybridNetwork/vendors"} diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_create.py new file mode 100644 index 000000000000..d8ee57d19c44 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_manifest_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_manifests.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + artifact_manifest_name="TestManifest", + parameters={ + "location": "eastus", + "properties": { + "artifacts": [ + {"artifactName": "fed-rbac", "artifactType": "OCIArtifact", "artifactVersion": "1.0.0"}, + {"artifactName": "nginx", "artifactType": "OCIArtifact", "artifactVersion": "v1"}, + ] + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_restart.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_delete.py similarity index 79% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_restart.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_delete.py index 402eab02e1a1..253df1ca954d 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_restart.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python role_instance_restart.py + python artifact_manifest_delete.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, @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.role_instances.begin_restart( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", - role_instance_name="mrm", + client.artifact_manifests.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + artifact_manifest_name="TestManifest", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/RoleInstanceRestart.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_get.py similarity index 80% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_get.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_get.py index 3d3f7bc613a6..69f06604384d 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python role_instance_get.py + python artifact_manifest_get.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, @@ -29,15 +29,15 @@ def main(): subscription_id="subid", ) - response = client.role_instances.get( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", - role_instance_name="mrm", + response = client.artifact_manifests.get( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + artifact_manifest_name="TestManifest", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/RoleInstanceGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_by_artifact_store.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_by_artifact_store.py new file mode 100644 index 000000000000..7d59d4c00031 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_by_artifact_store.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_manifest_list_by_artifact_store.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_manifests.list_by_artifact_store( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestListByArtifactStore.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_credential.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_credential.py new file mode 100644 index 000000000000..e1b65a5bdcbc --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_list_credential.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_manifest_list_credential.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_manifests.list_credential( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + artifact_manifest_name="TestArtifactManifestName", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestListCredential.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_state.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_state.py new file mode 100644 index 000000000000..0935668736a5 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_state.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_manifest_update_state.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_manifests.begin_update_state( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + artifact_manifest_name="TestArtifactManifestName", + parameters={"artifactManifestState": "Uploaded"}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestUpdateState.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_tags.py new file mode 100644 index 000000000000..e1f367985ecb --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_manifest_update_tags.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_manifest_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_manifests.update( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + artifact_manifest_name="TestManifest", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_create.py similarity index 73% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_create.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_create.py index 86947b2083be..85aebe4f1fb4 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_create.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_create.py + python artifact_store_create.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, @@ -29,22 +29,22 @@ def main(): subscription_id="subid", ) - response = client.devices.begin_create_or_update( - resource_group_name="rg1", - device_name="TestDevice", + response = client.artifact_stores.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", parameters={ "location": "eastus", "properties": { - "azureStackEdge": { - "id": "/subscriptions/subid1/resourcegroups/rg2/providers/Microsoft.DataboxEdge/DataboxEdgeDevices/TestDataboxEdgeDeviceName" - }, - "deviceType": "AzureStackEdge", + "managedResourceGroupConfiguration": {"location": "eastus", "name": "testRg"}, + "replicationStrategy": "SingleReplication", + "storeType": "AzureContainerRegistry", }, }, ).result() print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceCreate.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreCreate.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_delete.py new file mode 100644 index 000000000000..da7804a9a52d --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_store_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.artifact_stores.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_get.py new file mode 100644 index 000000000000..70c930933c51 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_store_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_stores.get( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStoreName", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_update_tags.py new file mode 100644 index 000000000000..f4779ef68464 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_store_update_tags.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_store_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.artifact_stores.update( + resource_group_name="rg", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStore", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_sku_details_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_stores_list_by_publisher_name.py similarity index 82% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_sku_details_get.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_stores_list_by_publisher_name.py index 9781d994b34e..36220aa536f5 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_sku_details_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/artifact_stores_list_by_publisher_name.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python network_function_sku_details_get.py + python artifact_stores_list_by_publisher_name.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, @@ -29,14 +29,14 @@ def main(): subscription_id="subid", ) - response = client.network_function_vendor_skus.list_by_sku( - vendor_name="testVendor", - vendor_sku_name="testSku", + response = client.artifact_stores.list_by_publisher( + resource_group_name="rg", + publisher_name="TestPublisher", ) for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionSkuDetailsGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoresListByPublisherName.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_create.py new file mode 100644 index 000000000000..a0f585bf91ac --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_functions.begin_create_or_update( + resource_group_name="rg", + network_function_name="testNf", + parameters={ + "location": "eastus", + "properties": { + "allowSoftwareUpdate": False, + "configurationType": "Open", + "deploymentValues": '{"virtualMachineName":"test-VM","cpuCores":4,"memorySizeGB":8,"cloudServicesNetworkAttachment":{"attachedNetworkId":"test-csnet","ipAllocationMethod":"Dynamic","networkAttachmentName":"test-cs-vlan"},"networkAttachments":[{"attachedNetworkId":"test-l3vlan","defaultGateway":"True","ipAllocationMethod":"Dynamic","networkAttachmentName":"test-vlan"}],"sshPublicKeys":[{"keyData":"ssh-rsa CMIIIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0TqlveKKlc2MFvEmuXJiLGBsY1t4ML4uiRADGSZlnc+7Ugv3h+MCjkkwOKiOdsNo8k4KSBIG5GcQfKYOOd17AJvqCL6cGQbaLuqv0a64jeDm8oO8/xN/IM0oKw7rMr/2oAJOgIsfeXPkRxWWic9AVIS++H5Qi2r7bUFX+cqFsyUCAwEBBQ=="}],"storageProfile":{"osDisk":{"createOption":"Ephemeral","deleteOption":"Delete","diskSizeGB":10}},"userData":"testUserData","adminUsername":"testUser","virtioInterface":"Transitional","isolateEmulatorThread":"False","bootMethod":"BIOS","placementHints":[]}', + "networkFunctionDefinitionVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1", + "idType": "Open", + }, + "nfviId": "/subscriptions/subid/resourceGroups/testResourceGroup", + "nfviType": "AzureCore", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_create.py new file mode 100644 index 000000000000..bb917ef167df --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_create.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_definition_version_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + parameters={ + "location": "eastus", + "properties": { + "deployParameters": '{"virtualMachineName":{"type":"string"},"cpuCores":{"type":"int"},"memorySizeGB":{"type":"int"},"cloudServicesNetworkAttachment":{"type":"object","properties":{"networkAttachmentName":{"type":"string"},"attachedNetworkId":{"type":"string"},"ipAllocationMethod":{"type":"string"},"ipv4Address":{"type":"string"},"ipv6Address":{"type":"string"},"defaultGateway":{"type":"string"}},"required":["attachedNetworkId","ipAllocationMethod"]},"networkAttachments":{"type":"array","items":{"type":"object","properties":{"networkAttachmentName":{"type":"string"},"attachedNetworkId":{"type":"string"},"ipAllocationMethod":{"type":"string"},"ipv4Address":{"type":"string"},"ipv6Address":{"type":"string"},"defaultGateway":{"type":"string"}},"required":["attachedNetworkId","ipAllocationMethod"]}},"storageProfile":{"type":"object","properties":{"osDisk":{"type":"object","properties":{"createOption":{"type":"string"},"deleteOption":{"type":"string"},"diskSizeGB":{"type":"integer"}},"required":["diskSizeGB"]}},"required":["osDisk"]},"sshPublicKeys":{"type":"array","items":{"type":"object","properties":{"keyData":{"type":"string"}},"required":["keyData"]}},"userData":{"type":"string"},"adminUsername":{"type":"string"},"bootMethod":{"type":"string","default":"UEFI","enum":["UEFI","BIOS"]},"isolateEmulatorThread":{"type":"string"},"virtioInterface":{"type":"string"},"placementHints":{"type":"array","items":{"type":"object","properties":{"hintType":{"type":"string","enum":["Affinity","AntiAffinity"]},"resourceId":{"type":"string"},"schedulingExecution":{"type":"string","enum":["Soft","Hard"]},"scope":{"type":"string"}},"required":["hintType","schedulingExecution","resourceId","scope"]}}}', + "description": "test NFDV for AzureCore", + "networkFunctionTemplate": { + "networkFunctionApplications": [ + { + "artifactProfile": { + "artifactStore": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore" + }, + "vhdArtifactProfile": {"vhdName": "test-image", "vhdVersion": "1-0-0"}, + }, + "artifactType": "VhdImageFile", + "dependsOnProfile": { + "installDependsOn": [], + "uninstallDependsOn": [], + "updateDependsOn": [], + }, + "deployParametersMappingRuleProfile": { + "applicationEnablement": "Unknown", + "vhdImageMappingRuleProfile": {"userConfiguration": ""}, + }, + "name": "testImageRole", + }, + { + "artifactProfile": { + "artifactStore": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore" + }, + "templateArtifactProfile": { + "templateName": "test-template", + "templateVersion": "1.0.0", + }, + }, + "artifactType": "ArmTemplate", + "dependsOnProfile": { + "installDependsOn": ["testImageRole"], + "uninstallDependsOn": ["testImageRole"], + "updateDependsOn": ["testImageRole"], + }, + "deployParametersMappingRuleProfile": { + "applicationEnablement": "Unknown", + "templateMappingRuleProfile": { + "templateParameters": '{"virtualMachineName":"{deployParameters.virtualMachineName}","cpuCores":"{deployParameters.cpuCores}","memorySizeGB":"{deployParameters.memorySizeGB}","cloudServicesNetworkAttachment":"{deployParameters.cloudServicesNetworkAttachment}","networkAttachments":"{deployParameters.networkAttachments}","sshPublicKeys":"{deployParameters.sshPublicKeys}","storageProfile":"{deployParameters.storageProfile}","isolateEmulatorThread":"{deployParameters.isolateEmulatorThread}","virtioInterface":"{deployParameters.virtioInterface}","userData":"{deployParameters.userData}","adminUsername":"{deployParameters.adminUsername}","bootMethod":"{deployParameters.bootMethod}","placementHints":"{deployParameters.placementHints}"}' + }, + }, + "name": "testTemplateRole", + }, + ], + "nfviType": "AzureCore", + }, + "networkFunctionType": "VirtualNetworkFunction", + "versionState": "Preview", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_delete.py new file mode 100644 index 000000000000..ce238e027ded --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_definition_version_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.network_function_definition_versions.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_get.py new file mode 100644 index 000000000000..463e17c737a0 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_definition_version_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_definition_version_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.get( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_delete.py similarity index 83% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_delete.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_delete.py index c10168e64de1..f13d7eee009a 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_delete.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_sku_delete.py + python virtual_network_function_delete.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, @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.vendor_skus.begin_delete( - vendor_name="TestVendor", - sku_name="TestSku", + client.network_functions.begin_delete( + resource_group_name="rg", + network_function_name="testNf", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuDelete.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_get.py new file mode 100644 index 000000000000..a1a9d885ea08 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_core/virtual_network_function_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_functions.get( + resource_group_name="rg", + network_function_name="testNf", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_create.py new file mode 100644 index 000000000000..68d2f830eefc --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_functions.begin_create_or_update( + resource_group_name="rg", + network_function_name="testNf", + parameters={ + "location": "eastus", + "properties": { + "allowSoftwareUpdate": False, + "configurationType": "Open", + "deploymentValues": '{"virtualMachineName":"test-VM","extendedLocationName":"test-cluster","cpuCores":4,"memorySizeGB":8,"cloudServicesNetworkAttachment":{"attachedNetworkId":"test-csnet","ipAllocationMethod":"Dynamic","networkAttachmentName":"test-cs-vlan"},"networkAttachments":[{"attachedNetworkId":"test-l3vlan","defaultGateway":"True","ipAllocationMethod":"Dynamic","networkAttachmentName":"test-vlan"}],"sshPublicKeys":[{"keyData":"ssh-rsa CMIIIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0TqlveKKlc2MFvEmuXJiLGBsY1t4ML4uiRADGSZlnc+7Ugv3h+MCjkkwOKiOdsNo8k4KSBIG5GcQfKYOOd17AJvqCL6cGQbaLuqv0a64jeDm8oO8/xN/IM0oKw7rMr/2oAJOgIsfeXPkRxWWic9AVIS++H5Qi2r7bUFX+cqFsyUCAwEBBQ=="}],"storageProfile":{"osDisk":{"createOption":"Ephemeral","deleteOption":"Delete","diskSizeGB":10}},"userData":"testUserData","adminUsername":"testUser","virtioInterface":"Transitional","isolateEmulatorThread":"False","bootMethod":"BIOS","placementHints":[]}', + "networkFunctionDefinitionVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1", + "idType": "Open", + }, + "nfviId": "/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation", + "nfviType": "AzureOperatorNexus", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_create.py new file mode 100644 index 000000000000..bd23e175c833 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_create.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_definition_version_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + parameters={ + "location": "eastus", + "properties": { + "deployParameters": '{"virtualMachineName":{"type":"string"},"extendedLocationName":{"type":"string"},"cpuCores":{"type":"int"},"memorySizeGB":{"type":"int"},"cloudServicesNetworkAttachment":{"type":"object","properties":{"networkAttachmentName":{"type":"string"},"attachedNetworkId":{"type":"string"},"ipAllocationMethod":{"type":"string"},"ipv4Address":{"type":"string"},"ipv6Address":{"type":"string"},"defaultGateway":{"type":"string"}},"required":["attachedNetworkId","ipAllocationMethod"]},"networkAttachments":{"type":"array","items":{"type":"object","properties":{"networkAttachmentName":{"type":"string"},"attachedNetworkId":{"type":"string"},"ipAllocationMethod":{"type":"string"},"ipv4Address":{"type":"string"},"ipv6Address":{"type":"string"},"defaultGateway":{"type":"string"}},"required":["attachedNetworkId","ipAllocationMethod"]}},"storageProfile":{"type":"object","properties":{"osDisk":{"type":"object","properties":{"createOption":{"type":"string"},"deleteOption":{"type":"string"},"diskSizeGB":{"type":"integer"}},"required":["diskSizeGB"]}},"required":["osDisk"]},"sshPublicKeys":{"type":"array","items":{"type":"object","properties":{"keyData":{"type":"string"}},"required":["keyData"]}},"userData":{"type":"string"},"adminUsername":{"type":"string"},"bootMethod":{"type":"string","default":"UEFI","enum":["UEFI","BIOS"]},"isolateEmulatorThread":{"type":"string"},"virtioInterface":{"type":"string"},"placementHints":{"type":"array","items":{"type":"object","properties":{"hintType":{"type":"string","enum":["Affinity","AntiAffinity"]},"resourceId":{"type":"string"},"schedulingExecution":{"type":"string","enum":["Soft","Hard"]},"scope":{"type":"string"}},"required":["hintType","schedulingExecution","resourceId","scope"]}}}', + "description": "test NFDV for AzureOperatorNexus", + "networkFunctionTemplate": { + "networkFunctionApplications": [ + { + "artifactProfile": { + "artifactStore": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore" + }, + "imageArtifactProfile": {"imageName": "test-image", "imageVersion": "1.0.0"}, + }, + "artifactType": "ImageFile", + "dependsOnProfile": { + "installDependsOn": [], + "uninstallDependsOn": [], + "updateDependsOn": [], + }, + "deployParametersMappingRuleProfile": { + "applicationEnablement": "Unknown", + "imageMappingRuleProfile": {"userConfiguration": ""}, + }, + "name": "testImageRole", + }, + { + "artifactProfile": { + "artifactStore": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore" + }, + "templateArtifactProfile": { + "templateName": "test-template", + "templateVersion": "1.0.0", + }, + }, + "artifactType": "ArmTemplate", + "dependsOnProfile": { + "installDependsOn": ["testImageRole"], + "uninstallDependsOn": ["testImageRole"], + "updateDependsOn": ["testImageRole"], + }, + "deployParametersMappingRuleProfile": { + "applicationEnablement": "Unknown", + "templateMappingRuleProfile": { + "templateParameters": '{"virtualMachineName":"{deployParameters.virtualMachineName}","extendedLocationName":"{deployParameters.extendedLocationName}","cpuCores":"{deployParameters.cpuCores}","memorySizeGB":"{deployParameters.memorySizeGB}","cloudServicesNetworkAttachment":"{deployParameters.cloudServicesNetworkAttachment}","networkAttachments":"{deployParameters.networkAttachments}","sshPublicKeys":"{deployParameters.sshPublicKeys}","storageProfile":"{deployParameters.storageProfile}","isolateEmulatorThread":"{deployParameters.isolateEmulatorThread}","virtioInterface":"{deployParameters.virtioInterface}","userData":"{deployParameters.userData}","adminUsername":"{deployParameters.adminUsername}","bootMethod":"{deployParameters.bootMethod}","placementHints":"{deployParameters.placementHints}"}' + }, + }, + "name": "testTemplateRole", + }, + ], + "nfviType": "AzureOperatorNexus", + }, + "networkFunctionType": "VirtualNetworkFunction", + "versionState": "Preview", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_delete.py new file mode 100644 index 000000000000..70ef9d85fedf --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_definition_version_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.network_function_definition_versions.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_get.py new file mode 100644 index 000000000000..8a9feb750f61 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_definition_version_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_definition_version_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.get( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_delete.py new file mode 100644 index 000000000000..8c7665433a30 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python virtual_network_function_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.network_functions.begin_delete( + resource_group_name="rg", + network_function_name="testNf", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_get.py similarity index 83% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_get.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_get.py index 953920ce3323..45ed54d68bca 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/azure_operator_nexus/virtual_network_function_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_nf_get.py + python virtual_network_function_get.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, @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.vendor_network_functions.get( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", + response = client.network_functions.get( + resource_group_name="rg", + network_function_name="testNf", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorNfGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_list_credential.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/component_get.py similarity index 84% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_list_credential.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/component_get.py index fb08401d69f4..2ffe407545d0 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_list_credential.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/component_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_sku_list_credential.py + python component_get.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, @@ -29,13 +29,14 @@ def main(): subscription_id="subid", ) - response = client.vendor_skus.list_credential( - vendor_name="TestVendor", - sku_name="TestSku", + response = client.components.get( + resource_group_name="rg", + network_function_name="testNf", + component_name="testComponent", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuListCredential.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_sku_list_by_vendor.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/component_list_by_network_function.py similarity index 83% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_sku_list_by_vendor.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/component_list_by_network_function.py index 1160a1680135..447dbabb7ed7 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_sku_list_by_vendor.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/component_list_by_network_function.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python network_function_sku_list_by_vendor.py + python component_list_by_network_function.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, @@ -29,13 +29,14 @@ def main(): subscription_id="subid", ) - response = client.network_function_vendor_skus.list_by_vendor( - vendor_name="testVendor", + response = client.components.list_by_network_function( + resource_group_name="rg", + network_function_name="testNf", ) for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionSkuListByVendor.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentListByNetworkFunction.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_create.py new file mode 100644 index 000000000000..d4d353a16d02 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_schema_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_schemas.begin_create_or_update( + resource_group_name="rg1", + publisher_name="testPublisher", + configuration_group_schema_name="testConfigurationGroupSchema", + parameters={ + "location": "westUs2", + "properties": { + "description": "Schema with no secrets", + "schemaDefinition": '{"type":"object","properties":{"interconnect-groups":{"type":"object","properties":{"type":"object","properties":{"name":{"type":"string"},"international-interconnects":{"type":"array","item":{"type":"string"}},"domestic-interconnects":{"type":"array","item":{"type":"string"}}}}},"interconnect-group-assignments":{"type":"object","properties":{"type":"object","properties":{"ssc":{"type":"string"},"interconnects-interconnects":{"type":"string"}}}}},"required":["interconnect-groups","interconnect-group-assignments"]}', + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_delete.py new file mode 100644 index 000000000000..0d1755f31a13 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_schema_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.configuration_group_schemas.begin_delete( + resource_group_name="rg1", + publisher_name="testPublisher", + configuration_group_schema_name="testConfigurationGroupSchema", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_get.py new file mode 100644 index 000000000000..ce818983fc75 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_schema_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_schemas.get( + resource_group_name="rg1", + publisher_name="testPublisher", + configuration_group_schema_name="testConfigurationGroupSchema", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_list_by_publisher_name.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_list_by_publisher_name.py new file mode 100644 index 000000000000..0d18d2e366ba --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_list_by_publisher_name.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_schema_list_by_publisher_name.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_schemas.list_by_publisher( + resource_group_name="rg1", + publisher_name="testPublisher", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaListByPublisherName.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_update_tags.py new file mode 100644 index 000000000000..db701decd50c --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_update_tags.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_schema_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_schemas.update( + resource_group_name="rg1", + publisher_name="testPublisher", + configuration_group_schema_name="testConfigurationGroupSchema", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_version_update_state.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_version_update_state.py new file mode 100644 index 000000000000..2f5fae49cec1 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_schema_version_update_state.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_schema_version_update_state.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_schemas.begin_update_state( + resource_group_name="rg1", + publisher_name="testPublisher", + configuration_group_schema_name="testConfigurationGroupSchema", + parameters={"versionState": "Active"}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaVersionUpdateState.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create.py new file mode 100644 index 000000000000..02c1b572e6df --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.begin_create_or_update( + resource_group_name="rg1", + configuration_group_value_name="testConfigurationGroupValue", + parameters={ + "location": "eastus", + "properties": { + "configurationGroupSchemaResourceReference": { + "id": "/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName", + "idType": "Open", + }, + "configurationType": "Open", + "configurationValue": '{"interconnect-groups":{"stripe-one":{"name":"Stripe one","international-interconnects":["france","germany"],"domestic-interconnects":["birmingham","edinburgh"]},"stripe-two":{"name":"Stripe two","international-interconnects":["germany","italy"],"domestic-interconnects":["edinburgh","london"]}},"interconnect-group-assignments":{"ssc-one":{"ssc":"SSC 1","interconnects":"stripe-one"},"ssc-two":{"ssc":"SSC 2","interconnects":"stripe-two"}}}', + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create_secret.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create_secret.py new file mode 100644 index 000000000000..916bc84f5b90 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_create_secret.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_create_secret.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.begin_create_or_update( + resource_group_name="rg1", + configuration_group_value_name="testConfigurationGroupValue", + parameters={ + "location": "eastus", + "properties": { + "configurationGroupSchemaResourceReference": { + "id": "/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName", + "idType": "Open", + }, + "configurationType": "Secret", + "secretConfigurationValue": '{"interconnect-groups":{"stripe-one":{"name":"Stripe one","international-interconnects":["france","germany"],"domestic-interconnects":["birmingham","edinburgh"]},"stripe-two":{"name":"Stripe two","international-interconnects":["germany","italy"],"domestic-interconnects":["edinburgh","london"]}},"interconnect-group-assignments":{"ssc-one":{"ssc":"SSC 1","interconnects":"stripe-one"},"ssc-two":{"ssc":"SSC 2","interconnects":"stripe-two"}}}', + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueCreateSecret.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_delete.py new file mode 100644 index 000000000000..2870765bb941 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.configuration_group_values.begin_delete( + resource_group_name="rg1", + configuration_group_value_name="testConfigurationGroupValue", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_first_party_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_first_party_create.py new file mode 100644 index 000000000000..c7240a90bfb2 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_first_party_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_first_party_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.begin_create_or_update( + resource_group_name="rg1", + configuration_group_value_name="testConfigurationGroupValue", + parameters={ + "location": "eastus", + "properties": { + "configurationGroupSchemaResourceReference": { + "id": "/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName", + "idType": "Secret", + }, + "configurationType": "Open", + "configurationValue": '{"interconnect-groups":{"stripe-one":{"name":"Stripe one","international-interconnects":["france","germany"],"domestic-interconnects":["birmingham","edinburgh"]},"stripe-two":{"name":"Stripe two","international-interconnects":["germany","italy"],"domestic-interconnects":["edinburgh","london"]}},"interconnect-group-assignments":{"ssc-one":{"ssc":"SSC 1","interconnects":"stripe-one"},"ssc-two":{"ssc":"SSC 2","interconnects":"stripe-two"}}}', + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueFirstPartyCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_get.py new file mode 100644 index 000000000000..51352f4f0985 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.get( + resource_group_name="rg1", + configuration_group_value_name="testConfigurationGroupValue", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_resource_group.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_resource_group.py new file mode 100644 index 000000000000..0f4be7595d9c --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_resource_group.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_list_by_resource_group.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.list_by_resource_group( + resource_group_name="rg1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_subscription.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_subscription.py new file mode 100644 index 000000000000..ae0be099b050 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_list_by_subscription.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_list_by_subscription.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_update_tags.py new file mode 100644 index 000000000000..8c31ff0c2ca2 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/configuration_group_value_update_tags.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python configuration_group_value_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.configuration_group_values.update_tags( + resource_group_name="rg1", + configuration_group_value_name="testConfigurationGroupValue", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/get_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/get_operations.py index 31cdf2de16df..dea158dbeaac 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/get_operations.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/get_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/GetOperations.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create.py index 653894872407..7f98b706a9a7 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create.py @@ -35,57 +35,25 @@ def main(): parameters={ "location": "eastus", "properties": { - "device": { - "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/devices/testDevice" + "allowSoftwareUpdate": False, + "configurationType": "Open", + "deploymentValues": '{"releaseName":"testReleaseName","namespace":"testNamespace"}', + "networkFunctionDefinitionVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1", + "idType": "Open", }, - "managedApplicationParameters": {}, - "networkFunctionUserConfigurations": [ - { - "networkInterfaces": [ - { - "ipConfigurations": [ - { - "dnsServers": None, - "gateway": "", - "ipAddress": "", - "ipAllocationMethod": "Dynamic", - "ipVersion": "IPv4", - "subnet": "", - } - ], - "macAddress": "", - "networkInterfaceName": "nic1", - "vmSwitchType": "Management", - }, - { - "ipConfigurations": [ - { - "dnsServers": None, - "gateway": "", - "ipAddress": "", - "ipAllocationMethod": "Dynamic", - "ipVersion": "IPv4", - "subnet": "", - } - ], - "macAddress": "DC-97-F8-79-16-7D", - "networkInterfaceName": "nic2", - "vmSwitchType": "Wan", - }, - ], - "roleName": "testRole", - "userDataParameters": {}, - } + "nfviId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation", + "nfviType": "AzureArcKubernetes", + "roleOverrideValues": [ + '{"name":"testRoleOne","deployParametersMappingRuleProfile":{"helmMappingRuleProfile":{"helmPackageVersion":"2.1.3","values":"{\\"roleOneParam\\":\\"roleOneOverrideValue\\"}"}}}', + '{"name":"testRoleTwo","deployParametersMappingRuleProfile":{"helmMappingRuleProfile":{"releaseName":"overrideReleaseName","releaseNamespace":"overrideNamespace","values":"{\\"roleTwoParam\\":\\"roleTwoOverrideValue\\"}"}}}', ], - "skuName": "testSku", - "skuType": "SDWAN", - "vendorName": "testVendor", }, }, ).result() print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionCreate.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionCreate.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create_secret.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create_secret.py new file mode 100644 index 000000000000..7335caeeb68c --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_create_secret.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_create_secret.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_functions.begin_create_or_update( + resource_group_name="rg", + network_function_name="testNf", + parameters={ + "location": "eastus", + "properties": { + "allowSoftwareUpdate": False, + "configurationType": "Secret", + "networkFunctionDefinitionVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1", + "idType": "Open", + }, + "nfviId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation", + "nfviType": "AzureArcKubernetes", + "roleOverrideValues": [ + '{"name":"testRoleOne","deployParametersMappingRuleProfile":{"helmMappingRuleProfile":{"helmPackageVersion":"2.1.3","values":"{\\"roleOneParam\\":\\"roleOneOverrideValue\\"}"}}}', + '{"name":"testRoleTwo","deployParametersMappingRuleProfile":{"helmMappingRuleProfile":{"releaseName":"overrideReleaseName","releaseNamespace":"overrideNamespace","values":"{\\"roleTwoParam\\":\\"roleTwoOverrideValue\\"}"}}}', + ], + "secretDeploymentValues": '{"adminPassword":"password1","userPassword":"password2"}', + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionCreateSecret.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_create.py new file mode 100644 index 000000000000..dbaec97eafd5 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_group_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_groups.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + parameters={"location": "eastus"}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_stop.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_delete.py similarity index 77% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_stop.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_delete.py index b1d3fd9ac4bf..10ff9f324bba 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_stop.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python role_instance_stop.py + python network_function_definition_group_delete.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, @@ -29,15 +29,13 @@ def main(): subscription_id="subid", ) - response = client.role_instances.begin_stop( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", - role_instance_name="mrm", + client.network_function_definition_groups.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/RoleInstanceStop.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_get.py new file mode 100644 index 000000000000..24c5c6b4402b --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_group_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_groups.get( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_update_tags.py new file mode 100644 index 000000000000..773f35f86546 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_group_update_tags.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_group_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_groups.update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_groups_list_by_publisher_name.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_groups_list_by_publisher_name.py new file mode 100644 index 000000000000..0661f4e9d5cf --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_groups_list_by_publisher_name.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_groups_list_by_publisher_name.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_groups.list_by_publisher( + resource_group_name="rg", + publisher_name="TestPublisher", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupsListByPublisherName.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_create.py new file mode 100644 index 000000000000..bd372bf769ef --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_create.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_version_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + parameters={ + "location": "eastus", + "properties": { + "deployParameters": '{"type":"object","properties":{"releaseName":{"type":"string"},"namespace":{"type":"string"}}}', + "networkFunctionTemplate": { + "networkFunctionApplications": [ + { + "artifactProfile": { + "artifactStore": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/testArtifactStore" + }, + "helmArtifactProfile": { + "helmPackageName": "fed-rbac", + "helmPackageVersionRange": "~2.1.3", + "imagePullSecretsValuesPaths": ["global.imagePullSecrets"], + "registryValuesPaths": ["global.registry.docker.repoPath"], + }, + }, + "artifactType": "HelmPackage", + "dependsOnProfile": { + "installDependsOn": [], + "uninstallDependsOn": [], + "updateDependsOn": [], + }, + "deployParametersMappingRuleProfile": { + "applicationEnablement": "Enabled", + "helmMappingRuleProfile": { + "helmPackageVersion": "2.1.3", + "options": { + "installOptions": {"atomic": "true", "timeout": "30", "wait": "waitValue"}, + "upgradeOptions": {"atomic": "true", "timeout": "30", "wait": "waitValue"}, + }, + "releaseName": "{deployParameters.releaseName}", + "releaseNamespace": "{deployParameters.namesapce}", + "values": "", + }, + }, + "name": "fedrbac", + } + ], + "nfviType": "AzureArcKubernetes", + }, + "networkFunctionType": "ContainerizedNetworkFunction", + "versionState": "Active", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_delete.py new file mode 100644 index 000000000000..8fc0bb0288bf --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_version_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.network_function_definition_versions.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_get.py new file mode 100644 index 000000000000..93949563c50e --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_version_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.get( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_list_by_network_function_definition_group.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_list_by_network_function_definition_group.py new file mode 100644 index 000000000000..cbd423378cd9 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_list_by_network_function_definition_group.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_version_list_by_network_function_definition_group.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.list_by_network_function_definition_group( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupNameName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionListByNetworkFunctionDefinitionGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_state.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_state.py new file mode 100644 index 000000000000..17c840769586 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_state.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_version_update_state.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.begin_update_state( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestSkuGroup", + network_function_definition_version_name="1.0.0", + parameters={"versionState": "Active"}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionUpdateState.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_tags.py new file mode 100644 index 000000000000..4834ba8813e2 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_definition_version_update_tags.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_definition_version_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_function_definition_versions.update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_function_definition_group_name="TestNetworkFunctionDefinitionGroupName", + network_function_definition_version_name="1.0.0", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_delete.py index 1bb62561007c..ad739eaf76be 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_delete.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.network_functions.begin_delete( + client.network_functions.begin_delete( resource_group_name="rg", network_function_name="testNf", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionDelete.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_first_party_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_first_party_create.py new file mode 100644 index 000000000000..3ede6f9c102e --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_first_party_create.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_function_first_party_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_functions.begin_create_or_update( + resource_group_name="rg", + network_function_name="testNf", + parameters={ + "location": "eastus", + "properties": { + "allowSoftwareUpdate": False, + "configurationType": "Open", + "deploymentValues": '{"releaseName":"testReleaseName","namespace":"testNamespace"}', + "networkFunctionDefinitionVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1", + "idType": "Secret", + }, + "nfviId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation", + "nfviType": "AzureArcKubernetes", + "roleOverrideValues": [ + '{"name":"testRoleOne","deployParametersMappingRuleProfile":{"helmMappingRuleProfile":{"helmPackageVersion":"2.1.3","values":"{\\"roleOneParam\\":\\"roleOneOverrideValue\\"}"}}}', + '{"name":"testRoleTwo","deployParametersMappingRuleProfile":{"helmMappingRuleProfile":{"releaseName":"overrideReleaseName","releaseNamespace":"overrideNamespace","values":"{\\"roleTwoParam\\":\\"roleTwoOverrideValue\\"}"}}}', + ], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionFirstPartyCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_get.py index 21f8aae18efb..d897934c0270 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_resource_group.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_resource_group.py index e5d6d7a51cd2..74866c398686 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_resource_group.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionListByResourceGroup.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_subscription.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_subscription.py index e3685cc13634..7148b32b81a3 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_subscription.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionListBySubscription.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_update_tags.py index ad53a9e31bf6..7b54bf1028bc 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_update_tags.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionUpdateTags.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_vendor_and_sku_list_by_subscription.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_vendor_and_sku_list_by_subscription.py deleted file mode 100644 index 918ebec639e3..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_function_vendor_and_sku_list_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridnetwork import HybridNetworkManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridnetwork -# USAGE - python network_function_vendor_and_sku_list_by_subscription.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 = HybridNetworkManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.network_function_vendors.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionVendorAndSkuListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_functions_execute_request.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_functions_execute_request.py index 1754cb636df5..4b5427277fcb 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_functions_execute_request.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_functions_execute_request.py @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.network_functions.begin_execute_request( + client.network_functions.begin_execute_request( resource_group_name="rg", network_function_name="testNetworkfunction", parameters={ @@ -42,9 +42,8 @@ def main(): "serviceEndpoint": "serviceEndpoint", }, ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/NetworkFunctionsExecuteRequest.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionsExecuteRequest.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_create.py new file mode 100644 index 000000000000..c4967ed7be7d --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_create.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_group_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_groups.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + parameters={"location": "eastus"}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_start.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_delete.py similarity index 79% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_start.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_delete.py index c86adc108092..d648f0acb466 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_start.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python role_instance_start.py + python network_service_design_group_delete.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, @@ -29,15 +29,13 @@ def main(): subscription_id="subid", ) - response = client.role_instances.begin_start( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", - role_instance_name="mrm", + client.network_service_design_groups.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/RoleInstanceStart.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_get.py new file mode 100644 index 000000000000..30ff50236508 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_group_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_groups.get( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_update_tags.py new file mode 100644 index 000000000000..2dafc77e3e31 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_group_update_tags.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_group_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_groups.update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_list_by_vendor_network_function.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_groups_list_by_publisher_name.py similarity index 80% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_list_by_vendor_network_function.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_groups_list_by_publisher_name.py index f8d8fd633545..1ad95b9df55e 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/role_instance_list_by_vendor_network_function.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_groups_list_by_publisher_name.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python role_instance_list_by_vendor_network_function.py + python network_service_design_groups_list_by_publisher_name.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, @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.role_instances.list( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", + response = client.network_service_design_groups.list_by_publisher( + resource_group_name="rg", + publisher_name="TestPublisher", ) for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/RoleInstanceListByVendorNetworkFunction.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupsListByPublisherName.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_create.py new file mode 100644 index 000000000000..45fb997c458d --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_create.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_version_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_versions.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + network_service_design_version_name="1.0.0", + parameters={ + "location": "eastus", + "properties": { + "configurationGroupSchemaReferences": { + "MyVM_Configuration": { + "id": "/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/publishers/contosoGroup/networkServiceDesignGroups/NSD_contoso/configurationGroupSchemas/MyVM_Configuration_Schema" + } + }, + "resourceElementTemplates": [ + { + "configuration": { + "artifactProfile": { + "artifactName": "MyVMArmTemplate", + "artifactStoreReference": { + "id": "/subscriptions/subid/providers/Microsoft.HybridNetwork/publishers/contosoGroup/artifactStoreReference/store1" + }, + "artifactVersion": "1.0.0", + }, + "parameterValues": '{"publisherName":"{configurationparameters(\'MyVM_Configuration\').publisherName}","skuGroupName":"{configurationparameters(\'MyVM_Configuration\').skuGroupName}","skuVersion":"{configurationparameters(\'MyVM_Configuration\').skuVersion}","skuOfferingLocation":"{configurationparameters(\'MyVM_Configuration\').skuOfferingLocation}","nfviType":"{nfvis().nfvisFromSitePerNfviType.AzureCore.nfviAlias1.nfviType}","nfviId":"{nfvis().nfvisFromSitePerNfviType.AzureCore.nfviAlias1.nfviId}","allowSoftwareUpdates":"{configurationparameters(\'MyVM_Configuration\').allowSoftwareUpdates}","virtualNetworkName":"{configurationparameters(\'MyVM_Configuration\').vnetName}","subnetName":"{configurationparameters(\'MyVM_Configuration\').subnetName}","subnetAddressPrefix":"{configurationparameters(\'MyVM_Configuration\').subnetAddressPrefix}","managedResourceGroup":"{configurationparameters(\'SNSSelf\').managedResourceGroupName}","adminPassword":"{secretparameters(\'MyVM_Configuration\').adminPassword}"}', + "templateType": "ArmTemplate", + }, + "dependsOnProfile": {"installDependsOn": []}, + "name": "MyVM", + "type": "ArmResourceDefinition", + } + ], + "versionState": "Active", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_delete.py new file mode 100644 index 000000000000..f51a813fec9f --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_version_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.network_service_design_versions.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + network_service_design_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_get.py new file mode 100644 index 000000000000..f7a28f4d1367 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_get.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_version_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_versions.get( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + network_service_design_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_list_by_network_service_design_group.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_list_by_network_service_design_group.py new file mode 100644 index 000000000000..830d8c9a1970 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_list_by_network_service_design_group.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_version_list_by_network_service_design_group.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_versions.list_by_network_service_design_group( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionListByNetworkServiceDesignGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_state.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_state.py new file mode 100644 index 000000000000..0cc3e6fdab9f --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_state.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_version_update_state.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_versions.begin_update_state( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + network_service_design_version_name="1.0.0", + parameters={"versionState": "Active"}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionUpdateState.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_tags.py new file mode 100644 index 000000000000..b835f49d926a --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/network_service_design_version_update_tags.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python network_service_design_version_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.network_service_design_versions.update( + resource_group_name="rg", + publisher_name="TestPublisher", + network_service_design_group_name="TestNetworkServiceDesignGroupName", + network_service_design_version_name="1.0.0", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_create.py similarity index 84% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_create.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_create.py index 8c02978ec6d0..cf602f39c505 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_create.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_create.py + python publisher_create.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, @@ -29,12 +29,13 @@ def main(): subscription_id="subid", ) - response = client.vendors.begin_create_or_update( - vendor_name="TestVendor", + response = client.publishers.begin_create_or_update( + resource_group_name="rg", + publisher_name="TestPublisher", ).result() print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorCreate.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherCreate.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_delete.py similarity index 85% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_delete.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_delete.py index 64973c998e03..3934de50e234 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_delete.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_delete.py + python publisher_delete.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, @@ -29,12 +29,12 @@ def main(): subscription_id="subid", ) - response = client.vendors.begin_delete( - vendor_name="TestVendor", + client.publishers.begin_delete( + resource_group_name="rg", + publisher_name="TestPublisher", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorDelete.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_get.py similarity index 86% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_get.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_get.py index 196cabac108d..8d1d00328e63 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_sku_get.py + python publisher_get.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, @@ -29,13 +29,13 @@ def main(): subscription_id="subid", ) - response = client.vendor_skus.get( - vendor_name="TestVendor", - sku_name="TestSku", + response = client.publishers.get( + resource_group_name="rg", + publisher_name="TestPublisher", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_resource_group.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_resource_group.py new file mode 100644 index 000000000000..a61fb69a3bed --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_resource_group.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python publisher_list_by_resource_group.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.publishers.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_by_subscription.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_subscription.py similarity index 87% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_by_subscription.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_subscription.py index 5a13868436f2..752e95e80318 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_by_subscription.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_list_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_list_by_subscription.py + python publisher_list_by_subscription.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, @@ -29,11 +29,11 @@ def main(): subscription_id="subid", ) - response = client.devices.list_by_subscription() + response = client.publishers.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceListBySubscription.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_update_tags.py similarity index 85% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_get.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_update_tags.py index 29aa0735839d..612e17e0317e 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/publisher_update_tags.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_get.py + python publisher_update_tags.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, @@ -29,12 +29,13 @@ def main(): subscription_id="subid", ) - response = client.vendors.get( - vendor_name="TestVendor", + response = client.publishers.update( + resource_group_name="rg", + publisher_name="TestPublisher", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_change_state.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_change_state.py new file mode 100644 index 000000000000..e6b3bd596af6 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_change_state.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_change_state.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proxy_artifact.begin_update_state( + resource_group_name="TestResourceGroup", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStoreName", + artifact_name="fedrbac", + artifact_version_name="1.0.0", + parameters={"properties": {"artifactState": "Deprecated"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactChangeState.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_get.py new file mode 100644 index 000000000000..a11bf7378c0c --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_get.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proxy_artifact.get( + resource_group_name="TestResourceGroup", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStoreName", + artifact_name="fedrbac", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactGet.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_list.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_list.py new file mode 100644 index 000000000000..fef321d1dad0 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/pure_proxy_artifact/artifact_list.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python artifact_list.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proxy_artifact.list( + resource_group_name="TestResourceGroup", + publisher_name="TestPublisher", + artifact_store_name="TestArtifactStoreName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactList.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_create.py new file mode 100644 index 000000000000..84c82048ba0a --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_create.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python site_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sites.begin_create_or_update( + resource_group_name="rg1", + site_name="testSite", + parameters={ + "location": "westUs2", + "properties": { + "nfvis": [ + {"location": "westUs2", "name": "nfvi1", "nfviType": "AzureCore"}, + { + "customLocationReference": { + "id": "/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation1" + }, + "name": "nfvi2", + "nfviType": "AzureArcKubernetes", + }, + { + "customLocationReference": { + "id": "/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation2" + }, + "name": "nfvi3", + "nfviType": "AzureOperatorNexus", + }, + ] + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_delete.py similarity index 86% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_delete.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_delete.py index d6cd79dc9c2d..90b68aa735c2 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_delete.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_delete.py + python site_delete.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, @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.devices.begin_delete( + client.sites.begin_delete( resource_group_name="rg1", - device_name="TestDevice", + site_name="testSite", ).result() - print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceDelete.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteDelete.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_get.py similarity index 88% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_get.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_get.py index d0027846ed1f..ace32a272bbd 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_get.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_get.py + python site_get.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, @@ -29,13 +29,13 @@ def main(): subscription_id="subid", ) - response = client.devices.get( + response = client.sites.get( resource_group_name="rg1", - device_name="TestDevice", + site_name="testSite", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceGet.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_by_resource_group.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_list_by_resource_group.py similarity index 87% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_by_resource_group.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_list_by_resource_group.py index c67d57a66034..2423f44a38b2 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_by_resource_group.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_list_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_list_by_resource_group.py + python site_list_by_resource_group.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, @@ -29,13 +29,13 @@ def main(): subscription_id="subid", ) - response = client.devices.list_by_resource_group( + response = client.sites.list_by_resource_group( resource_group_name="rg1", ) for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceListByResourceGroup.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_list_by_subscription.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_list_by_subscription.py similarity index 87% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_list_by_subscription.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_list_by_subscription.py index f77201128616..b6b3a0d7881b 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_list_by_subscription.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_list_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_list_by_subscription.py + python site_list_by_subscription.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, @@ -29,11 +29,11 @@ def main(): subscription_id="subid", ) - response = client.vendors.list_by_subscription() + response = client.sites.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorListBySubscription.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_create.py new file mode 100644 index 000000000000..96e5bf625144 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_create.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python site_network_service_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.site_network_services.begin_create_or_update( + resource_group_name="rg1", + site_network_service_name="testSiteNetworkServiceName", + parameters={ + "location": "westUs2", + "properties": { + "desiredStateConfigurationGroupValueReferences": { + "MyVM_Configuration": { + "id": "/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/configurationgroupvalues/MyVM_Configuration1" + } + }, + "networkServiceDesignVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/TestPublisher/networkServiceDesignGroups/TestNetworkServiceDesignGroupName/networkServiceDesignVersions/1.0.0", + "idType": "Open", + }, + "siteReference": { + "id": "/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/sites/testSite" + }, + }, + "sku": {"name": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_delete.py new file mode 100644 index 000000000000..b5b49cde4bca --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_delete.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python site_network_service_delete.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.site_network_services.begin_delete( + resource_group_name="rg1", + site_network_service_name="testSiteNetworkServiceName", + ).result() + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_first_party_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_first_party_create.py new file mode 100644 index 000000000000..3be995a0f368 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_first_party_create.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python site_network_service_first_party_create.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.site_network_services.begin_create_or_update( + resource_group_name="rg1", + site_network_service_name="testSiteNetworkServiceName", + parameters={ + "location": "westUs2", + "properties": { + "desiredStateConfigurationGroupValueReferences": { + "MyVM_Configuration": { + "id": "/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/configurationgroupvalues/MyVM_Configuration1" + } + }, + "networkServiceDesignVersionResourceReference": { + "id": "/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/TestPublisher/networkServiceDesignGroups/TestNetworkServiceDesignGroupName/networkServiceDesignVersions/1.0.0", + "idType": "Secret", + }, + "siteReference": { + "id": "/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/sites/testSite" + }, + }, + "sku": {"name": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceFirstPartyCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_registration_key.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_get.py similarity index 85% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_registration_key.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_get.py index 874e6e944d4e..ae740a34fc20 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_list_registration_key.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_list_registration_key.py + python site_network_service_get.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, @@ -29,13 +29,13 @@ def main(): subscription_id="subid", ) - response = client.devices.list_registration_key( + response = client.site_network_services.get( resource_group_name="rg1", - device_name="TestDevice", + site_network_service_name="testSiteNetworkServiceName", ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceListRegistrationKey.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_list_by_vendor.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_list_by_resource_group.py similarity index 83% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_list_by_vendor.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_list_by_resource_group.py index 64d788e64428..44b793fe8205 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_list_by_vendor.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_list_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_nf_list_by_vendor.py + python site_network_service_list_by_resource_group.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, @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.vendor_network_functions.list( - location_name="eastus", - vendor_name="testVendor", + response = client.site_network_services.list_by_resource_group( + resource_group_name="rg1", ) for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorNfListByVendor.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_list_by_vendor.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_list_by_subscription.py similarity index 85% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_list_by_vendor.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_list_by_subscription.py index 7daaa855884c..b471d3df650a 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_list_by_vendor.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_list_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python vendor_sku_list_by_vendor.py + python site_network_service_list_by_subscription.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, @@ -29,13 +29,11 @@ def main(): subscription_id="subid", ) - response = client.vendor_skus.list( - vendor_name="TestVendor", - ) + response = client.site_network_services.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuListByVendor.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_update_tags.py new file mode 100644 index 000000000000..9bc1931131d1 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_network_service_update_tags.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.hybridnetwork import HybridNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridnetwork +# USAGE + python site_network_service_update_tags.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 = HybridNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.site_network_services.update_tags( + resource_group_name="rg1", + site_network_service_name="testSiteNetworkServiceName", + parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceUpdateTags.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_update_tags.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_update_tags.py similarity index 87% rename from sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_update_tags.py rename to sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_update_tags.py index 56f2269ac0d2..aea9e55dfe4c 100644 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/device_update_tags.py +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/site_update_tags.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridnetwork # USAGE - python device_update_tags.py + python site_update_tags.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, @@ -29,14 +29,14 @@ def main(): subscription_id="subid", ) - response = client.devices.update_tags( + response = client.sites.update_tags( resource_group_name="rg1", - device_name="TestDevice", + site_name="testSite", parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, ) print(response) -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/DeviceUpdateTags.json +# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_create.py deleted file mode 100644 index e51f7f5e0347..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_nf_create.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridnetwork import HybridNetworkManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridnetwork -# USAGE - python vendor_nf_create.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 = HybridNetworkManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.vendor_network_functions.begin_create_or_update( - location_name="eastus", - vendor_name="testVendor", - service_key="testServiceKey", - parameters={ - "properties": { - "networkFunctionVendorConfigurations": [ - { - "networkInterfaces": [ - { - "ipConfigurations": [ - { - "dnsServers": None, - "gateway": "", - "ipAddress": "", - "ipAllocationMethod": "Dynamic", - "ipVersion": "IPv4", - "subnet": "", - } - ], - "macAddress": "", - "networkInterfaceName": "nic1", - "vmSwitchType": "Management", - }, - { - "ipConfigurations": [ - { - "dnsServers": None, - "gateway": "", - "ipAddress": "", - "ipAllocationMethod": "Dynamic", - "ipVersion": "IPv4", - "subnet": "", - } - ], - "macAddress": "DC-97-F8-79-16-7D", - "networkInterfaceName": "nic2", - "vmSwitchType": "Wan", - }, - ], - "osProfile": { - "adminUsername": "dummyuser", - "customData": "base-64 encoded string of custom data", - "linuxConfiguration": { - "ssh": { - "publicKeys": [ - { - "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAwrr66r8n6B8Y0zMF3dOpXEapIQD9DiYQ6D6/zwor9o39jSkHNiMMER/GETBbzP83LOcekm02aRjo55ArO7gPPVvCXbrirJu9pkm4AC4BBre5xSLS= user@constoso-DSH", - "path": "home/user/.ssh/authorized_keys", - } - ] - } - }, - }, - "roleName": "testRole", - "userDataParameters": {}, - } - ], - "skuType": "SDWAN", - "vendorProvisioningState": "Provisioning", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorNfCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_create.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_create.py deleted file mode 100644 index 9211fdff009a..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_create.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridnetwork import HybridNetworkManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridnetwork -# USAGE - python vendor_sku_create.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 = HybridNetworkManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.vendor_skus.begin_create_or_update( - vendor_name="TestVendor", - sku_name="TestSku", - parameters={ - "properties": { - "deploymentMode": "PrivateEdgeZone", - "managedApplicationTemplate": {}, - "networkFunctionTemplate": { - "networkFunctionRoleConfigurations": [ - { - "customProfile": {"metadataConfigurationPath": "/var/logs/network.cfg"}, - "networkInterfaces": [ - { - "ipConfigurations": [ - { - "dnsServers": None, - "gateway": "", - "ipAddress": "", - "ipAllocationMethod": "Dynamic", - "ipVersion": "IPv4", - "subnet": "", - } - ], - "macAddress": "", - "networkInterfaceName": "nic1", - "vmSwitchType": "Wan", - }, - { - "ipConfigurations": [ - { - "dnsServers": None, - "gateway": "", - "ipAddress": "", - "ipAllocationMethod": "Dynamic", - "ipVersion": "IPv4", - "subnet": "", - } - ], - "macAddress": "", - "networkInterfaceName": "nic2", - "vmSwitchType": "Management", - }, - ], - "osProfile": { - "adminUsername": "dummyuser", - "customData": "base-64 encoded string of custom data", - "linuxConfiguration": { - "ssh": { - "publicKeys": [ - { - "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAwrr66r8n6B8Y0zMF3dOpXEapIQD9DiYQ6D6/zwor9o39jSkHNiMMER/GETBbzP83LOcekm02aRjo55ArO7gPPVvCXbrirJu9pkm4AC4BBre5xSLS= user@constoso-DSH", - "path": "home/user/.ssh/authorized_keys", - } - ] - } - }, - }, - "roleName": "test", - "roleType": "VirtualMachine", - "storageProfile": { - "dataDisks": [{"createOption": "Empty", "diskSizeGB": 10, "name": "DataDisk1"}], - "imageReference": { - "offer": "UbuntuServer", - "publisher": "Canonical", - "sku": "18.04-LTS", - "version": "18.04.201804262", - }, - "osDisk": { - "diskSizeGB": 30, - "name": "vhdName", - "osType": "Linux", - "vhd": { - "uri": "https://contoso.net/link/vnd.vhd?sp=rl&st=2020-10-08T20:38:19Z&se=2020-12-09T19:38:00Z&sv=2019-12-12&sr=b&sig=7BM2f4yOw%3D" - }, - }, - }, - "virtualMachineSize": "Standard_D3_v2", - } - ] - }, - "networkFunctionType": "VirtualNetworkFunction", - "preview": True, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_delete.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_delete.py deleted file mode 100644 index ef26bf2024f6..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridnetwork import HybridNetworkManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridnetwork -# USAGE - python vendor_sku_preview_delete.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 = HybridNetworkManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.vendor_sku_preview.begin_delete( - vendor_name="TestVendor", - sku_name="TestSku", - preview_subscription="previewSub", - ).result() - print(response) - - -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuPreviewDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_get.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_get.py deleted file mode 100644 index b0c2b0070f27..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridnetwork import HybridNetworkManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridnetwork -# USAGE - python vendor_sku_preview_get.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 = HybridNetworkManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.vendor_sku_preview.get( - vendor_name="TestVendor", - sku_name="TestSku", - preview_subscription="previewSub", - ) - print(response) - - -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuPreviewGet.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_list_by_sku.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_list_by_sku.py deleted file mode 100644 index 6f2e6dd8a1e4..000000000000 --- a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/generated_samples/vendor_sku_preview_list_by_sku.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridnetwork import HybridNetworkManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridnetwork -# USAGE - python vendor_sku_preview_list_by_sku.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 = HybridNetworkManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.vendor_sku_preview.list( - vendor_name="TestVendor", - sku_name="TestSku", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/preview/2022-01-01-preview/examples/VendorSkuPreviewListBySku.json -if __name__ == "__main__": - main()