From c36558d1f68a9b36ae40a39c28a7a2454bdd316e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 19 Mar 2025 09:05:52 +0000 Subject: [PATCH] CodeGen from PR 33308 in Azure/azure-rest-api-specs Merge 8619cf9e5b0987929a8190ba50f529a1c4661afc into 7a5a8d753713d3db02d262128749427e98289887 --- sdk/eventgrid/azure-mgmt-eventgrid/_meta.json | 8 +- .../azure/mgmt/eventgrid/__init__.py | 12 +- .../azure/mgmt/eventgrid/_configuration.py | 9 +- .../_event_grid_management_client.py | 54 +- .../azure/mgmt/eventgrid/_patch.py | 1 + .../azure/mgmt/eventgrid/_serialization.py | 438 +++-- .../azure/mgmt/eventgrid/_vendor.py | 16 - .../azure/mgmt/eventgrid/_version.py | 2 +- .../azure/mgmt/eventgrid/aio/__init__.py | 12 +- .../mgmt/eventgrid/aio/_configuration.py | 9 +- .../aio/_event_grid_management_client.py | 55 +- .../azure/mgmt/eventgrid/aio/_patch.py | 1 + .../mgmt/eventgrid/aio/operations/__init__.py | 78 +- .../operations/_ca_certificates_operations.py | 71 +- .../aio/operations/_channels_operations.py | 71 +- .../operations/_client_groups_operations.py | 71 +- .../aio/operations/_clients_operations.py | 71 +- .../_domain_event_subscriptions_operations.py | 100 +- ...in_topic_event_subscriptions_operations.py | 226 +-- .../operations/_domain_topics_operations.py | 67 +- .../aio/operations/_domains_operations.py | 103 +- .../_event_subscriptions_operations.py | 267 +-- .../_extension_topics_operations.py | 16 +- ...ce_topic_event_subscriptions_operations.py | 103 +- .../_namespace_topics_operations.py | 122 +- .../aio/operations/_namespaces_operations.py | 149 +- ...ity_perimeter_configurations_operations.py | 384 ---- .../eventgrid/aio/operations/_operations.py | 14 +- .../_partner_configurations_operations.py | 109 +- .../_partner_destinations_operations.py | 898 --------- .../_partner_namespaces_operations.py | 103 +- .../_partner_registrations_operations.py | 101 +- ...er_topic_event_subscriptions_operations.py | 100 +- .../operations/_partner_topics_operations.py | 76 +- .../_permission_bindings_operations.py | 71 +- ...private_endpoint_connections_operations.py | 107 +- .../_private_link_resources_operations.py | 27 +- ...em_topic_event_subscriptions_operations.py | 216 ++- .../operations/_system_topics_operations.py | 98 +- .../_topic_event_subscriptions_operations.py | 100 +- .../operations/_topic_spaces_operations.py | 71 +- .../aio/operations/_topic_types_operations.py | 23 +- .../aio/operations/_topics_operations.py | 125 +- .../_verified_partners_operations.py | 19 +- .../azure/mgmt/eventgrid/models/__init__.py | 557 +++--- .../_event_grid_management_client_enums.py | 121 -- .../mgmt/eventgrid/models/_models_py3.py | 1662 ++--------------- .../mgmt/eventgrid/operations/__init__.py | 78 +- .../operations/_ca_certificates_operations.py | 79 +- .../operations/_channels_operations.py | 81 +- .../operations/_client_groups_operations.py | 79 +- .../operations/_clients_operations.py | 79 +- .../_domain_event_subscriptions_operations.py | 115 +- ...in_topic_event_subscriptions_operations.py | 315 ++-- .../operations/_domain_topics_operations.py | 75 +- .../operations/_domains_operations.py | 119 +- .../_event_subscriptions_operations.py | 353 ++-- .../_extension_topics_operations.py | 18 +- ...ce_topic_event_subscriptions_operations.py | 118 +- .../_namespace_topics_operations.py | 136 +- .../operations/_namespaces_operations.py | 167 +- ...ity_perimeter_configurations_operations.py | 504 ----- .../mgmt/eventgrid/operations/_operations.py | 16 +- .../_partner_configurations_operations.py | 125 +- .../_partner_destinations_operations.py | 1151 ------------ .../_partner_namespaces_operations.py | 119 +- .../_partner_registrations_operations.py | 114 +- ...er_topic_event_subscriptions_operations.py | 115 +- .../operations/_partner_topics_operations.py | 93 +- .../_permission_bindings_operations.py | 79 +- ...private_endpoint_connections_operations.py | 115 +- .../_private_link_resources_operations.py | 31 +- ...em_topic_event_subscriptions_operations.py | 293 +-- .../operations/_system_topics_operations.py | 111 +- .../_topic_event_subscriptions_operations.py | 115 +- .../operations/_topic_spaces_operations.py | 79 +- .../operations/_topic_types_operations.py | 29 +- .../operations/_topics_operations.py | 143 +- .../_verified_partners_operations.py | 23 +- .../ca_certificates_create_or_update.py | 4 +- .../ca_certificates_delete.py | 2 +- .../generated_samples/ca_certificates_get.py | 2 +- .../ca_certificates_list_by_namespace.py | 2 +- .../channels_create_or_update.py | 8 +- .../generated_samples/channels_delete.py | 4 +- .../generated_samples/channels_get.py | 4 +- .../channels_get_full_url.py | 4 +- .../channels_list_by_partner_namespace.py | 4 +- .../generated_samples/channels_update.py | 6 +- .../client_groups_create_or_update.py | 4 +- .../generated_samples/client_groups_delete.py | 2 +- .../generated_samples/client_groups_get.py | 2 +- .../client_groups_list_by_namespace.py | 2 +- .../clients_create_or_update.py | 4 +- .../generated_samples/clients_delete.py | 2 +- .../generated_samples/clients_get.py | 2 +- .../clients_list_by_namespace.py | 2 +- ...in_event_subscriptions_create_or_update.py | 6 +- .../domain_event_subscriptions_delete.py | 4 +- .../domain_event_subscriptions_get.py | 4 +- ...t_subscriptions_get_delivery_attributes.py | 4 +- ...domain_event_subscriptions_get_full_url.py | 4 +- .../domain_event_subscriptions_list.py | 4 +- .../domain_event_subscriptions_update.py | 6 +- ...ic_event_subscriptions_create_or_update.py | 6 +- ...domain_topic_event_subscriptions_delete.py | 4 +- .../domain_topic_event_subscriptions_get.py | 4 +- ...t_subscriptions_get_delivery_attributes.py | 4 +- ..._topic_event_subscriptions_get_full_url.py | 4 +- .../domain_topic_event_subscriptions_list.py | 4 +- ...domain_topic_event_subscriptions_update.py | 6 +- .../domain_topics_create_or_update.py | 4 +- .../generated_samples/domain_topics_delete.py | 4 +- .../generated_samples/domain_topics_get.py | 4 +- .../domain_topics_list_by_domain.py | 4 +- .../domains_create_or_update.py | 6 +- .../generated_samples/domains_delete.py | 4 +- .../generated_samples/domains_get.py | 4 +- .../domains_list_by_resource_group.py | 4 +- .../domains_list_by_subscription.py | 4 +- .../domains_list_shared_access_keys.py | 4 +- .../domains_regenerate_key.py | 6 +- .../generated_samples/domains_update.py | 6 +- ...tions_create_or_update_for_custom_topic.py | 6 +- ...custom_topic_azure_function_destination.py | 6 +- ..._for_custom_topic_event_hub_destination.py | 6 +- ...tom_topic_hybrid_connection_destination.py | 6 +- ...tom_topic_service_bus_queue_destination.py | 6 +- ...tom_topic_service_bus_topic_destination.py | 6 +- ..._custom_topic_storage_queue_destination.py | 7 +- ...te_for_custom_topic_webhook_destination.py | 10 +- ...criptions_create_or_update_for_resource.py | 6 +- ...ons_create_or_update_for_resource_group.py | 6 +- ...tions_create_or_update_for_subscription.py | 6 +- ...t_subscriptions_delete_for_custom_topic.py | 4 +- ...event_subscriptions_delete_for_resource.py | 4 +- ...subscriptions_delete_for_resource_group.py | 4 +- ...t_subscriptions_delete_for_subscription.py | 4 +- ...t_subscriptions_get_delivery_attributes.py | 6 +- ...vent_subscriptions_get_for_custom_topic.py | 4 +- ...custom_topic_azure_function_destination.py | 4 +- ..._for_custom_topic_event_hub_destination.py | 4 +- ...tom_topic_hybrid_connection_destination.py | 4 +- ...tom_topic_service_bus_queue_destination.py | 4 +- ...tom_topic_service_bus_topic_destination.py | 4 +- ..._custom_topic_storage_queue_destination.py | 4 +- ...et_for_custom_topic_webhook_destination.py | 4 +- .../event_subscriptions_get_for_resource.py | 4 +- ...nt_subscriptions_get_for_resource_group.py | 4 +- ...vent_subscriptions_get_for_subscription.py | 4 +- ...criptions_get_full_url_for_custom_topic.py | 4 +- ...subscriptions_get_full_url_for_resource.py | 4 +- ...iptions_get_full_url_for_resource_group.py | 4 +- ...criptions_get_full_url_for_subscription.py | 4 +- ...vent_subscriptions_list_by_domain_topic.py | 4 +- .../event_subscriptions_list_by_resource.py | 4 +- ...criptions_list_global_by_resource_group.py | 4 +- ...global_by_resource_group_for_topic_type.py | 4 +- ...bscriptions_list_global_by_subscription.py | 4 +- ...t_global_by_subscription_for_topic_type.py | 4 +- ...iptions_list_regional_by_resource_group.py | 4 +- ...gional_by_resource_group_for_topic_type.py | 4 +- ...criptions_list_regional_by_subscription.py | 4 +- ...regional_by_subscription_for_topic_type.py | 4 +- ...t_subscriptions_update_for_custom_topic.py | 6 +- ...custom_topic_azure_function_destination.py | 6 +- ..._for_custom_topic_event_hub_destination.py | 6 +- ...tom_topic_hybrid_connection_destination.py | 6 +- ...tom_topic_service_bus_queue_destination.py | 6 +- ...tom_topic_service_bus_topic_destination.py | 6 +- ..._custom_topic_storage_queue_destination.py | 6 +- ...te_for_custom_topic_webhook_destination.py | 6 +- ...event_subscriptions_update_for_resource.py | 6 +- ...subscriptions_update_for_resource_group.py | 6 +- ...t_subscriptions_update_for_subscription.py | 6 +- .../generated_samples/extension_topics_get.py | 6 +- ...ic_event_subscriptions_create_or_update.py | 4 +- ...espace_topic_event_subscriptions_delete.py | 2 +- ...namespace_topic_event_subscriptions_get.py | 2 +- ...t_subscriptions_get_delivery_attributes.py | 2 +- ..._topic_event_subscriptions_get_full_url.py | 2 +- ...t_subscriptions_list_by_namespace_topic.py | 2 +- ...espace_topic_event_subscriptions_update.py | 4 +- .../namespace_topics_create_or_update.py | 4 +- .../namespace_topics_delete.py | 2 +- .../generated_samples/namespace_topics_get.py | 2 +- .../namespace_topics_list_by_namespace.py | 2 +- ...amespace_topics_list_shared_access_keys.py | 2 +- .../namespace_topics_regenerate_key.py | 4 +- .../namespace_topics_update.py | 4 +- .../namespaces_create_or_update.py | 4 +- .../generated_samples/namespaces_delete.py | 2 +- .../generated_samples/namespaces_get.py | 2 +- .../namespaces_list_by_resource_group.py | 2 +- .../namespaces_list_by_subscription.py | 2 +- .../namespaces_list_shared_access_keys.py | 2 +- .../namespaces_regenerate_key.py | 4 +- .../generated_samples/namespaces_update.py | 4 +- ...spaces_validate_custom_domain_ownership.py | 2 +- ...k_security_perimeter_configurations_get.py | 50 - ..._security_perimeter_configurations_list.py | 49 - ...rity_perimeter_configurations_reconcile.py | 50 - .../generated_samples/operations_list.py | 2 +- ...artner_configurations_authorize_partner.py | 6 +- ...partner_configurations_create_or_update.py | 6 +- .../partner_configurations_delete.py | 4 +- .../partner_configurations_get.py | 4 +- ...r_configurations_list_by_resource_group.py | 4 +- ...ner_configurations_list_by_subscription.py | 4 +- ...tner_configurations_unauthorize_partner.py | 6 +- .../partner_configurations_update.py | 6 +- .../partner_destinations_activate.py | 42 - .../partner_destinations_create_or_update.py | 54 - .../partner_destinations_delete.py | 41 - .../partner_destinations_get.py | 42 - ...ner_destinations_list_by_resource_group.py | 42 - ...rtner_destinations_list_by_subscription.py | 40 - .../partner_destinations_update.py | 45 - .../partner_namespaces_create_or_update.py | 8 +- .../partner_namespaces_delete.py | 4 +- .../partner_namespaces_get.py | 4 +- ...rtner_namespaces_list_by_resource_group.py | 4 +- ...partner_namespaces_list_by_subscription.py | 4 +- ...tner_namespaces_list_shared_access_keys.py | 4 +- .../partner_namespaces_regenerate_key.py | 6 +- .../partner_namespaces_update.py | 6 +- .../partner_registrations_create_or_update.py | 6 +- .../partner_registrations_delete.py | 4 +- .../partner_registrations_get.py | 4 +- ...er_registrations_list_by_resource_group.py | 4 +- ...tner_registrations_list_by_subscription.py | 4 +- .../partner_registrations_update.py | 8 +- ...ic_event_subscriptions_create_or_update.py | 6 +- ...artner_topic_event_subscriptions_delete.py | 4 +- .../partner_topic_event_subscriptions_get.py | 4 +- ...t_subscriptions_get_delivery_attributes.py | 4 +- ..._topic_event_subscriptions_get_full_url.py | 4 +- ...ent_subscriptions_list_by_partner_topic.py | 4 +- ...artner_topic_event_subscriptions_update.py | 6 +- .../partner_topics_activate.py | 4 +- .../partner_topics_create_or_update.py | 6 +- .../partner_topics_deactivate.py | 4 +- .../partner_topics_delete.py | 4 +- .../generated_samples/partner_topics_get.py | 4 +- .../partner_topics_list_by_resource_group.py | 4 +- .../partner_topics_list_by_subscription.py | 4 +- .../partner_topics_update.py | 6 +- .../permission_bindings_create_or_update.py | 4 +- .../permission_bindings_delete.py | 2 +- .../permission_bindings_get.py | 2 +- .../permission_bindings_list_by_namespace.py | 2 +- .../private_endpoint_connections_delete.py | 9 +- .../private_endpoint_connections_get.py | 9 +- ...e_endpoint_connections_list_by_resource.py | 9 +- .../private_endpoint_connections_update.py | 9 +- .../private_link_resources_get.py | 4 +- ...private_link_resources_list_by_resource.py | 4 +- ...ic_event_subscriptions_create_or_update.py | 6 +- ...system_topic_event_subscriptions_delete.py | 4 +- .../system_topic_event_subscriptions_get.py | 4 +- ...t_subscriptions_get_delivery_attributes.py | 4 +- ..._topic_event_subscriptions_get_full_url.py | 4 +- ...vent_subscriptions_list_by_system_topic.py | 4 +- ...system_topic_event_subscriptions_update.py | 6 +- .../system_topics_create_or_update.py | 8 +- .../generated_samples/system_topics_delete.py | 4 +- .../generated_samples/system_topics_get.py | 4 +- .../system_topics_list_by_resource_group.py | 4 +- .../system_topics_list_by_subscription.py | 4 +- .../generated_samples/system_topics_update.py | 6 +- ...ic_event_subscriptions_create_or_update.py | 6 +- .../topic_event_subscriptions_delete.py | 8 +- .../topic_event_subscriptions_get.py | 4 +- ...t_subscriptions_get_delivery_attributes.py | 4 +- .../topic_event_subscriptions_get_full_url.py | 4 +- .../topic_event_subscriptions_list.py | 4 +- .../topic_event_subscriptions_update.py | 6 +- .../topic_spaces_create_or_update.py | 4 +- .../generated_samples/topic_spaces_delete.py | 2 +- .../generated_samples/topic_spaces_get.py | 2 +- .../topic_spaces_list_by_namespace.py | 2 +- .../generated_samples/topic_types_get.py | 2 +- .../generated_samples/topic_types_list.py | 2 +- .../topic_types_list_event_types.py | 2 +- .../topics_create_or_update.py | 6 +- .../topics_create_or_update_for_azure_arc.py | 54 - .../generated_samples/topics_delete.py | 8 +- .../generated_samples/topics_get.py | 4 +- .../topics_list_by_resource_group.py | 4 +- .../topics_list_by_subscription.py | 4 +- .../topics_list_event_types.py | 4 +- .../topics_list_shared_access_keys.py | 4 +- .../topics_regenerate_key.py | 6 +- .../generated_samples/topics_update.py | 6 +- .../verified_partners_get.py | 2 +- .../verified_partners_list.py | 2 +- .../generated_tests/conftest.py | 37 + ...d_management_ca_certificates_operations.py | 88 + ...gement_ca_certificates_operations_async.py | 93 + ...ent_grid_management_channels_operations.py | 147 ++ ...id_management_channels_operations_async.py | 150 ++ ...rid_management_client_groups_operations.py | 86 + ...nagement_client_groups_operations_async.py | 91 + ...vent_grid_management_clients_operations.py | 89 + ...rid_management_clients_operations_async.py | 94 + ...t_domain_event_subscriptions_operations.py | 170 ++ ...in_event_subscriptions_operations_async.py | 177 ++ ...in_topic_event_subscriptions_operations.py | 177 ++ ...ic_event_subscriptions_operations_async.py | 184 ++ ...rid_management_domain_topics_operations.py | 70 + ...nagement_domain_topics_operations_async.py | 75 + ...vent_grid_management_domains_operations.py | 199 ++ ...rid_management_domains_operations_async.py | 206 ++ ...nagement_event_subscriptions_operations.py | 271 +++ ...nt_event_subscriptions_operations_async.py | 278 +++ ..._management_extension_topics_operations.py | 30 + ...ement_extension_topics_operations_async.py | 31 + ...ce_topic_event_subscriptions_operations.py | 188 ++ ...ic_event_subscriptions_operations_async.py | 195 ++ ..._management_namespace_topics_operations.py | 128 ++ ...ement_namespace_topics_operations_async.py | 137 ++ ...t_grid_management_namespaces_operations.py | 247 +++ ..._management_namespaces_operations_async.py | 258 +++ .../test_event_grid_management_operations.py | 29 + ..._event_grid_management_operations_async.py | 30 + ...ement_partner_configurations_operations.py | 143 ++ ...partner_configurations_operations_async.py | 153 ++ ...anagement_partner_namespaces_operations.py | 158 ++ ...ent_partner_namespaces_operations_async.py | 165 ++ ...gement_partner_registrations_operations.py | 106 ++ ..._partner_registrations_operations_async.py | 113 ++ ...er_topic_event_subscriptions_operations.py | 170 ++ ...ic_event_subscriptions_operations_async.py | 177 ++ ...id_management_partner_topics_operations.py | 160 ++ ...agement_partner_topics_operations_async.py | 163 ++ ...nagement_permission_bindings_operations.py | 88 + ...nt_permission_bindings_operations_async.py | 93 + ...private_endpoint_connections_operations.py | 83 + ...e_endpoint_connections_operations_async.py | 92 + ...ement_private_link_resources_operations.py | 46 + ...private_link_resources_operations_async.py | 47 + ...em_topic_event_subscriptions_operations.py | 170 ++ ...ic_event_subscriptions_operations_async.py | 177 ++ ...rid_management_system_topics_operations.py | 122 ++ ...nagement_system_topics_operations_async.py | 129 ++ ...nt_topic_event_subscriptions_operations.py | 170 ++ ...ic_event_subscriptions_operations_async.py | 177 ++ ...grid_management_topic_spaces_operations.py | 86 + ...anagement_topic_spaces_operations_async.py | 91 + ..._grid_management_topic_types_operations.py | 51 + ...management_topic_types_operations_async.py | 52 + ...event_grid_management_topics_operations.py | 209 +++ ...grid_management_topics_operations_async.py | 218 +++ ...management_verified_partners_operations.py | 40 + ...ment_verified_partners_operations_async.py | 41 + sdk/eventgrid/azure-mgmt-eventgrid/setup.py | 1 + 356 files changed, 12218 insertions(+), 9021 deletions(-) delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.py diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json index 9726eeb3861e..7ea95b94cc06 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json +++ b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json @@ -1,11 +1,11 @@ { - "commit": "edbae6fb086224abd5b744edc7b833fec0909617", + "commit": "c1333718682f02f3395f2e01a48b551678a5b209", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.7", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/eventgrid/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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --generate-sample=True --generate-test=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.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/eventgrid/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py index bd25a9879ad1..753223bb7588 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._event_grid_management_client import EventGridManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._event_grid_management_client import EventGridManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "EventGridManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py index 979790446589..8a5baaf0f72f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for EventGridManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,13 +28,13 @@ class EventGridManagementClientConfiguration: # pylint: disable=too-many-instan :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-15". 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: - api_version: str = kwargs.pop("api_version", "2024-06-01-preview") + api_version: str = kwargs.pop("api_version", "2025-02-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py index dc71fdeb2bc2..b24f36f0ec74 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -31,10 +32,8 @@ NamespaceTopicEventSubscriptionsOperations, NamespaceTopicsOperations, NamespacesOperations, - NetworkSecurityPerimeterConfigurationsOperations, Operations, PartnerConfigurationsOperations, - PartnerDestinationsOperations, PartnerNamespacesOperations, PartnerRegistrationsOperations, PartnerTopicEventSubscriptionsOperations, @@ -52,11 +51,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class EventGridManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class EventGridManagementClient: # pylint: disable=too-many-instance-attributes """Azure EventGrid Management Client. :ivar ca_certificates: CaCertificatesOperations operations @@ -71,24 +69,24 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :vartype domains: azure.mgmt.eventgrid.operations.DomainsOperations :ivar domain_topics: DomainTopicsOperations operations :vartype domain_topics: azure.mgmt.eventgrid.operations.DomainTopicsOperations - :ivar domain_topic_event_subscriptions: DomainTopicEventSubscriptionsOperations operations - :vartype domain_topic_event_subscriptions: - azure.mgmt.eventgrid.operations.DomainTopicEventSubscriptionsOperations :ivar topic_event_subscriptions: TopicEventSubscriptionsOperations operations :vartype topic_event_subscriptions: azure.mgmt.eventgrid.operations.TopicEventSubscriptionsOperations :ivar domain_event_subscriptions: DomainEventSubscriptionsOperations operations :vartype domain_event_subscriptions: azure.mgmt.eventgrid.operations.DomainEventSubscriptionsOperations + :ivar namespace_topic_event_subscriptions: NamespaceTopicEventSubscriptionsOperations + operations + :vartype namespace_topic_event_subscriptions: + azure.mgmt.eventgrid.operations.NamespaceTopicEventSubscriptionsOperations :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.operations.EventSubscriptionsOperations + :ivar domain_topic_event_subscriptions: DomainTopicEventSubscriptionsOperations operations + :vartype domain_topic_event_subscriptions: + azure.mgmt.eventgrid.operations.DomainTopicEventSubscriptionsOperations :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptionsOperations operations :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.operations.SystemTopicEventSubscriptionsOperations - :ivar namespace_topic_event_subscriptions: NamespaceTopicEventSubscriptionsOperations - operations - :vartype namespace_topic_event_subscriptions: - azure.mgmt.eventgrid.operations.NamespaceTopicEventSubscriptionsOperations :ivar partner_topic_event_subscriptions: PartnerTopicEventSubscriptionsOperations operations :vartype partner_topic_event_subscriptions: azure.mgmt.eventgrid.operations.PartnerTopicEventSubscriptionsOperations @@ -98,21 +96,17 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :vartype namespace_topics: azure.mgmt.eventgrid.operations.NamespaceTopicsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.operations.Operations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations :ivar partner_configurations: PartnerConfigurationsOperations operations :vartype partner_configurations: azure.mgmt.eventgrid.operations.PartnerConfigurationsOperations - :ivar partner_destinations: PartnerDestinationsOperations operations - :vartype partner_destinations: azure.mgmt.eventgrid.operations.PartnerDestinationsOperations :ivar partner_namespaces: PartnerNamespacesOperations operations :vartype partner_namespaces: azure.mgmt.eventgrid.operations.PartnerNamespacesOperations :ivar partner_registrations: PartnerRegistrationsOperations operations :vartype partner_registrations: azure.mgmt.eventgrid.operations.PartnerRegistrationsOperations :ivar partner_topics: PartnerTopicsOperations operations :vartype partner_topics: azure.mgmt.eventgrid.operations.PartnerTopicsOperations - :ivar network_security_perimeter_configurations: - NetworkSecurityPerimeterConfigurationsOperations operations - :vartype network_security_perimeter_configurations: - azure.mgmt.eventgrid.operations.NetworkSecurityPerimeterConfigurationsOperations :ivar permission_bindings: PermissionBindingsOperations operations :vartype permission_bindings: azure.mgmt.eventgrid.operations.PermissionBindingsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations @@ -122,8 +116,6 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :vartype private_link_resources: azure.mgmt.eventgrid.operations.PrivateLinkResourcesOperations :ivar system_topics: SystemTopicsOperations operations :vartype system_topics: azure.mgmt.eventgrid.operations.SystemTopicsOperations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations :ivar extension_topics: ExtensionTopicsOperations operations :vartype extension_topics: azure.mgmt.eventgrid.operations.ExtensionTopicsOperations :ivar topic_spaces: TopicSpacesOperations operations @@ -139,8 +131,8 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :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 "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-15". 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. @@ -186,22 +178,22 @@ def __init__( self.clients = ClientsOperations(self._client, self._config, self._serialize, self._deserialize) self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) self.domain_topics = DomainTopicsOperations(self._client, self._config, self._serialize, self._deserialize) - self.domain_topic_event_subscriptions = DomainTopicEventSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.topic_event_subscriptions = TopicEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.domain_event_subscriptions = DomainEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.namespace_topic_event_subscriptions = NamespaceTopicEventSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.event_subscriptions = EventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( + self.domain_topic_event_subscriptions = DomainTopicEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.namespace_topic_event_subscriptions = NamespaceTopicEventSubscriptionsOperations( + self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.partner_topic_event_subscriptions = PartnerTopicEventSubscriptionsOperations( @@ -212,12 +204,10 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) self.partner_configurations = PartnerConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.partner_destinations = PartnerDestinationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.partner_namespaces = PartnerNamespacesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -225,9 +215,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.partner_topics = PartnerTopicsOperations(self._client, self._config, self._serialize, self._deserialize) - self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.permission_bindings = PermissionBindingsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -238,7 +225,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.system_topics = SystemTopicsOperations(self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) self.extension_topics = ExtensionTopicsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -273,7 +259,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "EventGridManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py index 2f781d740827..b24ab2885450 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +145,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -182,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -204,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -233,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -406,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -424,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -662,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -726,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object 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, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -977,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1352,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1414,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1503,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1645,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1718,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1730,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1741,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1832,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1847,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1875,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1885,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1908,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1922,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1937,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1974,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1994,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license 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.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py index 95930dfec748..f30401ec2040 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.0b4" +VERSION = "2.2.0" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py index a5837ab3e4e4..aa70b183c0f3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._event_grid_management_client import EventGridManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._event_grid_management_client import EventGridManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "EventGridManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py index 8193e78ba029..2ee91dac9880 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for EventGridManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,13 +28,13 @@ class EventGridManagementClientConfiguration: # pylint: disable=too-many-instan :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-15". 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: - api_version: str = kwargs.pop("api_version", "2024-06-01-preview") + api_version: str = kwargs.pop("api_version", "2025-02-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py index 61cf9c637db6..04136a483988 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -31,10 +32,8 @@ NamespaceTopicEventSubscriptionsOperations, NamespaceTopicsOperations, NamespacesOperations, - NetworkSecurityPerimeterConfigurationsOperations, Operations, PartnerConfigurationsOperations, - PartnerDestinationsOperations, PartnerNamespacesOperations, PartnerRegistrationsOperations, PartnerTopicEventSubscriptionsOperations, @@ -52,11 +51,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class EventGridManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class EventGridManagementClient: # pylint: disable=too-many-instance-attributes """Azure EventGrid Management Client. :ivar ca_certificates: CaCertificatesOperations operations @@ -71,24 +69,24 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :vartype domains: azure.mgmt.eventgrid.aio.operations.DomainsOperations :ivar domain_topics: DomainTopicsOperations operations :vartype domain_topics: azure.mgmt.eventgrid.aio.operations.DomainTopicsOperations - :ivar domain_topic_event_subscriptions: DomainTopicEventSubscriptionsOperations operations - :vartype domain_topic_event_subscriptions: - azure.mgmt.eventgrid.aio.operations.DomainTopicEventSubscriptionsOperations :ivar topic_event_subscriptions: TopicEventSubscriptionsOperations operations :vartype topic_event_subscriptions: azure.mgmt.eventgrid.aio.operations.TopicEventSubscriptionsOperations :ivar domain_event_subscriptions: DomainEventSubscriptionsOperations operations :vartype domain_event_subscriptions: azure.mgmt.eventgrid.aio.operations.DomainEventSubscriptionsOperations + :ivar namespace_topic_event_subscriptions: NamespaceTopicEventSubscriptionsOperations + operations + :vartype namespace_topic_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.NamespaceTopicEventSubscriptionsOperations :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.aio.operations.EventSubscriptionsOperations + :ivar domain_topic_event_subscriptions: DomainTopicEventSubscriptionsOperations operations + :vartype domain_topic_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.DomainTopicEventSubscriptionsOperations :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptionsOperations operations :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.aio.operations.SystemTopicEventSubscriptionsOperations - :ivar namespace_topic_event_subscriptions: NamespaceTopicEventSubscriptionsOperations - operations - :vartype namespace_topic_event_subscriptions: - azure.mgmt.eventgrid.aio.operations.NamespaceTopicEventSubscriptionsOperations :ivar partner_topic_event_subscriptions: PartnerTopicEventSubscriptionsOperations operations :vartype partner_topic_event_subscriptions: azure.mgmt.eventgrid.aio.operations.PartnerTopicEventSubscriptionsOperations @@ -98,12 +96,11 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :vartype namespace_topics: azure.mgmt.eventgrid.aio.operations.NamespaceTopicsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.aio.operations.Operations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.eventgrid.aio.operations.TopicsOperations :ivar partner_configurations: PartnerConfigurationsOperations operations :vartype partner_configurations: azure.mgmt.eventgrid.aio.operations.PartnerConfigurationsOperations - :ivar partner_destinations: PartnerDestinationsOperations operations - :vartype partner_destinations: - azure.mgmt.eventgrid.aio.operations.PartnerDestinationsOperations :ivar partner_namespaces: PartnerNamespacesOperations operations :vartype partner_namespaces: azure.mgmt.eventgrid.aio.operations.PartnerNamespacesOperations :ivar partner_registrations: PartnerRegistrationsOperations operations @@ -111,10 +108,6 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k azure.mgmt.eventgrid.aio.operations.PartnerRegistrationsOperations :ivar partner_topics: PartnerTopicsOperations operations :vartype partner_topics: azure.mgmt.eventgrid.aio.operations.PartnerTopicsOperations - :ivar network_security_perimeter_configurations: - NetworkSecurityPerimeterConfigurationsOperations operations - :vartype network_security_perimeter_configurations: - azure.mgmt.eventgrid.aio.operations.NetworkSecurityPerimeterConfigurationsOperations :ivar permission_bindings: PermissionBindingsOperations operations :vartype permission_bindings: azure.mgmt.eventgrid.aio.operations.PermissionBindingsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations @@ -125,8 +118,6 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k azure.mgmt.eventgrid.aio.operations.PrivateLinkResourcesOperations :ivar system_topics: SystemTopicsOperations operations :vartype system_topics: azure.mgmt.eventgrid.aio.operations.SystemTopicsOperations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.eventgrid.aio.operations.TopicsOperations :ivar extension_topics: ExtensionTopicsOperations operations :vartype extension_topics: azure.mgmt.eventgrid.aio.operations.ExtensionTopicsOperations :ivar topic_spaces: TopicSpacesOperations operations @@ -142,8 +133,8 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k :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 "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-15". 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. @@ -189,22 +180,22 @@ def __init__( self.clients = ClientsOperations(self._client, self._config, self._serialize, self._deserialize) self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) self.domain_topics = DomainTopicsOperations(self._client, self._config, self._serialize, self._deserialize) - self.domain_topic_event_subscriptions = DomainTopicEventSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.topic_event_subscriptions = TopicEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.domain_event_subscriptions = DomainEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.namespace_topic_event_subscriptions = NamespaceTopicEventSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.event_subscriptions = EventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( + self.domain_topic_event_subscriptions = DomainTopicEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.namespace_topic_event_subscriptions = NamespaceTopicEventSubscriptionsOperations( + self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.partner_topic_event_subscriptions = PartnerTopicEventSubscriptionsOperations( @@ -215,12 +206,10 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) self.partner_configurations = PartnerConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.partner_destinations = PartnerDestinationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.partner_namespaces = PartnerNamespacesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -228,9 +217,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.partner_topics = PartnerTopicsOperations(self._client, self._config, self._serialize, self._deserialize) - self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.permission_bindings = PermissionBindingsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -241,7 +227,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.system_topics = SystemTopicsOperations(self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) self.extension_topics = ExtensionTopicsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -278,7 +263,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "EventGridManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py index a245f48233e3..780e5563fc94 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py @@ -5,41 +5,45 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._ca_certificates_operations import CaCertificatesOperations -from ._channels_operations import ChannelsOperations -from ._client_groups_operations import ClientGroupsOperations -from ._clients_operations import ClientsOperations -from ._domains_operations import DomainsOperations -from ._domain_topics_operations import DomainTopicsOperations -from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations -from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations -from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations -from ._event_subscriptions_operations import EventSubscriptionsOperations -from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations -from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations -from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations -from ._namespaces_operations import NamespacesOperations -from ._namespace_topics_operations import NamespaceTopicsOperations -from ._operations import Operations -from ._partner_configurations_operations import PartnerConfigurationsOperations -from ._partner_destinations_operations import PartnerDestinationsOperations -from ._partner_namespaces_operations import PartnerNamespacesOperations -from ._partner_registrations_operations import PartnerRegistrationsOperations -from ._partner_topics_operations import PartnerTopicsOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._permission_bindings_operations import PermissionBindingsOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._system_topics_operations import SystemTopicsOperations -from ._topics_operations import TopicsOperations -from ._extension_topics_operations import ExtensionTopicsOperations -from ._topic_spaces_operations import TopicSpacesOperations -from ._topic_types_operations import TopicTypesOperations -from ._verified_partners_operations import VerifiedPartnersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._ca_certificates_operations import CaCertificatesOperations # type: ignore +from ._channels_operations import ChannelsOperations # type: ignore +from ._client_groups_operations import ClientGroupsOperations # type: ignore +from ._clients_operations import ClientsOperations # type: ignore +from ._domains_operations import DomainsOperations # type: ignore +from ._domain_topics_operations import DomainTopicsOperations # type: ignore +from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations # type: ignore +from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations # type: ignore +from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations # type: ignore +from ._event_subscriptions_operations import EventSubscriptionsOperations # type: ignore +from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations # type: ignore +from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations # type: ignore +from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations # type: ignore +from ._namespaces_operations import NamespacesOperations # type: ignore +from ._namespace_topics_operations import NamespaceTopicsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._topics_operations import TopicsOperations # type: ignore +from ._partner_configurations_operations import PartnerConfigurationsOperations # type: ignore +from ._partner_namespaces_operations import PartnerNamespacesOperations # type: ignore +from ._partner_registrations_operations import PartnerRegistrationsOperations # type: ignore +from ._partner_topics_operations import PartnerTopicsOperations # type: ignore +from ._permission_bindings_operations import PermissionBindingsOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._system_topics_operations import SystemTopicsOperations # type: ignore +from ._extension_topics_operations import ExtensionTopicsOperations # type: ignore +from ._topic_spaces_operations import TopicSpacesOperations # type: ignore +from ._topic_types_operations import TopicTypesOperations # type: ignore +from ._verified_partners_operations import VerifiedPartnersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -49,31 +53,29 @@ "ClientsOperations", "DomainsOperations", "DomainTopicsOperations", - "DomainTopicEventSubscriptionsOperations", "TopicEventSubscriptionsOperations", "DomainEventSubscriptionsOperations", + "NamespaceTopicEventSubscriptionsOperations", "EventSubscriptionsOperations", + "DomainTopicEventSubscriptionsOperations", "SystemTopicEventSubscriptionsOperations", - "NamespaceTopicEventSubscriptionsOperations", "PartnerTopicEventSubscriptionsOperations", "NamespacesOperations", "NamespaceTopicsOperations", "Operations", + "TopicsOperations", "PartnerConfigurationsOperations", - "PartnerDestinationsOperations", "PartnerNamespacesOperations", "PartnerRegistrationsOperations", "PartnerTopicsOperations", - "NetworkSecurityPerimeterConfigurationsOperations", "PermissionBindingsOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", "SystemTopicsOperations", - "TopicsOperations", "ExtensionTopicsOperations", "TopicSpacesOperations", "TopicTypesOperations", "VerifiedPartnersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py index 4bc11a2b9b74..8c1ed6565de4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._ca_certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_namespace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.CaCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +107,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +121,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("CaCertificate", pipeline_response) + deserialized = self._deserialize("CaCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +135,8 @@ async def _create_or_update_initial( ca_certificate_name: str, ca_certificate_info: Union[_models.CaCertificate, IO[bytes]], **kwargs: Any - ) -> _models.CaCertificate: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +149,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.CaCertificate] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +171,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -179,15 +182,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("CaCertificate", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CaCertificate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,10 +313,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CaCertificate", pipeline_response) + deserialized = self._deserialize("CaCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, ca_certificate_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -414,7 +426,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, ca_certificate_name=ca_certificate_name, @@ -424,6 +436,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -487,7 +500,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CaCertificatesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -524,7 +536,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py index 82838ac77b25..385c251eb9c7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._channels_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +86,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.Channel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +109,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -119,7 +122,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Channel", pipeline_response) + deserialized = self._deserialize("Channel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +220,7 @@ async def create_or_update( :rtype: ~azure.mgmt.eventgrid.models.Channel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +255,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -266,21 +268,17 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Channel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Channel", pipeline_response) + deserialized = self._deserialize("Channel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, partner_namespace_name: str, channel_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +290,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -303,10 +301,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -314,6 +312,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -321,8 +323,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -352,7 +358,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, partner_namespace_name=partner_namespace_name, channel_name=channel_name, @@ -362,6 +368,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -384,7 +391,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload - async def update( # pylint: disable=inconsistent-return-statements + async def update( self, resource_group_name: str, partner_namespace_name: str, @@ -416,7 +423,7 @@ async def update( # pylint: disable=inconsistent-return-statements """ @overload - async def update( # pylint: disable=inconsistent-return-statements + async def update( self, resource_group_name: str, partner_namespace_name: str, @@ -448,7 +455,7 @@ async def update( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def update( # pylint: disable=inconsistent-return-statements + async def update( self, resource_group_name: str, partner_namespace_name: str, @@ -475,7 +482,7 @@ async def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +517,6 @@ async def update( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -567,7 +573,7 @@ def list_by_partner_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChannelsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,7 +594,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -604,7 +609,6 @@ def prepare_request(next_link=None): _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 @@ -652,7 +656,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -675,7 +679,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -689,7 +692,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py index 128cc0334a23..f98e9e175b30 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._client_groups_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_namespace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.ClientGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +107,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +121,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("ClientGroup", pipeline_response) + deserialized = self._deserialize("ClientGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +135,8 @@ async def _create_or_update_initial( client_group_name: str, client_group_info: Union[_models.ClientGroup, IO[bytes]], **kwargs: Any - ) -> _models.ClientGroup: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +149,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.ClientGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +171,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -179,15 +182,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("ClientGroup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ClientGroup", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,10 +313,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClientGroup", pipeline_response) + deserialized = self._deserialize("ClientGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, client_group_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -414,7 +426,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, client_group_name=client_group_name, @@ -424,6 +436,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -487,7 +500,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientGroupsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -524,7 +536,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py index 2754378edf57..a60c6db8a985 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._clients_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_namespace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.Client :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +107,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +121,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("Client", pipeline_response) + deserialized = self._deserialize("Client", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +135,8 @@ async def _create_or_update_initial( client_name: str, client_info: Union[_models.Client, IO[bytes]], **kwargs: Any - ) -> _models.Client: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +149,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Client] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +171,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -179,15 +182,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("Client", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Client", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -309,10 +312,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Client", pipeline_response) + deserialized = self._deserialize("Client", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -337,10 +341,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, client_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +356,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -363,10 +367,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -374,6 +378,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -382,8 +390,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -413,7 +425,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, client_name=client_name, @@ -423,6 +435,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -486,7 +499,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +520,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -523,7 +535,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py index 14851640ade5..9015ae6d82d8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +87,7 @@ async def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +110,6 @@ async def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +123,7 @@ async def get_delivery_attributes( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -146,7 +149,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +172,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +185,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -197,8 +199,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +213,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +235,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,14 +246,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -382,10 +384,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -407,10 +410,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, domain_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +425,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -433,10 +436,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -444,6 +447,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -451,8 +458,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -482,7 +493,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, event_subscription_name=event_subscription_name, @@ -492,6 +503,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -520,8 +532,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +546,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -556,10 +568,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -567,10 +579,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -695,10 +711,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -739,7 +756,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -762,7 +779,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -776,7 +792,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -823,7 +839,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -844,7 +860,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -860,7 +875,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py index 4e519de65afb..38d8096907f0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_topic_event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,72 +68,6 @@ 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_delivery_attributes( - self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> _models.DeliveryAttributeListResult: - """Get delivery attributes for an event subscription for domain topic. - - Get all delivery attributes for an event subscription for domain topic. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param domain_name: Name of the top level domain. Required. - :type domain_name: str - :param topic_name: Name of the domain topic. Required. - :type topic_name: str - :param event_subscription_name: Name of the event subscription. Required. - :type event_subscription_name: str - :return: DeliveryAttributeListResult or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult - :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.DeliveryAttributeListResult] = kwargs.pop("cls", None) - - _request = build_get_delivery_attributes_request( - resource_group_name=resource_group_name, - domain_name=domain_name, - topic_name=topic_name, - event_subscription_name=event_subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async async def get( self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any @@ -151,7 +89,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +113,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +126,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -204,8 +141,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +155,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,10 +178,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -252,14 +189,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,10 +337,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -425,10 +363,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -440,7 +378,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -452,10 +390,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -463,6 +401,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -470,8 +412,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -503,7 +449,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, topic_name=topic_name, @@ -514,6 +460,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -543,8 +490,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -557,7 +504,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -580,10 +527,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -591,10 +538,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -729,10 +680,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -775,7 +727,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -799,7 +751,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -813,7 +764,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -863,7 +814,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -901,7 +851,6 @@ def prepare_request(next_link=None): _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 @@ -929,3 +878,68 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_delivery_attributes( + self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any + ) -> _models.DeliveryAttributeListResult: + """Get delivery attributes for an event subscription for domain topic. + + Get all delivery attributes for an event subscription for domain topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + Required. + :type resource_group_name: str + :param domain_name: Name of the top level domain. Required. + :type domain_name: str + :param topic_name: Name of the domain topic. Required. + :type topic_name: str + :param event_subscription_name: Name of the event subscription. Required. + :type event_subscription_name: str + :return: DeliveryAttributeListResult or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.DeliveryAttributeListResult] = kwargs.pop("cls", None) + + _request = build_get_delivery_attributes_request( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py index 85c2d42a23a5..9058b7588dd7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -29,7 +30,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_topics_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +37,10 @@ build_list_by_domain_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.DomainTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainTopic", pipeline_response) + deserialized = self._deserialize("DomainTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -125,8 +128,8 @@ async def get( async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any - ) -> _models.DomainTopic: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -138,7 +141,7 @@ async def _create_or_update_initial( _params = 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.DomainTopic] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -149,10 +152,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -160,10 +163,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,10 +216,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DomainTopic", pipeline_response) + deserialized = self._deserialize("DomainTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -234,10 +242,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -249,7 +257,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -260,10 +268,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -271,6 +279,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -278,8 +290,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -309,7 +325,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, domain_topic_name=domain_topic_name, @@ -319,6 +335,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -380,7 +397,7 @@ def list_by_domain( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DomainTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +418,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -417,7 +433,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py index 434858ff84ac..fb43b0a2167f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_create_or_update_request, build_delete_request, @@ -42,6 +43,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - :rtype: ~azure.mgmt.eventgrid.models.Domain :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +107,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +120,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -125,8 +129,8 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain_info: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +143,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -160,10 +164,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -171,10 +175,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,10 +290,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -307,10 +316,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, domain_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +329,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -332,10 +339,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -343,6 +350,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -350,8 +361,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -377,7 +392,7 @@ async def begin_delete(self, resource_group_name: str, domain_name: str, **kwarg 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, api_version=api_version, @@ -386,6 +401,7 @@ async def begin_delete(self, resource_group_name: str, domain_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -413,8 +429,8 @@ async def _update_initial( domain_name: str, domain_update_parameters: Union[_models.DomainUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Domain]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +443,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.Domain]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -448,10 +464,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -459,12 +475,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -578,10 +596,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -633,7 +652,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -668,7 +686,6 @@ def prepare_request(next_link=None): _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 @@ -730,7 +747,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -750,7 +767,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -766,7 +782,6 @@ def prepare_request(next_link=None): _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 @@ -812,7 +827,7 @@ async def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -834,7 +849,6 @@ async def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -848,7 +862,7 @@ async def list_shared_access_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -938,7 +952,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -972,7 +986,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -986,7 +999,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py index 4c214e24cdaf..b1c9901fca19 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -50,6 +51,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,73 +78,9 @@ 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_delivery_attributes( - self, scope: str, event_subscription_name: str, **kwargs: Any - ) -> _models.DeliveryAttributeListResult: - """Get delivery attributes for an event subscription. - - Get all delivery attributes for an event subscription. - - :param scope: The scope of the event subscription. The scope can be a subscription, or a - resource group, or a top level resource belonging to a resource provider namespace, or an - EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' - for a resource, and - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' - for an EventGrid topic. Required. - :type scope: str - :param event_subscription_name: Name of the event subscription. Required. - :type event_subscription_name: str - :return: DeliveryAttributeListResult or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult - :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.DeliveryAttributeListResult] = kwargs.pop("cls", None) - - _request = build_get_delivery_attributes_request( - scope=scope, - event_subscription_name=event_subscription_name, - api_version=api_version, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _models.EventSubscription: + # pylint: disable=line-too-long """Get an event subscription. Get properties of an event subscription. @@ -159,7 +100,7 @@ async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +121,6 @@ async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +134,7 @@ async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,8 +147,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +161,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,10 +181,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -252,10 +192,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -272,6 +216,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -313,6 +258,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -352,6 +298,7 @@ async def begin_create_or_update( event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -400,10 +347,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -425,10 +373,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, scope: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, scope: str, event_subscription_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -440,7 +386,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( scope=scope, @@ -449,10 +395,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -460,6 +406,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -467,11 +417,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + # pylint: disable=line-too-long """Delete an event subscription. Delete an existing event subscription. @@ -500,7 +455,7 @@ async def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: 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 + raw_result = await self._delete_initial( scope=scope, event_subscription_name=event_subscription_name, api_version=api_version, @@ -509,6 +464,7 @@ async def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -536,8 +492,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +506,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -570,10 +526,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -581,10 +537,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -601,6 +561,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Update an event subscription. Asynchronously updates an existing event subscription. @@ -638,6 +599,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Update an event subscription. Asynchronously updates an existing event subscription. @@ -672,6 +634,7 @@ async def begin_update( event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Update an event subscription. Asynchronously updates an existing event subscription. @@ -717,10 +680,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -746,6 +710,7 @@ def get_long_running_output(pipeline_response): async def get_full_url( self, scope: str, event_subscription_name: str, **kwargs: Any ) -> _models.EventSubscriptionFullUrl: + # pylint: disable=line-too-long """Get full URL of an event subscription. Get the full endpoint URL for an event subscription. @@ -765,7 +730,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -786,7 +751,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -800,7 +764,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -837,7 +801,7 @@ def list_global_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -856,7 +820,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -872,7 +835,6 @@ def prepare_request(next_link=None): _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 @@ -933,7 +895,7 @@ def list_global_by_subscription_for_topic_type( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -953,7 +915,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -969,7 +930,6 @@ def prepare_request(next_link=None): _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 @@ -1031,7 +991,7 @@ def list_global_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1051,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1067,7 +1026,6 @@ def prepare_request(next_link=None): _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 @@ -1136,7 +1094,7 @@ def list_global_by_resource_group_for_topic_type( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1157,7 +1115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1173,7 +1130,6 @@ def prepare_request(next_link=None): _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 @@ -1234,7 +1190,7 @@ def list_regional_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1254,7 +1210,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1270,7 +1225,6 @@ def prepare_request(next_link=None): _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 @@ -1340,7 +1294,7 @@ def list_regional_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1361,7 +1315,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1377,7 +1330,6 @@ def prepare_request(next_link=None): _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 @@ -1446,7 +1398,7 @@ def list_regional_by_subscription_for_topic_type( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1467,7 +1419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1483,7 +1434,6 @@ def prepare_request(next_link=None): _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 @@ -1557,7 +1507,7 @@ def list_regional_by_resource_group_for_topic_type( # pylint: disable=name-too- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1579,7 +1529,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1595,7 +1544,6 @@ def prepare_request(next_link=None): _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 @@ -1670,7 +1618,7 @@ def list_by_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1693,7 +1641,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1709,7 +1656,6 @@ def prepare_request(next_link=None): _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 @@ -1781,7 +1727,7 @@ def list_by_domain_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1803,7 +1749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1819,7 +1764,6 @@ def prepare_request(next_link=None): _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 @@ -1847,3 +1791,68 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_delivery_attributes( + self, scope: str, event_subscription_name: str, **kwargs: Any + ) -> _models.DeliveryAttributeListResult: + # pylint: disable=line-too-long + """Get delivery attributes for an event subscription. + + Get all delivery attributes for an event subscription. + + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. Required. + :type scope: str + :param event_subscription_name: Name of the event subscription. Required. + :type event_subscription_name: str + :return: DeliveryAttributeListResult or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.DeliveryAttributeListResult] = kwargs.pop("cls", None) + + _request = build_get_delivery_attributes_request( + scope=scope, + event_subscription_name=event_subscription_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py index fc05f56283c4..b9086a24327d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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._extension_topics_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: + # pylint: disable=line-too-long """Get properties of an extension topic. Get the properties of an extension topic. @@ -67,7 +70,7 @@ async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: :rtype: ~azure.mgmt.eventgrid.models.ExtensionTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,7 +90,6 @@ async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -101,7 +103,7 @@ async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExtensionTopic", pipeline_response) + deserialized = self._deserialize("ExtensionTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py index 469aba438723..c16b43c8b721 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._namespace_topic_event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +94,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.Subscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +118,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -129,7 +132,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("Subscription", pipeline_response) + deserialized = self._deserialize("Subscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -144,8 +147,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.Subscription, IO[bytes]], **kwargs: Any - ) -> _models.Subscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +161,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Subscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -181,10 +184,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -192,15 +195,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("Subscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -344,10 +347,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = self._deserialize("Subscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -372,15 +376,15 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,7 +396,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -404,10 +408,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -415,6 +419,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -423,8 +431,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -461,7 +473,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, @@ -472,6 +484,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -503,8 +516,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.Subscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,7 +530,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.Subscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -540,10 +553,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -551,18 +564,19 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Subscription", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -697,10 +711,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = self._deserialize("Subscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -768,7 +783,7 @@ def list_by_namespace_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -790,7 +805,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -806,7 +820,6 @@ def prepare_request(next_link=None): _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 @@ -862,7 +875,7 @@ async def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -886,7 +899,6 @@ async def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -901,7 +913,7 @@ async def get_delivery_attributes( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -934,7 +946,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.SubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +970,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -973,7 +984,7 @@ async def get_full_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py index 655982e80d91..b0494d5d5d38 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._namespace_topics_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +42,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.NamespaceTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +111,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -121,7 +125,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("NamespaceTopic", pipeline_response) + deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -135,8 +139,8 @@ async def _create_or_update_initial( topic_name: str, namespace_topic_info: Union[_models.NamespaceTopic, IO[bytes]], **kwargs: Any - ) -> _models.NamespaceTopic: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +153,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.NamespaceTopic] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -171,10 +175,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -182,15 +186,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("NamespaceTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,10 +317,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -341,10 +346,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +361,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -367,10 +372,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -378,6 +383,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -386,8 +395,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -417,7 +430,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, @@ -427,6 +440,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -457,8 +471,8 @@ async def _update_initial( topic_name: str, namespace_topic_update_parameters: Union[_models.NamespaceTopicUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.NamespaceTopic: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +485,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.NamespaceTopic] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -493,10 +507,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -504,18 +518,19 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("NamespaceTopic", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -640,10 +655,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -708,7 +724,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamespaceTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -729,7 +745,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -745,7 +760,6 @@ def prepare_request(next_link=None): _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 @@ -794,7 +808,7 @@ async def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -817,7 +831,6 @@ async def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -832,7 +845,7 @@ async def list_shared_access_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -846,8 +859,8 @@ async def _regenerate_key_initial( topic_name: str, regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TopicSharedAccessKeys]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +873,7 @@ async def _regenerate_key_initial( api_version: str = kwargs.pop("api_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.TopicSharedAccessKeys]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -882,10 +895,10 @@ async def _regenerate_key_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -893,18 +906,20 @@ async def _regenerate_key_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("TopicSharedAccessKeys", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1027,10 +1042,11 @@ async def begin_regenerate_key( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py index 4679ef581539..c5b88b4ad0fc 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._namespaces_operations import ( build_create_or_update_request, build_delete_request, @@ -43,6 +44,10 @@ build_validate_custom_domain_ownership_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any :rtype: ~azure.mgmt.eventgrid.models.Namespace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +108,6 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +122,7 @@ async def get(self, resource_group_name: str, namespace_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("Namespace", pipeline_response) + deserialized = self._deserialize("Namespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -131,8 +135,8 @@ async def _create_or_update_initial( namespace_name: str, namespace_info: Union[_models.Namespace, IO[bytes]], **kwargs: Any - ) -> _models.Namespace: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -145,7 +149,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Namespace] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -166,10 +170,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -177,15 +181,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("Namespace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,10 +302,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = self._deserialize("Namespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -326,10 +331,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +346,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -351,10 +356,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -362,6 +367,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -370,8 +379,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -397,7 +410,7 @@ async def begin_delete(self, resource_group_name: str, namespace_name: str, **kw 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, @@ -406,6 +419,7 @@ async def begin_delete(self, resource_group_name: str, namespace_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -435,8 +449,8 @@ async def _update_initial( namespace_name: str, namespace_update_parameters: Union[_models.NamespaceUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.Namespace: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +463,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.Namespace] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -470,10 +484,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -481,18 +495,19 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Namespace", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -606,10 +621,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = self._deserialize("Namespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -664,7 +680,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -683,7 +699,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -699,7 +714,6 @@ def prepare_request(next_link=None): _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 @@ -762,7 +776,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +796,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -798,7 +811,6 @@ def prepare_request(next_link=None): _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 @@ -845,7 +857,7 @@ async def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.NamespaceSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +879,6 @@ async def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -882,7 +893,7 @@ async def list_shared_access_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -895,8 +906,8 @@ async def _regenerate_key_initial( namespace_name: str, regenerate_key_request: Union[_models.NamespaceRegenerateKeyRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.NamespaceSharedAccessKeys]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -909,7 +920,7 @@ async def _regenerate_key_initial( api_version: str = kwargs.pop("api_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.NamespaceSharedAccessKeys]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -930,10 +941,10 @@ async def _regenerate_key_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -941,18 +952,20 @@ async def _regenerate_key_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("NamespaceSharedAccessKeys", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1068,10 +1081,11 @@ async def begin_regenerate_key( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1097,8 +1111,8 @@ def get_long_running_output(pipeline_response): async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long self, resource_group_name: str, namespace_name: str, **kwargs: Any - ) -> Optional[_models.CustomDomainOwnershipValidationResult]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1124,7 @@ async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.CustomDomainOwnershipValidationResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_validate_custom_domain_ownership_request( resource_group_name=resource_group_name, @@ -1120,10 +1134,10 @@ async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1131,18 +1145,20 @@ async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("CustomDomainOwnershipValidationResult", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1185,10 +1201,11 @@ async def begin_validate_custom_domain_ownership( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response) + deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py deleted file mode 100644 index b0e6fbf39246..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,384 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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._network_security_perimeter_configurations_operations import ( - build_get_request, - build_list_request, - build_reconcile_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.eventgrid.aio.EventGridManagementClient`'s - :attr:`network_security_perimeter_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_name: str, - **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Get a specific network security perimeter configuration. - - Get a specific network security perimeter configuration with a topic or domain. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param resource_type: The type of the resource. This can be either \'topics\', or \'domains\'. - Known values are: "topics" and "domains". Required. - :type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType - :param resource_name: The name of the resource (namely, either, the topic name or domain name). - Required. - :type resource_name: str - :param perimeter_guid: Unique identifier for perimeter. Required. - :type perimeter_guid: str - :param association_name: Association name to association network security perimeter resource to - profile. Required. - :type association_name: str - :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration - :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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_type=resource_type, - resource_name=resource_name, - perimeter_guid=perimeter_guid, - association_name=association_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("NetworkSecurityPerimeterConfiguration", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _reconcile_initial( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_name: str, - **kwargs: Any - ) -> Optional[_models.NetworkSecurityPerimeterConfiguration]: - 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[Optional[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) - - _request = build_reconcile_request( - resource_group_name=resource_group_name, - resource_type=resource_type, - resource_name=resource_name, - perimeter_guid=perimeter_guid, - association_name=association_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("NetworkSecurityPerimeterConfiguration", 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) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reconcile( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration]: - """Reconcile a specific network security perimeter configuration for a given network security - perimeter association. - - Reconcile a specific network security perimeter configuration for a given network security - perimeter association with a topic or domain. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'. - Known values are: "topics" and "domains". Required. - :type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType - :param resource_name: The name of the resource (namely, either, the topic name or domain name). - Required. - :type resource_name: str - :param perimeter_guid: Unique identifier for perimeter. Required. - :type perimeter_guid: str - :param association_name: Association name to association network security perimeter resource to - profile. Required. - :type association_name: str - :return: An instance of AsyncLROPoller that returns either - NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration] - :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.NetworkSecurityPerimeterConfiguration] = 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._reconcile_initial( - resource_group_name=resource_group_name, - resource_type=resource_type, - resource_name=resource_name, - perimeter_guid=perimeter_guid, - association_name=association_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): - deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - 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[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: - """Get all network security perimeter configurations for resource. - - Get all network security perimeter configurations associated with a topic or domain. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'. - Known values are: "topics" and "domains". Required. - :type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType - :param resource_name: The name of the resource (namely, either, the topic name or domain name). - Required. - :type resource_name: str - :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration] - :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.NetworkSecurityPerimeterConfigurationList] = 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, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("NetworkSecurityPerimeterConfigurationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py index dc9d3839e9ed..ae1551862aff 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -100,7 +101,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py index 7f56fd18ad32..736eddc29b57 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._partner_configurations_operations import ( build_authorize_partner_request, build_create_or_update_request, @@ -42,6 +43,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ async def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerC :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,7 +104,6 @@ async def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +117,7 @@ async def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerC map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -125,8 +129,8 @@ async def _create_or_update_initial( resource_group_name: str, partner_configuration_info: Union[_models.PartnerConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.PartnerConfiguration: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +143,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PartnerConfiguration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -159,10 +163,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -170,14 +174,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -281,10 +285,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -306,10 +311,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +324,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -330,10 +333,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -341,6 +344,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -348,8 +355,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -373,7 +384,7 @@ async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLR 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, api_version=api_version, cls=lambda x, y, z: x, @@ -381,6 +392,7 @@ async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLR params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -407,8 +419,8 @@ async def _update_initial( resource_group_name: str, partner_configuration_update_parameters: Union[_models.PartnerConfigurationUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.PartnerConfiguration: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,7 +433,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.PartnerConfiguration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -443,10 +455,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -454,14 +466,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -568,10 +580,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -616,7 +629,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,7 +647,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -650,7 +662,6 @@ def prepare_request(next_link=None): _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 @@ -711,7 +722,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -730,7 +741,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +756,6 @@ def prepare_request(next_link=None): _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 @@ -845,7 +854,7 @@ async def authorize_partner( :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +887,6 @@ async def authorize_partner( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -892,7 +900,7 @@ async def authorize_partner( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -969,7 +977,7 @@ async def unauthorize_partner( :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1002,7 +1010,6 @@ async def unauthorize_partner( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1016,7 +1023,7 @@ async def unauthorize_partner( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py deleted file mode 100644 index cb00bb0c8de7..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py +++ /dev/null @@ -1,898 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license 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._partner_destinations_operations import ( - build_activate_request, - 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, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PartnerDestinationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.eventgrid.aio.EventGridManagementClient`'s - :attr:`partner_destinations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, partner_destination_name: str, **kwargs: Any - ) -> _models.PartnerDestination: - """Get a partner destination. - - Get properties of a partner destination. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :return: PartnerDestination or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination - :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.PartnerDestination] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: Union[_models.PartnerDestination, IO[bytes]], - **kwargs: Any - ) -> _models.PartnerDestination: - 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.PartnerDestination] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(partner_destination, (IOBase, bytes)): - _content = partner_destination - else: - _json = self._serialize.body(partner_destination, "PartnerDestination") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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("PartnerDestination", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: _models.PartnerDestination, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PartnerDestination]: - """Create a partner destination. - - Asynchronously creates a new partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination: Partner destination create information. Required. - :type partner_destination: ~azure.mgmt.eventgrid.models.PartnerDestination - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PartnerDestination]: - """Create a partner destination. - - Asynchronously creates a new partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination: Partner destination create information. Required. - :type partner_destination: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: Union[_models.PartnerDestination, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PartnerDestination]: - """Create a partner destination. - - Asynchronously creates a new partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination: Partner destination create information. Is either a - PartnerDestination type or a IO[bytes] type. Required. - :type partner_destination: ~azure.mgmt.eventgrid.models.PartnerDestination or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestination] = 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, - partner_destination_name=partner_destination_name, - partner_destination=partner_destination, - 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("PartnerDestination", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - 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[_models.PartnerDestination].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PartnerDestination]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, partner_destination_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, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, partner_destination_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a partner destination. - - Delete existing partner destination. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :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, - partner_destination_name=partner_destination_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, {}) # type: ignore - - 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[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: Union[_models.PartnerDestinationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.PartnerDestination: - 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.PartnerDestination] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(partner_destination_update_parameters, (IOBase, bytes)): - _content = partner_destination_update_parameters - else: - _json = self._serialize.body(partner_destination_update_parameters, "PartnerDestinationUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: _models.PartnerDestinationUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PartnerDestination]: - """Update a partner destination. - - Asynchronously updates a partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination_update_parameters: Partner destination update information. Required. - :type partner_destination_update_parameters: - ~azure.mgmt.eventgrid.models.PartnerDestinationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PartnerDestination]: - """Update a partner destination. - - Asynchronously updates a partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination_update_parameters: Partner destination update information. Required. - :type partner_destination_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: Union[_models.PartnerDestinationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PartnerDestination]: - """Update a partner destination. - - Asynchronously updates a partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination_update_parameters: Partner destination update information. Is either - a PartnerDestinationUpdateParameters type or a IO[bytes] type. Required. - :type partner_destination_update_parameters: - ~azure.mgmt.eventgrid.models.PartnerDestinationUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestination] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - partner_destination_update_parameters=partner_destination_update_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("PartnerDestination", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - 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[_models.PartnerDestination].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PartnerDestination]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_subscription( - self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.PartnerDestination"]: - """List partner destinations under an Azure subscription. - - List all the partner destinations under an Azure subscription. - - :param filter: The query used to filter the search results using OData syntax. Filtering is - permitted on the 'name' property only and with limited number of OData operations. These - operations are: the 'contains' function as well as the following logical operations: not, and, - or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The - following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. - The following is not a valid filter example: $filter=location eq 'westus'. Default value is - None. - :type filter: str - :param top: The number of results to return per page for the list operation. Valid range for - top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 - items per page. Default value is None. - :type top: int - :return: An iterator like instance of either PartnerDestination or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestinationsListResult] = 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, - filter=filter, - top=top, - api_version=api_version, - 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("PartnerDestinationsListResult", 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) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.PartnerDestination"]: - """List partner destinations under a resource group. - - List all the partner destinations under a resource group. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param filter: The query used to filter the search results using OData syntax. Filtering is - permitted on the 'name' property only and with limited number of OData operations. These - operations are: the 'contains' function as well as the following logical operations: not, and, - or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The - following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. - The following is not a valid filter example: $filter=location eq 'westus'. Default value is - None. - :type filter: str - :param top: The number of results to return per page for the list operation. Valid range for - top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 - items per page. Default value is None. - :type top: int - :return: An iterator like instance of either PartnerDestination or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestinationsListResult] = 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, - filter=filter, - top=top, - api_version=api_version, - 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("PartnerDestinationsListResult", 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) - - @distributed_trace_async - async def activate( - self, resource_group_name: str, partner_destination_name: str, **kwargs: Any - ) -> _models.PartnerDestination: - """Activate a partner destination. - - Activate a newly created partner destination. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :return: PartnerDestination or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination - :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.PartnerDestination] = kwargs.pop("cls", None) - - _request = build_activate_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py index e5285834e71c..5ec3661dd616 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._partner_namespaces_operations import ( build_create_or_update_request, build_delete_request, @@ -42,6 +43,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +109,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -119,7 +123,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("PartnerNamespace", pipeline_response) + deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +136,8 @@ async def _create_or_update_initial( partner_namespace_name: str, partner_namespace_info: Union[_models.PartnerNamespace, IO[bytes]], **kwargs: Any - ) -> _models.PartnerNamespace: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +150,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PartnerNamespace] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -167,10 +171,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -178,11 +182,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("PartnerNamespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -295,10 +303,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -320,10 +329,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +344,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -345,10 +354,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -356,6 +365,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,8 +377,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -393,7 +410,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, partner_namespace_name=partner_namespace_name, api_version=api_version, @@ -402,6 +419,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -429,8 +447,8 @@ async def _update_initial( partner_namespace_name: str, partner_namespace_update_parameters: Union[_models.PartnerNamespaceUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PartnerNamespace]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +461,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.PartnerNamespace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -464,10 +482,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -475,13 +493,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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 - if response.status_code == 201: - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,10 +616,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -651,7 +672,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +691,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -686,7 +706,6 @@ def prepare_request(next_link=None): _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 @@ -749,7 +768,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,7 +788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -785,7 +803,6 @@ def prepare_request(next_link=None): _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 @@ -832,7 +849,7 @@ async def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -854,7 +871,6 @@ async def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -869,7 +885,7 @@ async def list_shared_access_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -959,7 +975,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +1009,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1008,7 +1023,7 @@ async def regenerate_key( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py index d6e486c592c6..91bd94a019a3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._partner_registrations_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -129,8 +132,8 @@ async def _create_or_update_initial( partner_registration_name: str, partner_registration_info: Union[_models.PartnerRegistration, IO[bytes]], **kwargs: Any - ) -> _models.PartnerRegistration: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +146,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PartnerRegistration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -164,10 +167,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -175,20 +178,17 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PartnerRegistration", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @@ -298,10 +298,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -323,10 +324,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, partner_registration_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +339,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -348,10 +349,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -359,6 +360,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -366,8 +371,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -395,7 +404,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, partner_registration_name=partner_registration_name, api_version=api_version, @@ -404,6 +413,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -431,8 +441,8 @@ async def _update_initial( partner_registration_name: str, partner_registration_update_parameters: Union[_models.PartnerRegistrationUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PartnerRegistration]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +455,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.PartnerRegistration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -466,10 +476,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -477,12 +487,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -599,10 +611,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -655,7 +668,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -674,7 +687,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -690,7 +702,6 @@ def prepare_request(next_link=None): _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 @@ -753,7 +764,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +784,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -789,7 +799,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py index d247a4dc5e03..cd756e6cfc51 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._partner_topic_event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -134,8 +137,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +151,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -170,10 +173,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -181,14 +184,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,10 +325,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -347,10 +351,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, partner_topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +366,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -373,10 +377,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -384,6 +388,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -391,8 +399,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -422,7 +434,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, partner_topic_name=partner_topic_name, event_subscription_name=event_subscription_name, @@ -432,6 +444,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -460,8 +473,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,7 +487,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -496,10 +509,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -507,10 +520,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -635,10 +652,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -679,7 +697,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -702,7 +720,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -716,7 +733,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -763,7 +780,7 @@ def list_by_partner_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -784,7 +801,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -800,7 +816,6 @@ def prepare_request(next_link=None): _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 @@ -848,7 +863,7 @@ async def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +886,6 @@ async def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -885,7 +899,7 @@ async def get_delivery_attributes( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py index 23d1dfb5ac35..5da2f90f23c6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._partner_topics_operations import ( build_activate_request, build_create_or_update_request, @@ -42,6 +42,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +106,6 @@ async def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +119,7 @@ async def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -205,7 +208,7 @@ async def create_or_update( :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +242,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -253,21 +255,17 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PartnerTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, partner_topic_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -279,7 +277,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -289,10 +287,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -300,6 +298,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -307,8 +309,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -336,7 +342,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, partner_topic_name=partner_topic_name, api_version=api_version, @@ -345,6 +351,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -450,7 +457,7 @@ async def update( :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +491,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -500,7 +506,7 @@ async def update( deserialized = None if response.status_code == 201: - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,7 +543,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +562,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -572,7 +577,6 @@ def prepare_request(next_link=None): _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 @@ -634,7 +638,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +658,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -670,7 +673,6 @@ def prepare_request(next_link=None): _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 @@ -714,7 +716,7 @@ async def activate(self, resource_group_name: str, partner_topic_name: str, **kw :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,7 +738,6 @@ async def activate(self, resource_group_name: str, partner_topic_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +751,7 @@ async def activate(self, resource_group_name: str, partner_topic_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -774,7 +775,7 @@ async def deactivate( :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -796,7 +797,6 @@ async def deactivate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -810,7 +810,7 @@ async def deactivate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py index b368d2860d98..8b6bf8458f6d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._permission_bindings_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_namespace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.PermissionBinding :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +107,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +121,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("PermissionBinding", pipeline_response) + deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +135,8 @@ async def _create_or_update_initial( permission_binding_name: str, permission_binding_info: Union[_models.PermissionBinding, IO[bytes]], **kwargs: Any - ) -> _models.PermissionBinding: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +149,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PermissionBinding] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +171,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -179,15 +182,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("PermissionBinding", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PermissionBinding", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,10 +313,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PermissionBinding", pipeline_response) + deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, permission_binding_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -414,7 +426,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, permission_binding_name=permission_binding_name, @@ -424,6 +436,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -487,7 +500,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PermissionBindingsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -524,7 +536,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py index 57df616fc473..c8d1f0c9d506 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -38,6 +38,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,9 +82,9 @@ async def get( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -92,7 +96,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +120,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -130,7 +133,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -145,8 +148,8 @@ async def _update_initial( private_endpoint_connection_name: str, private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +162,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -182,10 +185,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -193,14 +196,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -226,9 +229,9 @@ async def begin_update( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -267,9 +270,9 @@ async def begin_update( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -306,9 +309,9 @@ async def begin_update( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -349,10 +352,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -374,15 +378,15 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, parent_type: Union[str, _models.PrivateEndpointConnectionsParentType], parent_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -394,7 +398,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -406,10 +410,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -417,6 +421,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -424,8 +432,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -444,9 +456,9 @@ async def begin_delete( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -467,7 +479,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, parent_type=parent_type, parent_name=parent_name, @@ -478,6 +490,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -516,9 +529,9 @@ def list_by_resource( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -547,7 +560,7 @@ def list_by_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +582,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -585,7 +597,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py index b4ffb5d72b32..6f2d3e71481f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._private_link_resources_operations import build_get_request, build_list_by_resource_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +71,8 @@ async def get( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required. :type parent_type: str :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -82,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +108,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +121,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -144,8 +145,8 @@ def list_by_resource( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required. :type parent_type: str :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace name). Required. @@ -173,7 +174,7 @@ def list_by_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +196,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +211,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py index 8b6214e9b3e7..2a464bae3d34 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._system_topic_event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,69 +68,6 @@ 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_delivery_attributes( - self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> _models.DeliveryAttributeListResult: - """Get delivery attributes for an event subscription. - - Get all delivery attributes for an event subscription. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. Required. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription. Required. - :type event_subscription_name: str - :return: DeliveryAttributeListResult or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult - :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.DeliveryAttributeListResult] = kwargs.pop("cls", None) - - _request = build_get_delivery_attributes_request( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - event_subscription_name=event_subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async async def get( self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any @@ -146,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -197,8 +137,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +151,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +173,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,10 +184,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -381,10 +325,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -406,10 +351,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,7 +366,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -432,10 +377,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -443,6 +388,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -450,8 +399,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -481,7 +434,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, system_topic_name=system_topic_name, event_subscription_name=event_subscription_name, @@ -491,6 +444,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -519,8 +473,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -533,7 +487,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -555,10 +509,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -566,10 +520,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -694,10 +652,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -738,7 +697,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -761,7 +720,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -775,7 +733,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,7 +780,7 @@ def list_by_system_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -843,7 +801,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -859,7 +816,6 @@ def prepare_request(next_link=None): _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 @@ -887,3 +843,65 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_delivery_attributes( + self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any + ) -> _models.DeliveryAttributeListResult: + """Get delivery attributes for an event subscription. + + Get all delivery attributes for an event subscription. + + :param resource_group_name: The name of the resource group within the user's subscription. + Required. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. Required. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription. Required. + :type event_subscription_name: str + :return: DeliveryAttributeListResult or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.DeliveryAttributeListResult] = kwargs.pop("cls", None) + + _request = build_get_delivery_attributes_request( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py index c5fa1ad47125..a449a8a99aa9 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._system_topics_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +82,7 @@ async def get(self, resource_group_name: str, system_topic_name: str, **kwargs: :rtype: ~azure.mgmt.eventgrid.models.SystemTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +104,6 @@ async def get(self, resource_group_name: str, system_topic_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +117,7 @@ async def get(self, resource_group_name: str, system_topic_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = self._deserialize("SystemTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -127,8 +130,8 @@ async def _create_or_update_initial( system_topic_name: str, system_topic_info: Union[_models.SystemTopic, IO[bytes]], **kwargs: Any - ) -> _models.SystemTopic: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +144,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.SystemTopic] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -162,10 +165,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -173,14 +176,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SystemTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,10 +296,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = self._deserialize("SystemTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -318,10 +322,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, system_topic_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +337,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -343,10 +347,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -354,6 +358,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -361,8 +369,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -390,7 +402,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, system_topic_name=system_topic_name, api_version=api_version, @@ -399,6 +411,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -426,8 +439,8 @@ async def _update_initial( system_topic_name: str, system_topic_update_parameters: Union[_models.SystemTopicUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.SystemTopic: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -440,7 +453,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.SystemTopic] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -461,10 +474,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -472,14 +485,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SystemTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -593,10 +606,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = self._deserialize("SystemTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -648,7 +662,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +681,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -683,7 +696,6 @@ def prepare_request(next_link=None): _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 @@ -745,7 +757,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +777,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -781,7 +792,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py index 0c7eaa7023f0..df66e54467ef 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._topic_event_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +87,7 @@ async def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +110,6 @@ async def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +123,7 @@ async def get_delivery_attributes( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -146,7 +149,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +172,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +185,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -197,8 +199,8 @@ async def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +213,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +235,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,14 +246,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -382,10 +384,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -407,10 +410,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +425,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -433,10 +436,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -444,6 +447,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -451,8 +458,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -482,7 +493,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, topic_name=topic_name, event_subscription_name=event_subscription_name, @@ -492,6 +503,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -520,8 +532,8 @@ async def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +546,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -556,10 +568,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -567,10 +579,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -695,10 +711,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -739,7 +756,7 @@ async def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -762,7 +779,6 @@ async def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -776,7 +792,7 @@ async def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -823,7 +839,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -844,7 +860,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -860,7 +875,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py index e183445fc290..bb9acdb6a0b5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._topic_spaces_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_namespace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ async def get( :rtype: ~azure.mgmt.eventgrid.models.TopicSpace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +107,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +121,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("TopicSpace", pipeline_response) + deserialized = self._deserialize("TopicSpace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -132,8 +135,8 @@ async def _create_or_update_initial( topic_space_name: str, topic_space_info: Union[_models.TopicSpace, IO[bytes]], **kwargs: Any - ) -> _models.TopicSpace: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +149,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.TopicSpace] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +171,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -179,15 +182,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("TopicSpace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("TopicSpace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,10 +313,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TopicSpace", pipeline_response) + deserialized = self._deserialize("TopicSpace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, namespace_name: str, topic_space_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -414,7 +426,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_space_name=topic_space_name, @@ -424,6 +436,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -487,7 +500,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicSpacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -524,7 +536,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py index 6956022e3da0..2cbd6fb32160 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._topic_types_operations import build_get_request, build_list_event_types_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.TopicTypeInfo"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicTypesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -101,7 +102,6 @@ def prepare_request(next_link=None): _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 @@ -142,7 +142,7 @@ async def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInf :rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +162,6 @@ async def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInf headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -176,7 +175,7 @@ async def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInf map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicTypeInfo", pipeline_response) + deserialized = self._deserialize("TopicTypeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -201,7 +200,7 @@ def list_event_types(self, topic_type_name: str, **kwargs: Any) -> AsyncIterable api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +217,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +232,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py index 51e988ec426d..c83674b3e8cf 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._topics_operations import ( build_create_or_update_request, build_delete_request, @@ -43,6 +44,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.eventgrid.models.Topic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +108,6 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -117,7 +121,7 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = self._deserialize("Topic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -126,8 +130,8 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> async def _create_or_update_initial( self, resource_group_name: str, topic_name: str, topic_info: Union[_models.Topic, IO[bytes]], **kwargs: Any - ) -> _models.Topic: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +144,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Topic] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -161,10 +165,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -172,10 +176,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -280,10 +288,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = self._deserialize("Topic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -305,10 +314,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, topic_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +327,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -330,10 +337,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -341,6 +348,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -348,8 +359,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -375,7 +390,7 @@ async def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, topic_name=topic_name, api_version=api_version, @@ -384,6 +399,7 @@ async def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -411,8 +427,8 @@ async def _update_initial( topic_name: str, topic_update_parameters: Union[_models.TopicUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Topic]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +441,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_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.Topic]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -446,10 +462,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -457,12 +473,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -572,10 +590,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = self._deserialize("Topic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -627,7 +646,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +665,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -662,7 +680,6 @@ def prepare_request(next_link=None): _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 @@ -724,7 +741,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -760,7 +776,6 @@ def prepare_request(next_link=None): _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 @@ -806,7 +821,7 @@ async def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -828,7 +843,6 @@ async def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -842,7 +856,7 @@ async def list_shared_access_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -855,8 +869,8 @@ async def _regenerate_key_initial( topic_name: str, regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TopicSharedAccessKeys]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +883,7 @@ async def _regenerate_key_initial( api_version: str = kwargs.pop("api_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.TopicSharedAccessKeys]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -890,10 +904,10 @@ async def _regenerate_key_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -901,17 +915,19 @@ async def _regenerate_key_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1024,10 +1040,11 @@ async def begin_regenerate_key( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1081,7 +1098,7 @@ def list_event_types( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1102,7 +1119,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1118,7 +1134,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py index e3ba0d124170..ff0a8f443908 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._verified_partners_operations import build_get_request, build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +67,7 @@ async def get(self, verified_partner_name: str, **kwargs: Any) -> _models.Verifi :rtype: ~azure.mgmt.eventgrid.models.VerifiedPartner :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,7 +87,6 @@ async def get(self, verified_partner_name: str, **kwargs: Any) -> _models.Verifi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +100,7 @@ async def get(self, verified_partner_name: str, **kwargs: Any) -> _models.Verifi map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VerifiedPartner", pipeline_response) + deserialized = self._deserialize("VerifiedPartner", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -136,7 +137,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VerifiedPartnersListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +155,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -170,7 +170,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py index 218970c101c9..29560f414ed4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py @@ -5,286 +5,257 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AdvancedFilter -from ._models_py3 import AzureADPartnerClientAuthentication -from ._models_py3 import AzureFunctionEventSubscriptionDestination -from ._models_py3 import BoolEqualsAdvancedFilter -from ._models_py3 import BoolEqualsFilter -from ._models_py3 import CaCertificate -from ._models_py3 import CaCertificatesListResult -from ._models_py3 import Channel -from ._models_py3 import ChannelUpdateParameters -from ._models_py3 import ChannelsListResult -from ._models_py3 import Client -from ._models_py3 import ClientAuthenticationSettings -from ._models_py3 import ClientCertificateAuthentication -from ._models_py3 import ClientGroup -from ._models_py3 import ClientGroupsListResult -from ._models_py3 import ClientsListResult -from ._models_py3 import ConnectionState -from ._models_py3 import CustomDomainConfiguration -from ._models_py3 import CustomDomainIdentity -from ._models_py3 import CustomDomainOwnershipValidationResult -from ._models_py3 import CustomJwtAuthenticationManagedIdentity -from ._models_py3 import CustomJwtAuthenticationSettings -from ._models_py3 import DeadLetterDestination -from ._models_py3 import DeadLetterWithResourceIdentity -from ._models_py3 import DeliveryAttributeListResult -from ._models_py3 import DeliveryAttributeMapping -from ._models_py3 import DeliveryConfiguration -from ._models_py3 import DeliveryWithResourceIdentity -from ._models_py3 import Domain -from ._models_py3 import DomainRegenerateKeyRequest -from ._models_py3 import DomainSharedAccessKeys -from ._models_py3 import DomainTopic -from ._models_py3 import DomainTopicsListResult -from ._models_py3 import DomainUpdateParameters -from ._models_py3 import DomainsListResult -from ._models_py3 import DynamicDeliveryAttributeMapping -from ._models_py3 import DynamicRoutingEnrichment -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import EventHubEventSubscriptionDestination -from ._models_py3 import EventSubscription -from ._models_py3 import EventSubscriptionDestination -from ._models_py3 import EventSubscriptionFilter -from ._models_py3 import EventSubscriptionFullUrl -from ._models_py3 import EventSubscriptionIdentity -from ._models_py3 import EventSubscriptionUpdateParameters -from ._models_py3 import EventSubscriptionsListResult -from ._models_py3 import EventType -from ._models_py3 import EventTypeInfo -from ._models_py3 import EventTypesListResult -from ._models_py3 import ExtendedLocation -from ._models_py3 import ExtensionTopic -from ._models_py3 import Filter -from ._models_py3 import FiltersConfiguration -from ._models_py3 import HybridConnectionEventSubscriptionDestination -from ._models_py3 import IdentityInfo -from ._models_py3 import InboundIpRule -from ._models_py3 import InlineEventProperties -from ._models_py3 import InputSchemaMapping -from ._models_py3 import IsNotNullAdvancedFilter -from ._models_py3 import IsNotNullFilter -from ._models_py3 import IsNullOrUndefinedAdvancedFilter -from ._models_py3 import IsNullOrUndefinedFilter -from ._models_py3 import IssuerCertificateInfo -from ._models_py3 import JsonField -from ._models_py3 import JsonFieldWithDefault -from ._models_py3 import JsonInputSchemaMapping -from ._models_py3 import MonitorAlertEventSubscriptionDestination -from ._models_py3 import Namespace -from ._models_py3 import NamespaceRegenerateKeyRequest -from ._models_py3 import NamespaceSharedAccessKeys -from ._models_py3 import NamespaceSku -from ._models_py3 import NamespaceTopic -from ._models_py3 import NamespaceTopicEventSubscriptionDestination -from ._models_py3 import NamespaceTopicUpdateParameters -from ._models_py3 import NamespaceTopicsListResult -from ._models_py3 import NamespaceUpdateParameters -from ._models_py3 import NamespacesListResult -from ._models_py3 import NetworkSecurityPerimeterConfiguration -from ._models_py3 import NetworkSecurityPerimeterConfigurationIssues -from ._models_py3 import NetworkSecurityPerimeterConfigurationList -from ._models_py3 import NetworkSecurityPerimeterConfigurationProfile -from ._models_py3 import NetworkSecurityPerimeterInfo -from ._models_py3 import NetworkSecurityPerimeterProfileAccessRule -from ._models_py3 import NetworkSecurityPerimeterSubscription -from ._models_py3 import NumberGreaterThanAdvancedFilter -from ._models_py3 import NumberGreaterThanFilter -from ._models_py3 import NumberGreaterThanOrEqualsAdvancedFilter -from ._models_py3 import NumberGreaterThanOrEqualsFilter -from ._models_py3 import NumberInAdvancedFilter -from ._models_py3 import NumberInFilter -from ._models_py3 import NumberInRangeAdvancedFilter -from ._models_py3 import NumberInRangeFilter -from ._models_py3 import NumberLessThanAdvancedFilter -from ._models_py3 import NumberLessThanFilter -from ._models_py3 import NumberLessThanOrEqualsAdvancedFilter -from ._models_py3 import NumberLessThanOrEqualsFilter -from ._models_py3 import NumberNotInAdvancedFilter -from ._models_py3 import NumberNotInFilter -from ._models_py3 import NumberNotInRangeAdvancedFilter -from ._models_py3 import NumberNotInRangeFilter -from ._models_py3 import Operation -from ._models_py3 import OperationInfo -from ._models_py3 import OperationsListResult -from ._models_py3 import Partner -from ._models_py3 import PartnerAuthorization -from ._models_py3 import PartnerClientAuthentication -from ._models_py3 import PartnerConfiguration -from ._models_py3 import PartnerConfigurationUpdateParameters -from ._models_py3 import PartnerConfigurationsListResult -from ._models_py3 import PartnerDestination -from ._models_py3 import PartnerDestinationInfo -from ._models_py3 import PartnerDestinationUpdateParameters -from ._models_py3 import PartnerDestinationsListResult -from ._models_py3 import PartnerDetails -from ._models_py3 import PartnerEventSubscriptionDestination -from ._models_py3 import PartnerNamespace -from ._models_py3 import PartnerNamespaceRegenerateKeyRequest -from ._models_py3 import PartnerNamespaceSharedAccessKeys -from ._models_py3 import PartnerNamespaceUpdateParameters -from ._models_py3 import PartnerNamespacesListResult -from ._models_py3 import PartnerRegistration -from ._models_py3 import PartnerRegistrationUpdateParameters -from ._models_py3 import PartnerRegistrationsListResult -from ._models_py3 import PartnerTopic -from ._models_py3 import PartnerTopicInfo -from ._models_py3 import PartnerTopicUpdateParameters -from ._models_py3 import PartnerTopicsListResult -from ._models_py3 import PartnerUpdateDestinationInfo -from ._models_py3 import PartnerUpdateTopicInfo -from ._models_py3 import PermissionBinding -from ._models_py3 import PermissionBindingsListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourcesListResult -from ._models_py3 import PushInfo -from ._models_py3 import QueueInfo -from ._models_py3 import Resource -from ._models_py3 import ResourceAssociation -from ._models_py3 import ResourceMoveChangeHistory -from ._models_py3 import ResourceSku -from ._models_py3 import RetryPolicy -from ._models_py3 import RoutingEnrichments -from ._models_py3 import RoutingIdentityInfo -from ._models_py3 import ServiceBusQueueEventSubscriptionDestination -from ._models_py3 import ServiceBusTopicEventSubscriptionDestination -from ._models_py3 import StaticDeliveryAttributeMapping -from ._models_py3 import StaticRoutingEnrichment -from ._models_py3 import StaticStringRoutingEnrichment -from ._models_py3 import StorageBlobDeadLetterDestination -from ._models_py3 import StorageQueueEventSubscriptionDestination -from ._models_py3 import StringBeginsWithAdvancedFilter -from ._models_py3 import StringBeginsWithFilter -from ._models_py3 import StringContainsAdvancedFilter -from ._models_py3 import StringContainsFilter -from ._models_py3 import StringEndsWithAdvancedFilter -from ._models_py3 import StringEndsWithFilter -from ._models_py3 import StringInAdvancedFilter -from ._models_py3 import StringInFilter -from ._models_py3 import StringNotBeginsWithAdvancedFilter -from ._models_py3 import StringNotBeginsWithFilter -from ._models_py3 import StringNotContainsAdvancedFilter -from ._models_py3 import StringNotContainsFilter -from ._models_py3 import StringNotEndsWithAdvancedFilter -from ._models_py3 import StringNotEndsWithFilter -from ._models_py3 import StringNotInAdvancedFilter -from ._models_py3 import StringNotInFilter -from ._models_py3 import Subscription -from ._models_py3 import SubscriptionFullUrl -from ._models_py3 import SubscriptionUpdateParameters -from ._models_py3 import SubscriptionsListResult -from ._models_py3 import SystemData -from ._models_py3 import SystemTopic -from ._models_py3 import SystemTopicUpdateParameters -from ._models_py3 import SystemTopicsListResult -from ._models_py3 import Topic -from ._models_py3 import TopicRegenerateKeyRequest -from ._models_py3 import TopicSharedAccessKeys -from ._models_py3 import TopicSpace -from ._models_py3 import TopicSpacesConfiguration -from ._models_py3 import TopicSpacesListResult -from ._models_py3 import TopicTypeAdditionalEnforcedPermission -from ._models_py3 import TopicTypeInfo -from ._models_py3 import TopicTypesListResult -from ._models_py3 import TopicUpdateParameters -from ._models_py3 import TopicsConfiguration -from ._models_py3 import TopicsListResult -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateTopicSpacesConfigurationInfo -from ._models_py3 import UpdateTopicsConfigurationInfo -from ._models_py3 import UserIdentityProperties -from ._models_py3 import VerifiedPartner -from ._models_py3 import VerifiedPartnersListResult -from ._models_py3 import WebHookEventSubscriptionDestination -from ._models_py3 import WebhookPartnerDestinationInfo -from ._models_py3 import WebhookUpdatePartnerDestinationInfo +from typing import TYPE_CHECKING -from ._event_grid_management_client_enums import AdvancedFilterOperatorType -from ._event_grid_management_client_enums import AlternativeAuthenticationNameSource -from ._event_grid_management_client_enums import CaCertificateProvisioningState -from ._event_grid_management_client_enums import ChannelProvisioningState -from ._event_grid_management_client_enums import ChannelType -from ._event_grid_management_client_enums import ClientCertificateValidationScheme -from ._event_grid_management_client_enums import ClientGroupProvisioningState -from ._event_grid_management_client_enums import ClientProvisioningState -from ._event_grid_management_client_enums import ClientState -from ._event_grid_management_client_enums import CreatedByType -from ._event_grid_management_client_enums import CustomDomainIdentityType -from ._event_grid_management_client_enums import CustomDomainValidationState -from ._event_grid_management_client_enums import CustomJwtAuthenticationManagedIdentityType -from ._event_grid_management_client_enums import DataResidencyBoundary -from ._event_grid_management_client_enums import DeadLetterEndPointType -from ._event_grid_management_client_enums import DeliveryAttributeMappingType -from ._event_grid_management_client_enums import DeliveryMode -from ._event_grid_management_client_enums import DeliverySchema -from ._event_grid_management_client_enums import DomainProvisioningState -from ._event_grid_management_client_enums import DomainTopicProvisioningState -from ._event_grid_management_client_enums import EndpointType -from ._event_grid_management_client_enums import EventDefinitionKind -from ._event_grid_management_client_enums import EventDeliverySchema -from ._event_grid_management_client_enums import EventInputSchema -from ._event_grid_management_client_enums import EventSubscriptionIdentityType -from ._event_grid_management_client_enums import EventSubscriptionProvisioningState -from ._event_grid_management_client_enums import FilterOperatorType -from ._event_grid_management_client_enums import IdentityType -from ._event_grid_management_client_enums import InputSchema -from ._event_grid_management_client_enums import InputSchemaMappingType -from ._event_grid_management_client_enums import IpActionType -from ._event_grid_management_client_enums import MonitorAlertSeverity -from ._event_grid_management_client_enums import NamespaceProvisioningState -from ._event_grid_management_client_enums import NamespaceTopicProvisioningState -from ._event_grid_management_client_enums import NetworkSecurityPerimeterAssociationAccessMode -from ._event_grid_management_client_enums import NetworkSecurityPerimeterConfigProvisioningState -from ._event_grid_management_client_enums import NetworkSecurityPerimeterConfigurationIssueSeverity -from ._event_grid_management_client_enums import NetworkSecurityPerimeterConfigurationIssueType -from ._event_grid_management_client_enums import NetworkSecurityPerimeterProfileAccessRuleDirection -from ._event_grid_management_client_enums import NetworkSecurityPerimeterResourceType -from ._event_grid_management_client_enums import PartnerClientAuthenticationType -from ._event_grid_management_client_enums import PartnerConfigurationProvisioningState -from ._event_grid_management_client_enums import PartnerDestinationActivationState -from ._event_grid_management_client_enums import PartnerDestinationProvisioningState -from ._event_grid_management_client_enums import PartnerEndpointType -from ._event_grid_management_client_enums import PartnerNamespaceProvisioningState -from ._event_grid_management_client_enums import PartnerRegistrationProvisioningState -from ._event_grid_management_client_enums import PartnerTopicActivationState -from ._event_grid_management_client_enums import PartnerTopicProvisioningState -from ._event_grid_management_client_enums import PartnerTopicRoutingMode -from ._event_grid_management_client_enums import PermissionBindingProvisioningState -from ._event_grid_management_client_enums import PermissionType -from ._event_grid_management_client_enums import PersistedConnectionStatus -from ._event_grid_management_client_enums import PrivateEndpointConnectionsParentType -from ._event_grid_management_client_enums import PublicNetworkAccess -from ._event_grid_management_client_enums import PublisherType -from ._event_grid_management_client_enums import ReadinessState -from ._event_grid_management_client_enums import ResourceKind -from ._event_grid_management_client_enums import ResourceProvisioningState -from ._event_grid_management_client_enums import ResourceRegionType -from ._event_grid_management_client_enums import RoutingIdentityType -from ._event_grid_management_client_enums import Sku -from ._event_grid_management_client_enums import SkuName -from ._event_grid_management_client_enums import StaticRoutingEnrichmentType -from ._event_grid_management_client_enums import SubscriptionProvisioningState -from ._event_grid_management_client_enums import TlsVersion -from ._event_grid_management_client_enums import TopicProvisioningState -from ._event_grid_management_client_enums import TopicSpaceProvisioningState -from ._event_grid_management_client_enums import TopicSpacesConfigurationState -from ._event_grid_management_client_enums import TopicTypeProvisioningState -from ._event_grid_management_client_enums import TopicTypeSourceScope -from ._event_grid_management_client_enums import VerifiedPartnerProvisioningState +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AdvancedFilter, + AzureFunctionEventSubscriptionDestination, + BoolEqualsAdvancedFilter, + BoolEqualsFilter, + CaCertificate, + CaCertificatesListResult, + Channel, + ChannelUpdateParameters, + ChannelsListResult, + Client, + ClientCertificateAuthentication, + ClientGroup, + ClientGroupsListResult, + ClientsListResult, + ConnectionState, + CustomDomainConfiguration, + CustomDomainIdentity, + CustomDomainOwnershipValidationResult, + DeadLetterDestination, + DeadLetterWithResourceIdentity, + DeliveryAttributeListResult, + DeliveryAttributeMapping, + DeliveryConfiguration, + DeliveryWithResourceIdentity, + Domain, + DomainRegenerateKeyRequest, + DomainSharedAccessKeys, + DomainTopic, + DomainTopicsListResult, + DomainUpdateParameters, + DomainsListResult, + DynamicDeliveryAttributeMapping, + DynamicRoutingEnrichment, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + EventHubEventSubscriptionDestination, + EventSubscription, + EventSubscriptionDestination, + EventSubscriptionFilter, + EventSubscriptionFullUrl, + EventSubscriptionIdentity, + EventSubscriptionUpdateParameters, + EventSubscriptionsListResult, + EventType, + EventTypeInfo, + EventTypesListResult, + ExtensionTopic, + Filter, + FiltersConfiguration, + HybridConnectionEventSubscriptionDestination, + IdentityInfo, + InboundIpRule, + InlineEventProperties, + InputSchemaMapping, + IsNotNullAdvancedFilter, + IsNotNullFilter, + IsNullOrUndefinedAdvancedFilter, + IsNullOrUndefinedFilter, + JsonField, + JsonFieldWithDefault, + JsonInputSchemaMapping, + MonitorAlertEventSubscriptionDestination, + Namespace, + NamespaceRegenerateKeyRequest, + NamespaceSharedAccessKeys, + NamespaceSku, + NamespaceTopic, + NamespaceTopicEventSubscriptionDestination, + NamespaceTopicUpdateParameters, + NamespaceTopicsListResult, + NamespaceUpdateParameters, + NamespacesListResult, + NumberGreaterThanAdvancedFilter, + NumberGreaterThanFilter, + NumberGreaterThanOrEqualsAdvancedFilter, + NumberGreaterThanOrEqualsFilter, + NumberInAdvancedFilter, + NumberInFilter, + NumberInRangeAdvancedFilter, + NumberInRangeFilter, + NumberLessThanAdvancedFilter, + NumberLessThanFilter, + NumberLessThanOrEqualsAdvancedFilter, + NumberLessThanOrEqualsFilter, + NumberNotInAdvancedFilter, + NumberNotInFilter, + NumberNotInRangeAdvancedFilter, + NumberNotInRangeFilter, + Operation, + OperationInfo, + OperationsListResult, + Partner, + PartnerAuthorization, + PartnerConfiguration, + PartnerConfigurationUpdateParameters, + PartnerConfigurationsListResult, + PartnerDetails, + PartnerNamespace, + PartnerNamespaceRegenerateKeyRequest, + PartnerNamespaceSharedAccessKeys, + PartnerNamespaceUpdateParameters, + PartnerNamespacesListResult, + PartnerRegistration, + PartnerRegistrationUpdateParameters, + PartnerRegistrationsListResult, + PartnerTopic, + PartnerTopicInfo, + PartnerTopicUpdateParameters, + PartnerTopicsListResult, + PartnerUpdateTopicInfo, + PermissionBinding, + PermissionBindingsListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourcesListResult, + PushInfo, + QueueInfo, + Resource, + RetryPolicy, + RoutingEnrichments, + RoutingIdentityInfo, + ServiceBusQueueEventSubscriptionDestination, + ServiceBusTopicEventSubscriptionDestination, + StaticDeliveryAttributeMapping, + StaticRoutingEnrichment, + StaticStringRoutingEnrichment, + StorageBlobDeadLetterDestination, + StorageQueueEventSubscriptionDestination, + StringBeginsWithAdvancedFilter, + StringBeginsWithFilter, + StringContainsAdvancedFilter, + StringContainsFilter, + StringEndsWithAdvancedFilter, + StringEndsWithFilter, + StringInAdvancedFilter, + StringInFilter, + StringNotBeginsWithAdvancedFilter, + StringNotBeginsWithFilter, + StringNotContainsAdvancedFilter, + StringNotContainsFilter, + StringNotEndsWithAdvancedFilter, + StringNotEndsWithFilter, + StringNotInAdvancedFilter, + StringNotInFilter, + Subscription, + SubscriptionFullUrl, + SubscriptionUpdateParameters, + SubscriptionsListResult, + SystemData, + SystemTopic, + SystemTopicUpdateParameters, + SystemTopicsListResult, + Topic, + TopicRegenerateKeyRequest, + TopicSharedAccessKeys, + TopicSpace, + TopicSpacesConfiguration, + TopicSpacesListResult, + TopicTypeAdditionalEnforcedPermission, + TopicTypeInfo, + TopicTypesListResult, + TopicUpdateParameters, + TopicsConfiguration, + TopicsListResult, + TrackedResource, + UpdateTopicSpacesConfigurationInfo, + UpdateTopicsConfigurationInfo, + UserIdentityProperties, + VerifiedPartner, + VerifiedPartnersListResult, + WebHookEventSubscriptionDestination, +) + +from ._event_grid_management_client_enums import ( # type: ignore + AdvancedFilterOperatorType, + CaCertificateProvisioningState, + ChannelProvisioningState, + ChannelType, + ClientCertificateValidationScheme, + ClientGroupProvisioningState, + ClientProvisioningState, + ClientState, + CreatedByType, + CustomDomainIdentityType, + CustomDomainValidationState, + DataResidencyBoundary, + DeadLetterEndPointType, + DeliveryAttributeMappingType, + DeliveryMode, + DeliverySchema, + DomainProvisioningState, + DomainTopicProvisioningState, + EndpointType, + EventDefinitionKind, + EventDeliverySchema, + EventInputSchema, + EventSubscriptionIdentityType, + EventSubscriptionProvisioningState, + FilterOperatorType, + IdentityType, + InputSchema, + InputSchemaMappingType, + IpActionType, + MonitorAlertSeverity, + NamespaceProvisioningState, + NamespaceTopicProvisioningState, + PartnerConfigurationProvisioningState, + PartnerNamespaceProvisioningState, + PartnerRegistrationProvisioningState, + PartnerTopicActivationState, + PartnerTopicProvisioningState, + PartnerTopicRoutingMode, + PermissionBindingProvisioningState, + PermissionType, + PersistedConnectionStatus, + PrivateEndpointConnectionsParentType, + PublicNetworkAccess, + PublisherType, + ReadinessState, + ResourceProvisioningState, + ResourceRegionType, + RoutingIdentityType, + SkuName, + StaticRoutingEnrichmentType, + SubscriptionProvisioningState, + TlsVersion, + TopicProvisioningState, + TopicSpaceProvisioningState, + TopicSpacesConfigurationState, + TopicTypeProvisioningState, + TopicTypeSourceScope, + VerifiedPartnerProvisioningState, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "AdvancedFilter", - "AzureADPartnerClientAuthentication", "AzureFunctionEventSubscriptionDestination", "BoolEqualsAdvancedFilter", "BoolEqualsFilter", @@ -294,7 +265,6 @@ "ChannelUpdateParameters", "ChannelsListResult", "Client", - "ClientAuthenticationSettings", "ClientCertificateAuthentication", "ClientGroup", "ClientGroupsListResult", @@ -303,8 +273,6 @@ "CustomDomainConfiguration", "CustomDomainIdentity", "CustomDomainOwnershipValidationResult", - "CustomJwtAuthenticationManagedIdentity", - "CustomJwtAuthenticationSettings", "DeadLetterDestination", "DeadLetterWithResourceIdentity", "DeliveryAttributeListResult", @@ -334,7 +302,6 @@ "EventType", "EventTypeInfo", "EventTypesListResult", - "ExtendedLocation", "ExtensionTopic", "Filter", "FiltersConfiguration", @@ -347,7 +314,6 @@ "IsNotNullFilter", "IsNullOrUndefinedAdvancedFilter", "IsNullOrUndefinedFilter", - "IssuerCertificateInfo", "JsonField", "JsonFieldWithDefault", "JsonInputSchemaMapping", @@ -362,13 +328,6 @@ "NamespaceTopicsListResult", "NamespaceUpdateParameters", "NamespacesListResult", - "NetworkSecurityPerimeterConfiguration", - "NetworkSecurityPerimeterConfigurationIssues", - "NetworkSecurityPerimeterConfigurationList", - "NetworkSecurityPerimeterConfigurationProfile", - "NetworkSecurityPerimeterInfo", - "NetworkSecurityPerimeterProfileAccessRule", - "NetworkSecurityPerimeterSubscription", "NumberGreaterThanAdvancedFilter", "NumberGreaterThanFilter", "NumberGreaterThanOrEqualsAdvancedFilter", @@ -390,16 +349,10 @@ "OperationsListResult", "Partner", "PartnerAuthorization", - "PartnerClientAuthentication", "PartnerConfiguration", "PartnerConfigurationUpdateParameters", "PartnerConfigurationsListResult", - "PartnerDestination", - "PartnerDestinationInfo", - "PartnerDestinationUpdateParameters", - "PartnerDestinationsListResult", "PartnerDetails", - "PartnerEventSubscriptionDestination", "PartnerNamespace", "PartnerNamespaceRegenerateKeyRequest", "PartnerNamespaceSharedAccessKeys", @@ -412,7 +365,6 @@ "PartnerTopicInfo", "PartnerTopicUpdateParameters", "PartnerTopicsListResult", - "PartnerUpdateDestinationInfo", "PartnerUpdateTopicInfo", "PermissionBinding", "PermissionBindingsListResult", @@ -424,9 +376,6 @@ "PushInfo", "QueueInfo", "Resource", - "ResourceAssociation", - "ResourceMoveChangeHistory", - "ResourceSku", "RetryPolicy", "RoutingEnrichments", "RoutingIdentityInfo", @@ -480,10 +429,7 @@ "VerifiedPartner", "VerifiedPartnersListResult", "WebHookEventSubscriptionDestination", - "WebhookPartnerDestinationInfo", - "WebhookUpdatePartnerDestinationInfo", "AdvancedFilterOperatorType", - "AlternativeAuthenticationNameSource", "CaCertificateProvisioningState", "ChannelProvisioningState", "ChannelType", @@ -494,7 +440,6 @@ "CreatedByType", "CustomDomainIdentityType", "CustomDomainValidationState", - "CustomJwtAuthenticationManagedIdentityType", "DataResidencyBoundary", "DeadLetterEndPointType", "DeliveryAttributeMappingType", @@ -516,17 +461,7 @@ "MonitorAlertSeverity", "NamespaceProvisioningState", "NamespaceTopicProvisioningState", - "NetworkSecurityPerimeterAssociationAccessMode", - "NetworkSecurityPerimeterConfigProvisioningState", - "NetworkSecurityPerimeterConfigurationIssueSeverity", - "NetworkSecurityPerimeterConfigurationIssueType", - "NetworkSecurityPerimeterProfileAccessRuleDirection", - "NetworkSecurityPerimeterResourceType", - "PartnerClientAuthenticationType", "PartnerConfigurationProvisioningState", - "PartnerDestinationActivationState", - "PartnerDestinationProvisioningState", - "PartnerEndpointType", "PartnerNamespaceProvisioningState", "PartnerRegistrationProvisioningState", "PartnerTopicActivationState", @@ -539,11 +474,9 @@ "PublicNetworkAccess", "PublisherType", "ReadinessState", - "ResourceKind", "ResourceProvisioningState", "ResourceRegionType", "RoutingIdentityType", - "Sku", "SkuName", "StaticRoutingEnrichmentType", "SubscriptionProvisioningState", @@ -555,5 +488,5 @@ "TopicTypeSourceScope", "VerifiedPartnerProvisioningState", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py index d33abc6908e8..13c2a00a180b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py @@ -34,18 +34,6 @@ class AdvancedFilterOperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): IS_NOT_NULL = "IsNotNull" -class AlternativeAuthenticationNameSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Alternative authentication name sources related to client authentication settings for namespace - resource. - """ - - CLIENT_CERTIFICATE_SUBJECT = "ClientCertificateSubject" - CLIENT_CERTIFICATE_DNS = "ClientCertificateDns" - CLIENT_CERTIFICATE_URI = "ClientCertificateUri" - CLIENT_CERTIFICATE_IP = "ClientCertificateIp" - CLIENT_CERTIFICATE_EMAIL = "ClientCertificateEmail" - - class CaCertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the CA Certificate resource.""" @@ -68,14 +56,12 @@ class ChannelProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" IDLE_DUE_TO_MIRRORED_PARTNER_TOPIC_DELETION = "IdleDueToMirroredPartnerTopicDeletion" - IDLE_DUE_TO_MIRRORED_PARTNER_DESTINATION_DELETION = "IdleDueToMirroredPartnerDestinationDeletion" class ChannelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the event channel which represents the direction flow of events.""" PARTNER_TOPIC = "PartnerTopic" - PARTNER_DESTINATION = "PartnerDestination" class ClientCertificateValidationScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -149,13 +135,6 @@ class CustomDomainValidationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): ERROR_RETRIEVING_DNS_RECORD = "ErrorRetrievingDnsRecord" -class CustomJwtAuthenticationManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of managed identity used. Can be either 'SystemAssigned' or 'UserAssigned'.""" - - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - - class DataResidencyBoundary(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Data Residency Boundary of the resource.""" @@ -221,7 +200,6 @@ class EndpointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_BUS_QUEUE = "ServiceBusQueue" SERVICE_BUS_TOPIC = "ServiceBusTopic" AZURE_FUNCTION = "AzureFunction" - PARTNER_DESTINATION = "PartnerDestination" MONITOR_ALERT = "MonitorAlert" NAMESPACE_TOPIC = "NamespaceTopic" @@ -365,65 +343,6 @@ class NamespaceTopicProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMe UPDATED_FAILED = "UpdatedFailed" -class NetworkSecurityPerimeterAssociationAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network security perimeter access mode.""" - - LEARNING = "Learning" - ENFORCED = "Enforced" - AUDIT = "Audit" - - -class NetworkSecurityPerimeterConfigProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state to reflect configuration state and indicate status of nsp profile - configuration retrieval. - """ - - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - DELETED = "Deleted" - ACCEPTED = "Accepted" - - -class NetworkSecurityPerimeterConfigurationIssueSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning issue severity.""" - - WARNING = "Warning" - ERROR = "Error" - - -class NetworkSecurityPerimeterConfigurationIssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning issue type.""" - - MISSING_PERIMETER_CONFIGURATION = "MissingPerimeterConfiguration" - MISSING_IDENTITY_CONFIGURATION = "MissingIdentityConfiguration" - CONFIGURATION_PROPAGATION_FAILURE = "ConfigurationPropagationFailure" - OTHER = "Other" - - -class NetworkSecurityPerimeterProfileAccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """NSP access rule direction.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class NetworkSecurityPerimeterResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """NetworkSecurityPerimeterResourceType.""" - - TOPICS = "topics" - DOMAINS = "domains" - - -class PartnerClientAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of client authentication.""" - - AZURE_AD = "AzureAD" - - class PartnerConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the partner configuration.""" @@ -435,31 +354,6 @@ class PartnerConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitive FAILED = "Failed" -class PartnerDestinationActivationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Activation state of the partner destination.""" - - NEVER_ACTIVATED = "NeverActivated" - ACTIVATED = "Activated" - - -class PartnerDestinationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the partner destination.""" - - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - IDLE_DUE_TO_MIRRORED_CHANNEL_RESOURCE_DELETION = "IdleDueToMirroredChannelResourceDeletion" - - -class PartnerEndpointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the endpoint for the partner destination.""" - - WEB_HOOK = "WebHook" - - class PartnerNamespaceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the partner namespace.""" @@ -559,7 +453,6 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENABLED = "Enabled" DISABLED = "Disabled" - SECURED_BY_PERIMETER = "SecuredByPerimeter" class PublisherType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -575,13 +468,6 @@ class ReadinessState(str, Enum, metaclass=CaseInsensitiveEnumMeta): ACTIVATED = "Activated" -class ResourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Kind of the resource.""" - - AZURE = "Azure" - AZURE_ARC = "AzureArc" - - class ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Private Endpoint Connection.""" @@ -608,13 +494,6 @@ class RoutingIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" -class Sku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Sku name of the resource. The possible values are: Basic or Premium.""" - - BASIC = "Basic" - PREMIUM = "Premium" - - class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the SKU.""" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py index 18ca516aae10..d3f712e52b28 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # 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. @@ -16,10 +16,9 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -95,101 +94,21 @@ def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: self.key = key -class PartnerClientAuthentication(_serialization.Model): - """Partner client authentication. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureADPartnerClientAuthentication - - All required parameters must be populated in order to send to server. - - :ivar client_authentication_type: Type of client authentication. "AzureAD" - :vartype client_authentication_type: str or - ~azure.mgmt.eventgrid.models.PartnerClientAuthenticationType - """ - - _validation = { - "client_authentication_type": {"required": True}, - } - - _attribute_map = { - "client_authentication_type": {"key": "clientAuthenticationType", "type": "str"}, - } - - _subtype_map = {"client_authentication_type": {"AzureAD": "AzureADPartnerClientAuthentication"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.client_authentication_type: Optional[str] = None - - -class AzureADPartnerClientAuthentication(PartnerClientAuthentication): - """Azure Active Directory Partner Client Authentication. - - All required parameters must be populated in order to send to server. - - :ivar client_authentication_type: Type of client authentication. "AzureAD" - :vartype client_authentication_type: str or - ~azure.mgmt.eventgrid.models.PartnerClientAuthenticationType - :ivar azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access - token that will be included as the bearer token in delivery requests. - :vartype azure_active_directory_tenant_id: str - :ivar azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID - or URI to get the access token that will be included as the bearer token in delivery requests. - :vartype azure_active_directory_application_id_or_uri: str - """ - - _validation = { - "client_authentication_type": {"required": True}, - } - - _attribute_map = { - "client_authentication_type": {"key": "clientAuthenticationType", "type": "str"}, - "azure_active_directory_tenant_id": {"key": "properties.azureActiveDirectoryTenantId", "type": "str"}, - "azure_active_directory_application_id_or_uri": { - "key": "properties.azureActiveDirectoryApplicationIdOrUri", - "type": "str", - }, - } - - def __init__( - self, - *, - azure_active_directory_tenant_id: Optional[str] = None, - azure_active_directory_application_id_or_uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the - access token that will be included as the bearer token in delivery requests. - :paramtype azure_active_directory_tenant_id: str - :keyword azure_active_directory_application_id_or_uri: The Azure Active Directory Application - ID or URI to get the access token that will be included as the bearer token in delivery - requests. - :paramtype azure_active_directory_application_id_or_uri: str - """ - super().__init__(**kwargs) - self.client_authentication_type: str = "AzureAD" - self.azure_active_directory_tenant_id = azure_active_directory_tenant_id - self.azure_active_directory_application_id_or_uri = azure_active_directory_application_id_or_uri - - class EventSubscriptionDestination(_serialization.Model): """Information about the destination for an event subscription. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureFunctionEventSubscriptionDestination, EventHubEventSubscriptionDestination, HybridConnectionEventSubscriptionDestination, MonitorAlertEventSubscriptionDestination, - NamespaceTopicEventSubscriptionDestination, PartnerEventSubscriptionDestination, - ServiceBusQueueEventSubscriptionDestination, ServiceBusTopicEventSubscriptionDestination, - StorageQueueEventSubscriptionDestination, WebHookEventSubscriptionDestination + NamespaceTopicEventSubscriptionDestination, ServiceBusQueueEventSubscriptionDestination, + ServiceBusTopicEventSubscriptionDestination, StorageQueueEventSubscriptionDestination, + WebHookEventSubscriptionDestination All required parameters must be populated in order to send to server. :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType """ @@ -208,7 +127,6 @@ class EventSubscriptionDestination(_serialization.Model): "HybridConnection": "HybridConnectionEventSubscriptionDestination", "MonitorAlert": "MonitorAlertEventSubscriptionDestination", "NamespaceTopic": "NamespaceTopicEventSubscriptionDestination", - "PartnerDestination": "PartnerEventSubscriptionDestination", "ServiceBusQueue": "ServiceBusQueueEventSubscriptionDestination", "ServiceBusTopic": "ServiceBusTopicEventSubscriptionDestination", "StorageQueue": "StorageQueueEventSubscriptionDestination", @@ -229,7 +147,7 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. @@ -330,8 +248,8 @@ def __init__(self, *, key: Optional[str] = None, value: Optional[bool] = None, * class Filter(_serialization.Model): """This is the base type that represents a filter. To configure a filter, do not directly instantiate an object of this class. Instead, instantiate - an object of a derived class such as BoolEqualsFilter, NumberInFilter, StringEqualsFilter etc - depending on the type of the key based on + an object of a derived class such as BoolEqualsFilter, NumberInFilter etc depending on the type + of the key based on which you want to filter. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -481,7 +399,7 @@ class CaCertificate(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to the CaCertificate resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar description: Description for the CA Certificate resource. :vartype description: str @@ -565,7 +483,7 @@ def __init__( self.next_link = next_link -class Channel(Resource): # pylint: disable=too-many-instance-attributes +class Channel(Resource): """Channel info. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,24 +494,20 @@ class Channel(Resource): # pylint: disable=too-many-instance-attributes :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to Channel resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar channel_type: The type of the event channel which represents the direction flow of - events. Known values are: "PartnerTopic" and "PartnerDestination". + events. "PartnerTopic" :vartype channel_type: str or ~azure.mgmt.eventgrid.models.ChannelType :ivar partner_topic_info: This property should be populated when channelType is PartnerTopic and represents information about the partner topic resource corresponding to the channel. :vartype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerTopicInfo - :ivar partner_destination_info: This property should be populated when channelType is - PartnerDestination and represents information about the partner destination resource - corresponding to the channel. - :vartype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerDestinationInfo :ivar message_for_activation: Context or helpful message that can be used during the approval process by the subscriber. :vartype message_for_activation: str :ivar provisioning_state: Provisioning state of the channel. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Canceled", "Failed", - "IdleDueToMirroredPartnerTopicDeletion", and "IdleDueToMirroredPartnerDestinationDeletion". + "Updating", "Deleting", "Succeeded", "Canceled", "Failed", and + "IdleDueToMirroredPartnerTopicDeletion". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ChannelProvisioningState :ivar readiness_state: The readiness state of the corresponding partner topic. Known values are: "NeverActivated" and "Activated". @@ -618,7 +532,6 @@ class Channel(Resource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "channel_type": {"key": "properties.channelType", "type": "str"}, "partner_topic_info": {"key": "properties.partnerTopicInfo", "type": "PartnerTopicInfo"}, - "partner_destination_info": {"key": "properties.partnerDestinationInfo", "type": "PartnerDestinationInfo"}, "message_for_activation": {"key": "properties.messageForActivation", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "readiness_state": {"key": "properties.readinessState", "type": "str"}, @@ -633,7 +546,6 @@ def __init__( *, channel_type: Optional[Union[str, "_models.ChannelType"]] = None, partner_topic_info: Optional["_models.PartnerTopicInfo"] = None, - partner_destination_info: Optional["_models.PartnerDestinationInfo"] = None, message_for_activation: Optional[str] = None, provisioning_state: Optional[Union[str, "_models.ChannelProvisioningState"]] = None, readiness_state: Optional[Union[str, "_models.ReadinessState"]] = None, @@ -642,21 +554,17 @@ def __init__( ) -> None: """ :keyword channel_type: The type of the event channel which represents the direction flow of - events. Known values are: "PartnerTopic" and "PartnerDestination". + events. "PartnerTopic" :paramtype channel_type: str or ~azure.mgmt.eventgrid.models.ChannelType :keyword partner_topic_info: This property should be populated when channelType is PartnerTopic and represents information about the partner topic resource corresponding to the channel. :paramtype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerTopicInfo - :keyword partner_destination_info: This property should be populated when channelType is - PartnerDestination and represents information about the partner destination resource - corresponding to the channel. - :paramtype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerDestinationInfo :keyword message_for_activation: Context or helpful message that can be used during the approval process by the subscriber. :paramtype message_for_activation: str :keyword provisioning_state: Provisioning state of the channel. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Canceled", "Failed", - "IdleDueToMirroredPartnerTopicDeletion", and "IdleDueToMirroredPartnerDestinationDeletion". + "Updating", "Deleting", "Succeeded", "Canceled", "Failed", and + "IdleDueToMirroredPartnerTopicDeletion". :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.ChannelProvisioningState :keyword readiness_state: The readiness state of the corresponding partner topic. Known values are: "NeverActivated" and "Activated". @@ -670,7 +578,6 @@ def __init__( self.system_data = None self.channel_type = channel_type self.partner_topic_info = partner_topic_info - self.partner_destination_info = partner_destination_info self.message_for_activation = message_for_activation self.provisioning_state = provisioning_state self.readiness_state = readiness_state @@ -712,9 +619,6 @@ class ChannelUpdateParameters(_serialization.Model): expires while the corresponding partner topic or partner destination is never activated, the channel and corresponding partner topic or partner destination are deleted. :vartype expiration_time_if_not_activated_utc: ~datetime.datetime - :ivar partner_destination_info: Partner destination properties which can be updated if the - channel is of type PartnerDestination. - :vartype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerUpdateDestinationInfo :ivar partner_topic_info: Partner topic properties which can be updated if the channel is of type PartnerTopic. :vartype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerUpdateTopicInfo @@ -725,10 +629,6 @@ class ChannelUpdateParameters(_serialization.Model): "key": "properties.expirationTimeIfNotActivatedUtc", "type": "iso-8601", }, - "partner_destination_info": { - "key": "properties.partnerDestinationInfo", - "type": "PartnerUpdateDestinationInfo", - }, "partner_topic_info": {"key": "properties.partnerTopicInfo", "type": "PartnerUpdateTopicInfo"}, } @@ -736,7 +636,6 @@ def __init__( self, *, expiration_time_if_not_activated_utc: Optional[datetime.datetime] = None, - partner_destination_info: Optional["_models.PartnerUpdateDestinationInfo"] = None, partner_topic_info: Optional["_models.PartnerUpdateTopicInfo"] = None, **kwargs: Any ) -> None: @@ -745,16 +644,12 @@ def __init__( expires while the corresponding partner topic or partner destination is never activated, the channel and corresponding partner topic or partner destination are deleted. :paramtype expiration_time_if_not_activated_utc: ~datetime.datetime - :keyword partner_destination_info: Partner destination properties which can be updated if the - channel is of type PartnerDestination. - :paramtype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerUpdateDestinationInfo :keyword partner_topic_info: Partner topic properties which can be updated if the channel is of type PartnerTopic. :paramtype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerUpdateTopicInfo """ super().__init__(**kwargs) self.expiration_time_if_not_activated_utc = expiration_time_if_not_activated_utc - self.partner_destination_info = partner_destination_info self.partner_topic_info = partner_topic_info @@ -769,7 +664,7 @@ class Client(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to the Client resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar description: Description for the Client resource. :vartype description: str @@ -853,46 +748,6 @@ def __init__( self.provisioning_state = None -class ClientAuthenticationSettings(_serialization.Model): - """Client authentication settings for namespace resource. - - :ivar alternative_authentication_name_sources: Alternative authentication name sources related - to client authentication settings for namespace resource. - :vartype alternative_authentication_name_sources: list[str or - ~azure.mgmt.eventgrid.models.AlternativeAuthenticationNameSource] - :ivar custom_jwt_authentication: Custom JWT authentication settings for namespace resource. - :vartype custom_jwt_authentication: - ~azure.mgmt.eventgrid.models.CustomJwtAuthenticationSettings - """ - - _attribute_map = { - "alternative_authentication_name_sources": {"key": "alternativeAuthenticationNameSources", "type": "[str]"}, - "custom_jwt_authentication": {"key": "customJwtAuthentication", "type": "CustomJwtAuthenticationSettings"}, - } - - def __init__( - self, - *, - alternative_authentication_name_sources: Optional[ - List[Union[str, "_models.AlternativeAuthenticationNameSource"]] - ] = None, - custom_jwt_authentication: Optional["_models.CustomJwtAuthenticationSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword alternative_authentication_name_sources: Alternative authentication name sources - related to client authentication settings for namespace resource. - :paramtype alternative_authentication_name_sources: list[str or - ~azure.mgmt.eventgrid.models.AlternativeAuthenticationNameSource] - :keyword custom_jwt_authentication: Custom JWT authentication settings for namespace resource. - :paramtype custom_jwt_authentication: - ~azure.mgmt.eventgrid.models.CustomJwtAuthenticationSettings - """ - super().__init__(**kwargs) - self.alternative_authentication_name_sources = alternative_authentication_name_sources - self.custom_jwt_authentication = custom_jwt_authentication - - class ClientCertificateAuthentication(_serialization.Model): """The certificate authentication properties for the client. @@ -947,7 +802,7 @@ class ClientGroup(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to the ClientGroup resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar description: Description for the Client Group resource. :vartype description: str @@ -1269,80 +1124,6 @@ def __init__( self.custom_domains_for_topic_spaces_configuration = custom_domains_for_topic_spaces_configuration -class CustomJwtAuthenticationManagedIdentity(_serialization.Model): - """The identity information for retrieving the certificate for custom JWT authentication. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of managed identity used. Can be either 'SystemAssigned' or - 'UserAssigned'. Required. Known values are: "SystemAssigned" and "UserAssigned". - :vartype type: str or ~azure.mgmt.eventgrid.models.CustomJwtAuthenticationManagedIdentityType - :ivar user_assigned_identity: The user identity associated with the resource. - :vartype user_assigned_identity: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.CustomJwtAuthenticationManagedIdentityType"], - user_assigned_identity: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of managed identity used. Can be either 'SystemAssigned' or - 'UserAssigned'. Required. Known values are: "SystemAssigned" and "UserAssigned". - :paramtype type: str or ~azure.mgmt.eventgrid.models.CustomJwtAuthenticationManagedIdentityType - :keyword user_assigned_identity: The user identity associated with the resource. - :paramtype user_assigned_identity: str - """ - super().__init__(**kwargs) - self.type = type - self.user_assigned_identity = user_assigned_identity - - -class CustomJwtAuthenticationSettings(_serialization.Model): - """Custom JWT authentication settings for namespace resource. - - :ivar token_issuer: Expected JWT token issuer. - :vartype token_issuer: str - :ivar issuer_certificates: Information about the certificate that is used for token validation. - We currently support maximum 2 certificates. - :vartype issuer_certificates: list[~azure.mgmt.eventgrid.models.IssuerCertificateInfo] - """ - - _attribute_map = { - "token_issuer": {"key": "tokenIssuer", "type": "str"}, - "issuer_certificates": {"key": "issuerCertificates", "type": "[IssuerCertificateInfo]"}, - } - - def __init__( - self, - *, - token_issuer: Optional[str] = None, - issuer_certificates: Optional[List["_models.IssuerCertificateInfo"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword token_issuer: Expected JWT token issuer. - :paramtype token_issuer: str - :keyword issuer_certificates: Information about the certificate that is used for token - validation. We currently support maximum 2 certificates. - :paramtype issuer_certificates: list[~azure.mgmt.eventgrid.models.IssuerCertificateInfo] - """ - super().__init__(**kwargs) - self.token_issuer = token_issuer - self.issuer_certificates = issuer_certificates - - class DeadLetterDestination(_serialization.Model): """Information about the dead letter destination for an event subscription. To configure a deadletter destination, do not directly instantiate an object of this class. Instead, @@ -1598,7 +1379,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.tags = tags -class Domain(TrackedResource): # pylint: disable=too-many-instance-attributes +class Domain(TrackedResource): """EventGrid Domain. Variables are only populated by the server, and will be ignored when sending a request. @@ -1615,11 +1396,9 @@ class Domain(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype location: str :ivar tags: Tags of the resource. :vartype tags: dict[str, str] - :ivar sku: The Sku pricing tier for the Event Grid Domain resource. - :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar identity: Identity information for the Event Grid Domain resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar system_data: The system metadata relating to the Event Grid Domain resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: @@ -1650,7 +1429,7 @@ class Domain(TrackedResource): # pylint: disable=too-many-instance-attributes default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -1712,7 +1491,6 @@ class Domain(TrackedResource): # pylint: disable=too-many-instance-attributes "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "ResourceSku"}, "identity": {"key": "identity", "type": "IdentityInfo"}, "system_data": {"key": "systemData", "type": "SystemData"}, "private_endpoint_connections": { @@ -1745,7 +1523,6 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.ResourceSku"] = None, identity: Optional["_models.IdentityInfo"] = None, minimum_tls_version_allowed: Optional[Union[str, "_models.TlsVersion"]] = None, input_schema: Optional[Union[str, "_models.InputSchema"]] = None, @@ -1764,8 +1541,6 @@ def __init__( :paramtype location: str :keyword tags: Tags of the resource. :paramtype tags: dict[str, str] - :keyword sku: The Sku pricing tier for the Event Grid Domain resource. - :paramtype sku: ~azure.mgmt.eventgrid.models.ResourceSku :keyword identity: Identity information for the Event Grid Domain resource. :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :keyword minimum_tls_version_allowed: Minimum TLS version of the publisher allowed to publish @@ -1786,7 +1561,7 @@ def __init__( default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -1830,7 +1605,6 @@ def __init__( :paramtype data_residency_boundary: str or ~azure.mgmt.eventgrid.models.DataResidencyBoundary """ super().__init__(location=location, tags=tags, **kwargs) - self.sku = sku self.identity = identity self.system_data = None self.private_endpoint_connections = None @@ -1940,7 +1714,7 @@ class DomainTopic(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to Domain Topic resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar provisioning_state: Provisioning state of the domain topic. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". @@ -1998,20 +1772,18 @@ def __init__( self.next_link = next_link -class DomainUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DomainUpdateParameters(_serialization.Model): """Properties of the Domain update. :ivar tags: Tags of the domains resource. :vartype tags: dict[str, str] :ivar identity: Identity information for the resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar sku: The Sku pricing tier for the domain. - :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -2063,7 +1835,6 @@ class DomainUpdateParameters(_serialization.Model): # pylint: disable=too-many- _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "IdentityInfo"}, - "sku": {"key": "sku", "type": "ResourceSku"}, "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "inbound_ip_rules": {"key": "properties.inboundIpRules", "type": "[InboundIpRule]"}, "minimum_tls_version_allowed": {"key": "properties.minimumTlsVersionAllowed", "type": "str"}, @@ -2085,7 +1856,6 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.IdentityInfo"] = None, - sku: Optional["_models.ResourceSku"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, inbound_ip_rules: Optional[List["_models.InboundIpRule"]] = None, minimum_tls_version_allowed: Optional[Union[str, "_models.TlsVersion"]] = None, @@ -2101,13 +1871,11 @@ def __init__( :paramtype tags: dict[str, str] :keyword identity: Identity information for the resource. :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword sku: The Sku pricing tier for the domain. - :paramtype sku: ~azure.mgmt.eventgrid.models.ResourceSku :keyword public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -2158,7 +1926,6 @@ def __init__( super().__init__(**kwargs) self.tags = tags self.identity = identity - self.sku = sku self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules self.minimum_tls_version_allowed = minimum_tls_version_allowed @@ -2330,7 +2097,7 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. @@ -2374,7 +2141,7 @@ def __init__( self.delivery_attribute_mappings = delivery_attribute_mappings -class EventSubscription(Resource): # pylint: disable=too-many-instance-attributes +class EventSubscription(Resource): """Event Subscription. Variables are only populated by the server, and will be ignored when sending a request. @@ -2385,7 +2152,7 @@ class EventSubscription(Resource): # pylint: disable=too-many-instance-attribut :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to Event Subscription resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar topic: Name of the topic of the event subscription. :vartype topic: str @@ -2836,7 +2603,7 @@ class EventType(Resource): :vartype display_name: str :ivar description: Description of the event type. :vartype description: str - :ivar schema_url: Url of the schema for this event type. + :ivar schema_url: URL of the schema for this event type. :vartype schema_url: str :ivar is_in_default_set: IsInDefaultSet flag of the event type. :vartype is_in_default_set: bool @@ -2872,7 +2639,7 @@ def __init__( :paramtype display_name: str :keyword description: Description of the event type. :paramtype description: str - :keyword schema_url: Url of the schema for this event type. + :keyword schema_url: URL of the schema for this event type. :paramtype schema_url: str :keyword is_in_default_set: IsInDefaultSet flag of the event type. :paramtype is_in_default_set: bool @@ -2944,32 +2711,6 @@ def __init__(self, *, value: Optional[List["_models.EventType"]] = None, **kwarg self.value = value -class ExtendedLocation(_serialization.Model): - """Definition of an Extended Location. - - :ivar name: Fully qualified name of the extended location. - :vartype name: str - :ivar type: Type of the extended location. - :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: Fully qualified name of the extended location. - :paramtype name: str - :keyword type: Type of the extended location. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - class ExtensionTopic(Resource): """Event grid Extension Topic. This is used for getting Event Grid related metrics for Azure resources. @@ -2982,7 +2723,7 @@ class ExtensionTopic(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to Extension Topic resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar description: Description of the extension topic. :vartype description: str @@ -3062,7 +2803,7 @@ class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination) :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource ID of an hybrid connection that is the destination of an event subscription. @@ -3410,48 +3151,6 @@ def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: self.operator_type: str = "IsNullOrUndefined" -class IssuerCertificateInfo(_serialization.Model): - """Information about the certificate that is used for token validation. - - All required parameters must be populated in order to send to server. - - :ivar certificate_url: Keyvault certificate URL in - https://keyvaultname.vault.azure.net/certificates/certificateName/certificateVersion format. - Required. - :vartype certificate_url: str - :ivar identity: The identity that will be used to access the certificate. - :vartype identity: ~azure.mgmt.eventgrid.models.CustomJwtAuthenticationManagedIdentity - """ - - _validation = { - "certificate_url": {"required": True}, - } - - _attribute_map = { - "certificate_url": {"key": "certificateUrl", "type": "str"}, - "identity": {"key": "identity", "type": "CustomJwtAuthenticationManagedIdentity"}, - } - - def __init__( - self, - *, - certificate_url: str, - identity: Optional["_models.CustomJwtAuthenticationManagedIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword certificate_url: Keyvault certificate URL in - https://keyvaultname.vault.azure.net/certificates/certificateName/certificateVersion format. - Required. - :paramtype certificate_url: str - :keyword identity: The identity that will be used to access the certificate. - :paramtype identity: ~azure.mgmt.eventgrid.models.CustomJwtAuthenticationManagedIdentity - """ - super().__init__(**kwargs) - self.certificate_url = certificate_url - self.identity = identity - - class JsonField(_serialization.Model): """This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and @@ -3594,7 +3293,7 @@ class MonitorAlertEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar severity: The severity that will be attached to every Alert fired through this event subscription. @@ -3650,7 +3349,7 @@ def __init__( self.action_groups = action_groups -class Namespace(TrackedResource): # pylint: disable=too-many-instance-attributes +class Namespace(TrackedResource): """Namespace resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3671,7 +3370,7 @@ class Namespace(TrackedResource): # pylint: disable=too-many-instance-attribute :vartype sku: ~azure.mgmt.eventgrid.models.NamespaceSku :ivar identity: Identity information for the Namespace resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar system_data: The system metadata relating to the namespace resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: @@ -3697,7 +3396,7 @@ class Namespace(TrackedResource): # pylint: disable=too-many-instance-attribute default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -3786,7 +3485,7 @@ def __init__( default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -3937,7 +3636,7 @@ class NamespaceTopic(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to namespace topic resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar provisioning_state: Provisioning state of the namespace topic. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", "Deleted", @@ -4008,7 +3707,7 @@ class NamespaceTopicEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure resource Id that represents the endpoint of the Event Grid Namespace Topic destination of an event subscription. @@ -4111,7 +3810,7 @@ class NamespaceUpdateParameters(_serialization.Model): default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -4159,7 +3858,7 @@ def __init__( default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -4175,468 +3874,66 @@ def __init__( self.inbound_ip_rules = inbound_ip_rules -class NetworkSecurityPerimeterConfiguration(Resource): - """Network security perimeter configuration. +class NumberGreaterThanAdvancedFilter(AdvancedFilter): + """NumberGreaterThan Advanced Filter. - 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 server. - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of the resource. - :vartype type: str - :ivar provisioning_state: Provisioning state to reflect configuration state and indicate status - of nsp profile configuration retrieval. Known values are: "Creating", "Updating", "Deleting", - "Succeeded", "Canceled", "Failed", "Deleted", and "Accepted". - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigProvisioningState - :ivar provisioning_issues: Provisioning issues to reflect status when attempting to retrieve - nsp profile configuration. - :vartype provisioning_issues: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationIssues] - :ivar network_security_perimeter: Perimeter info for nsp association. - :vartype network_security_perimeter: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterInfo - :ivar resource_association: Nsp association name and access mode of association. - :vartype resource_association: ~azure.mgmt.eventgrid.models.ResourceAssociation - :ivar profile: Nsp profile configuration, access rules and diagnostic settings. - :vartype profile: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationProfile + :ivar operator_type: The operator type used for filtering, e.g., NumberIn, StringContains, + BoolEquals and others. Required. Known values are: "NumberIn", "NumberNotIn", "NumberLessThan", + "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", + "StringIn", "StringNotIn", "StringBeginsWith", "StringEndsWith", "StringContains", + "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", "StringNotEndsWith", + "StringNotContains", "IsNullOrUndefined", and "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "operator_type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "provisioning_issues": { - "key": "properties.provisioningIssues", - "type": "[NetworkSecurityPerimeterConfigurationIssues]", - }, - "network_security_perimeter": { - "key": "properties.networkSecurityPerimeter", - "type": "NetworkSecurityPerimeterInfo", - }, - "resource_association": {"key": "properties.resourceAssociation", "type": "ResourceAssociation"}, - "profile": {"key": "properties.profile", "type": "NetworkSecurityPerimeterConfigurationProfile"}, + "operator_type": {"key": "operatorType", "type": "str"}, + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "float"}, } - def __init__( - self, - *, - provisioning_state: Optional[Union[str, "_models.NetworkSecurityPerimeterConfigProvisioningState"]] = None, - provisioning_issues: Optional[List["_models.NetworkSecurityPerimeterConfigurationIssues"]] = None, - network_security_perimeter: Optional["_models.NetworkSecurityPerimeterInfo"] = None, - resource_association: Optional["_models.ResourceAssociation"] = None, - profile: Optional["_models.NetworkSecurityPerimeterConfigurationProfile"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, key: Optional[str] = None, value: Optional[float] = None, **kwargs: Any) -> None: """ - :keyword provisioning_state: Provisioning state to reflect configuration state and indicate - status of nsp profile configuration retrieval. Known values are: "Creating", "Updating", - "Deleting", "Succeeded", "Canceled", "Failed", "Deleted", and "Accepted". - :paramtype provisioning_state: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigProvisioningState - :keyword provisioning_issues: Provisioning issues to reflect status when attempting to retrieve - nsp profile configuration. - :paramtype provisioning_issues: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationIssues] - :keyword network_security_perimeter: Perimeter info for nsp association. - :paramtype network_security_perimeter: - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterInfo - :keyword resource_association: Nsp association name and access mode of association. - :paramtype resource_association: ~azure.mgmt.eventgrid.models.ResourceAssociation - :keyword profile: Nsp profile configuration, access rules and diagnostic settings. - :paramtype profile: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationProfile + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float """ - super().__init__(**kwargs) - self.provisioning_state = provisioning_state - self.provisioning_issues = provisioning_issues - self.network_security_perimeter = network_security_perimeter - self.resource_association = resource_association - self.profile = profile + super().__init__(key=key, **kwargs) + self.operator_type: str = "NumberGreaterThan" + self.value = value -class NetworkSecurityPerimeterConfigurationIssues(_serialization.Model): # pylint: disable=name-too-long - """Network security perimeter configuration issues. +class NumberGreaterThanFilter(Filter): + """NumberGreaterThan Filter. + + All required parameters must be populated in order to send to server. - :ivar name: Provisioning issue name. - :vartype name: str - :ivar issue_type: Provisioning issue type. Known values are: "MissingPerimeterConfiguration", - "MissingIdentityConfiguration", "ConfigurationPropagationFailure", and "Other". - :vartype issue_type: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationIssueType - :ivar severity: Provisioning issue severity. Known values are: "Warning" and "Error". - :vartype severity: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationIssueSeverity - :ivar description: Provisioning issue description. - :vartype description: str - :ivar suggested_resource_ids: ARM IDs of resources that can be associated to the same perimeter - to remediate the issue. - :vartype suggested_resource_ids: list[str] - :ivar suggested_access_rules: Access rules that can be added to the same profile to remediate - the issue. - :vartype suggested_access_rules: list[str] + :ivar operator_type: The operator type used for filtering, e.g., NumberIn, StringContains, + BoolEquals and others. Required. Known values are: "NumberIn", "NumberNotIn", "NumberLessThan", + "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", + "StringIn", "StringNotIn", "StringBeginsWith", "StringEndsWith", "StringContains", + "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", "StringNotEndsWith", + "StringNotContains", "IsNullOrUndefined", and "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.FilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "issue_type": {"key": "properties.issueType", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "suggested_resource_ids": {"key": "properties.suggestedResourceIds", "type": "[str]"}, - "suggested_access_rules": {"key": "properties.suggestedAccessRules", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - issue_type: Optional[Union[str, "_models.NetworkSecurityPerimeterConfigurationIssueType"]] = None, - severity: Optional[Union[str, "_models.NetworkSecurityPerimeterConfigurationIssueSeverity"]] = None, - description: Optional[str] = None, - suggested_resource_ids: Optional[List[str]] = None, - suggested_access_rules: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Provisioning issue name. - :paramtype name: str - :keyword issue_type: Provisioning issue type. Known values are: - "MissingPerimeterConfiguration", "MissingIdentityConfiguration", - "ConfigurationPropagationFailure", and "Other". - :paramtype issue_type: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationIssueType - :keyword severity: Provisioning issue severity. Known values are: "Warning" and "Error". - :paramtype severity: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfigurationIssueSeverity - :keyword description: Provisioning issue description. - :paramtype description: str - :keyword suggested_resource_ids: ARM IDs of resources that can be associated to the same - perimeter to remediate the issue. - :paramtype suggested_resource_ids: list[str] - :keyword suggested_access_rules: Access rules that can be added to the same profile to - remediate the issue. - :paramtype suggested_access_rules: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.issue_type = issue_type - self.severity = severity - self.description = description - self.suggested_resource_ids = suggested_resource_ids - self.suggested_access_rules = suggested_access_rules - - -class NetworkSecurityPerimeterConfigurationList(_serialization.Model): # pylint: disable=name-too-long - """Network security perimeter configuration List. - - :ivar value: List of all network security parameter configurations. - :vartype value: list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration] - :ivar next_link: A link for the next page of Network Security Perimeter Configuration. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NetworkSecurityPerimeterConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.NetworkSecurityPerimeterConfiguration"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: List of all network security parameter configurations. - :paramtype value: list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration] - :keyword next_link: A link for the next page of Network Security Perimeter Configuration. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NetworkSecurityPerimeterConfigurationProfile(_serialization.Model): # pylint: disable=name-too-long - """Nsp configuration with profile information. - - :ivar name: Nsp configuration profile name. - :vartype name: str - :ivar access_rules_version: Access rules version number for nsp profile. - :vartype access_rules_version: str - :ivar access_rules: List of inbound or outbound access rule setup on the nsp profile. - :vartype access_rules: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterProfileAccessRule] - :ivar diagnostic_settings_version: Diagnostic settings version number for nsp profile. - :vartype diagnostic_settings_version: str - :ivar enabled_log_categories: Enabled log categories for nsp profile. - :vartype enabled_log_categories: list[str] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_rules_version": {"key": "accessRulesVersion", "type": "str"}, - "access_rules": {"key": "accessRules", "type": "[NetworkSecurityPerimeterProfileAccessRule]"}, - "diagnostic_settings_version": {"key": "diagnosticSettingsVersion", "type": "str"}, - "enabled_log_categories": {"key": "enabledLogCategories", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - access_rules_version: Optional[str] = None, - access_rules: Optional[List["_models.NetworkSecurityPerimeterProfileAccessRule"]] = None, - diagnostic_settings_version: Optional[str] = None, - enabled_log_categories: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Nsp configuration profile name. - :paramtype name: str - :keyword access_rules_version: Access rules version number for nsp profile. - :paramtype access_rules_version: str - :keyword access_rules: List of inbound or outbound access rule setup on the nsp profile. - :paramtype access_rules: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterProfileAccessRule] - :keyword diagnostic_settings_version: Diagnostic settings version number for nsp profile. - :paramtype diagnostic_settings_version: str - :keyword enabled_log_categories: Enabled log categories for nsp profile. - :paramtype enabled_log_categories: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.access_rules_version = access_rules_version - self.access_rules = access_rules - self.diagnostic_settings_version = diagnostic_settings_version - self.enabled_log_categories = enabled_log_categories - - -class NetworkSecurityPerimeterInfo(_serialization.Model): - """Network security perimeter info. - - :ivar id: Arm id for network security perimeter. - :vartype id: str - :ivar perimeter_guid: Network security perimeter guid. - :vartype perimeter_guid: str - :ivar location: Network security perimeter location. - :vartype location: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "perimeter_guid": {"key": "perimeterGuid", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - perimeter_guid: Optional[str] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Arm id for network security perimeter. - :paramtype id: str - :keyword perimeter_guid: Network security perimeter guid. - :paramtype perimeter_guid: str - :keyword location: Network security perimeter location. - :paramtype location: str - """ - super().__init__(**kwargs) - self.id = id - self.perimeter_guid = perimeter_guid - self.location = location - - -class NetworkSecurityPerimeterProfileAccessRule(_serialization.Model): # pylint: disable=name-too-long - """Network security perimeter profile access rule. - - :ivar fully_qualified_arm_id: Fully Qualified Arm id for network security perimeter profile - access rule. - :vartype fully_qualified_arm_id: str - :ivar name: Name for nsp access rule. - :vartype name: str - :ivar type: nsp access rule type. - :vartype type: str - :ivar direction: NSP access rule direction. Known values are: "Inbound" and "Outbound". - :vartype direction: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterProfileAccessRuleDirection - :ivar address_prefixes: Address prefixes. - :vartype address_prefixes: list[str] - :ivar subscriptions: List of subscriptions. - :vartype subscriptions: list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterSubscription] - :ivar network_security_perimeters: Network security perimeters. - :vartype network_security_perimeters: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterInfo] - :ivar fully_qualified_domain_names: Fully qualified domain names. - :vartype fully_qualified_domain_names: list[str] - :ivar email_addresses: List of email addresses. - :vartype email_addresses: list[str] - :ivar phone_numbers: List of phone numbers. - :vartype phone_numbers: list[str] - """ - - _attribute_map = { - "fully_qualified_arm_id": {"key": "fullyQualifiedArmId", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "direction": {"key": "properties.direction", "type": "str"}, - "address_prefixes": {"key": "properties.addressPrefixes", "type": "[str]"}, - "subscriptions": {"key": "properties.subscriptions", "type": "[NetworkSecurityPerimeterSubscription]"}, - "network_security_perimeters": { - "key": "properties.networkSecurityPerimeters", - "type": "[NetworkSecurityPerimeterInfo]", - }, - "fully_qualified_domain_names": {"key": "properties.fullyQualifiedDomainNames", "type": "[str]"}, - "email_addresses": {"key": "properties.emailAddresses", "type": "[str]"}, - "phone_numbers": {"key": "properties.phoneNumbers", "type": "[str]"}, - } - - def __init__( - self, - *, - fully_qualified_arm_id: Optional[str] = None, - name: Optional[str] = None, - type: Optional[str] = None, - direction: Optional[Union[str, "_models.NetworkSecurityPerimeterProfileAccessRuleDirection"]] = None, - address_prefixes: Optional[List[str]] = None, - subscriptions: Optional[List["_models.NetworkSecurityPerimeterSubscription"]] = None, - network_security_perimeters: Optional[List["_models.NetworkSecurityPerimeterInfo"]] = None, - fully_qualified_domain_names: Optional[List[str]] = None, - email_addresses: Optional[List[str]] = None, - phone_numbers: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword fully_qualified_arm_id: Fully Qualified Arm id for network security perimeter profile - access rule. - :paramtype fully_qualified_arm_id: str - :keyword name: Name for nsp access rule. - :paramtype name: str - :keyword type: nsp access rule type. - :paramtype type: str - :keyword direction: NSP access rule direction. Known values are: "Inbound" and "Outbound". - :paramtype direction: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterProfileAccessRuleDirection - :keyword address_prefixes: Address prefixes. - :paramtype address_prefixes: list[str] - :keyword subscriptions: List of subscriptions. - :paramtype subscriptions: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterSubscription] - :keyword network_security_perimeters: Network security perimeters. - :paramtype network_security_perimeters: - list[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterInfo] - :keyword fully_qualified_domain_names: Fully qualified domain names. - :paramtype fully_qualified_domain_names: list[str] - :keyword email_addresses: List of email addresses. - :paramtype email_addresses: list[str] - :keyword phone_numbers: List of phone numbers. - :paramtype phone_numbers: list[str] - """ - super().__init__(**kwargs) - self.fully_qualified_arm_id = fully_qualified_arm_id - self.name = name - self.type = type - self.direction = direction - self.address_prefixes = address_prefixes - self.subscriptions = subscriptions - self.network_security_perimeters = network_security_perimeters - self.fully_qualified_domain_names = fully_qualified_domain_names - self.email_addresses = email_addresses - self.phone_numbers = phone_numbers - - -class NetworkSecurityPerimeterSubscription(_serialization.Model): - """Network security perimeter subscription inbound access rule. - - :ivar id: Subscription 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: Subscription id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class NumberGreaterThanAdvancedFilter(AdvancedFilter): - """NumberGreaterThan Advanced Filter. - - All required parameters must be populated in order to send to server. - - :ivar operator_type: The operator type used for filtering, e.g., NumberIn, StringContains, - BoolEquals and others. Required. Known values are: "NumberIn", "NumberNotIn", "NumberLessThan", - "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", - "StringIn", "StringNotIn", "StringBeginsWith", "StringEndsWith", "StringContains", - "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", "StringNotEndsWith", - "StringNotContains", "IsNullOrUndefined", and "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The filter value. - :vartype value: float - """ - - _validation = { - "operator_type": {"required": True}, - } - - _attribute_map = { - "operator_type": {"key": "operatorType", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "float"}, - } - - def __init__(self, *, key: Optional[str] = None, value: Optional[float] = None, **kwargs: Any) -> None: - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword value: The filter value. - :paramtype value: float - """ - super().__init__(key=key, **kwargs) - self.operator_type: str = "NumberGreaterThan" - self.value = value - - -class NumberGreaterThanFilter(Filter): - """NumberGreaterThan Filter. - - All required parameters must be populated in order to send to server. - - :ivar operator_type: The operator type used for filtering, e.g., NumberIn, StringContains, - BoolEquals and others. Required. Known values are: "NumberIn", "NumberNotIn", "NumberLessThan", - "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", - "StringIn", "StringNotIn", "StringBeginsWith", "StringEndsWith", "StringContains", - "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", "StringNotEndsWith", - "StringNotContains", "IsNullOrUndefined", and "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.FilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The filter value. - :vartype value: float - """ - - _validation = { - "operator_type": {"required": True}, + _validation = { + "operator_type": {"required": True}, } _attribute_map = { @@ -5438,7 +4735,7 @@ class PartnerConfiguration(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to partner configuration resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar location: Location of the resource. :vartype location: str @@ -5473,324 +4770,57 @@ class PartnerConfiguration(Resource): def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - partner_authorization: Optional["_models.PartnerAuthorization"] = None, - provisioning_state: Optional[Union[str, "_models.PartnerConfigurationProvisioningState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Location of the resource. - :paramtype location: str - :keyword tags: Tags of the resource. - :paramtype tags: dict[str, str] - :keyword partner_authorization: The details of authorized partners. - :paramtype partner_authorization: ~azure.mgmt.eventgrid.models.PartnerAuthorization - :keyword provisioning_state: Provisioning state of the partner configuration. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". - :paramtype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerConfigurationProvisioningState - """ - super().__init__(**kwargs) - self.system_data = None - self.location = location - self.tags = tags - self.partner_authorization = partner_authorization - self.provisioning_state = provisioning_state - - -class PartnerConfigurationsListResult(_serialization.Model): - """Result of the List partner configurations operation. - - :ivar value: A collection of partner configurations. - :vartype value: list[~azure.mgmt.eventgrid.models.PartnerConfiguration] - :ivar next_link: A link for the next page of partner configurations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PartnerConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PartnerConfiguration"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: A collection of partner configurations. - :paramtype value: list[~azure.mgmt.eventgrid.models.PartnerConfiguration] - :keyword next_link: A link for the next page of partner configurations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PartnerConfigurationUpdateParameters(_serialization.Model): - """Properties of the partner configuration update. - - :ivar tags: Tags of the partner configuration resource. - :vartype tags: dict[str, str] - :ivar default_maximum_expiration_time_in_days: The default time used to validate the maximum - expiration time for each authorized partners in days. Allowed values ar between 1 and 365 days. - :vartype default_maximum_expiration_time_in_days: int - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "default_maximum_expiration_time_in_days": { - "key": "properties.defaultMaximumExpirationTimeInDays", - "type": "int", - }, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - default_maximum_expiration_time_in_days: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Tags of the partner configuration resource. - :paramtype tags: dict[str, str] - :keyword default_maximum_expiration_time_in_days: The default time used to validate the maximum - expiration time for each authorized partners in days. Allowed values ar between 1 and 365 days. - :paramtype default_maximum_expiration_time_in_days: int - """ - super().__init__(**kwargs) - self.tags = tags - self.default_maximum_expiration_time_in_days = default_maximum_expiration_time_in_days - - -class PartnerDestination(TrackedResource): # pylint: disable=too-many-instance-attributes - """Event Grid Partner Destination. - - 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 server. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of the resource. - :vartype type: str - :ivar location: Location of the resource. Required. - :vartype location: str - :ivar tags: Tags of the resource. - :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to Partner Destination resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :ivar partner_registration_immutable_id: The immutable Id of the corresponding partner - registration. - :vartype partner_registration_immutable_id: str - :ivar endpoint_service_context: Endpoint context associated with this partner destination. - :vartype endpoint_service_context: str - :ivar expiration_time_if_not_activated_utc: Expiration time of the partner destination. If this - timer expires and the partner destination was never activated, - the partner destination and corresponding channel are deleted. - :vartype expiration_time_if_not_activated_utc: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the partner destination. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", and - "IdleDueToMirroredChannelResourceDeletion". - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerDestinationProvisioningState - :ivar activation_state: Activation state of the partner destination. Known values are: - "NeverActivated" and "Activated". - :vartype activation_state: str or - ~azure.mgmt.eventgrid.models.PartnerDestinationActivationState - :ivar endpoint_base_url: Endpoint Base URL of the partner destination. - :vartype endpoint_base_url: str - :ivar message_for_activation: Context or helpful message that can be used during the approval - process. - :vartype message_for_activation: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "partner_registration_immutable_id": {"key": "properties.partnerRegistrationImmutableId", "type": "str"}, - "endpoint_service_context": {"key": "properties.endpointServiceContext", "type": "str"}, - "expiration_time_if_not_activated_utc": { - "key": "properties.expirationTimeIfNotActivatedUtc", - "type": "iso-8601", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "activation_state": {"key": "properties.activationState", "type": "str"}, - "endpoint_base_url": {"key": "properties.endpointBaseUrl", "type": "str"}, - "message_for_activation": {"key": "properties.messageForActivation", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - partner_registration_immutable_id: Optional[str] = None, - endpoint_service_context: Optional[str] = None, - expiration_time_if_not_activated_utc: Optional[datetime.datetime] = None, - activation_state: Optional[Union[str, "_models.PartnerDestinationActivationState"]] = None, - endpoint_base_url: Optional[str] = None, - message_for_activation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Location of the resource. Required. - :paramtype location: str - :keyword tags: Tags of the resource. - :paramtype tags: dict[str, str] - :keyword partner_registration_immutable_id: The immutable Id of the corresponding partner - registration. - :paramtype partner_registration_immutable_id: str - :keyword endpoint_service_context: Endpoint context associated with this partner destination. - :paramtype endpoint_service_context: str - :keyword expiration_time_if_not_activated_utc: Expiration time of the partner destination. If - this timer expires and the partner destination was never activated, - the partner destination and corresponding channel are deleted. - :paramtype expiration_time_if_not_activated_utc: ~datetime.datetime - :keyword activation_state: Activation state of the partner destination. Known values are: - "NeverActivated" and "Activated". - :paramtype activation_state: str or - ~azure.mgmt.eventgrid.models.PartnerDestinationActivationState - :keyword endpoint_base_url: Endpoint Base URL of the partner destination. - :paramtype endpoint_base_url: str - :keyword message_for_activation: Context or helpful message that can be used during the - approval process. - :paramtype message_for_activation: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.system_data = None - self.partner_registration_immutable_id = partner_registration_immutable_id - self.endpoint_service_context = endpoint_service_context - self.expiration_time_if_not_activated_utc = expiration_time_if_not_activated_utc - self.provisioning_state = None - self.activation_state = activation_state - self.endpoint_base_url = endpoint_base_url - self.message_for_activation = message_for_activation - - -class PartnerDestinationInfo(_serialization.Model): - """Properties of the corresponding partner destination of a Channel. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WebhookPartnerDestinationInfo - - All required parameters must be populated in order to send to server. - - :ivar azure_subscription_id: Azure subscription ID of the subscriber. The partner destination - associated with the channel will be - created under this Azure subscription. - :vartype azure_subscription_id: str - :ivar resource_group_name: Azure Resource Group of the subscriber. The partner destination - associated with the channel will be - created under this resource group. - :vartype resource_group_name: str - :ivar name: Name of the partner destination associated with the channel. - :vartype name: str - :ivar endpoint_type: Type of the endpoint for the partner destination. Required. "WebHook" - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.PartnerEndpointType - :ivar endpoint_service_context: Additional context of the partner destination endpoint. - :vartype endpoint_service_context: str - :ivar resource_move_change_history: Change history of the resource move. - :vartype resource_move_change_history: - list[~azure.mgmt.eventgrid.models.ResourceMoveChangeHistory] - """ - - _validation = { - "endpoint_type": {"required": True}, - } - - _attribute_map = { - "azure_subscription_id": {"key": "azureSubscriptionId", "type": "str"}, - "resource_group_name": {"key": "resourceGroupName", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "endpoint_type": {"key": "endpointType", "type": "str"}, - "endpoint_service_context": {"key": "endpointServiceContext", "type": "str"}, - "resource_move_change_history": {"key": "resourceMoveChangeHistory", "type": "[ResourceMoveChangeHistory]"}, - } - - _subtype_map = {"endpoint_type": {"WebHook": "WebhookPartnerDestinationInfo"}} - - def __init__( - self, - *, - azure_subscription_id: Optional[str] = None, - resource_group_name: Optional[str] = None, - name: Optional[str] = None, - endpoint_service_context: Optional[str] = None, - resource_move_change_history: Optional[List["_models.ResourceMoveChangeHistory"]] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + partner_authorization: Optional["_models.PartnerAuthorization"] = None, + provisioning_state: Optional[Union[str, "_models.PartnerConfigurationProvisioningState"]] = None, **kwargs: Any ) -> None: """ - :keyword azure_subscription_id: Azure subscription ID of the subscriber. The partner - destination associated with the channel will be - created under this Azure subscription. - :paramtype azure_subscription_id: str - :keyword resource_group_name: Azure Resource Group of the subscriber. The partner destination - associated with the channel will be - created under this resource group. - :paramtype resource_group_name: str - :keyword name: Name of the partner destination associated with the channel. - :paramtype name: str - :keyword endpoint_service_context: Additional context of the partner destination endpoint. - :paramtype endpoint_service_context: str - :keyword resource_move_change_history: Change history of the resource move. - :paramtype resource_move_change_history: - list[~azure.mgmt.eventgrid.models.ResourceMoveChangeHistory] + :keyword location: Location of the resource. + :paramtype location: str + :keyword tags: Tags of the resource. + :paramtype tags: dict[str, str] + :keyword partner_authorization: The details of authorized partners. + :paramtype partner_authorization: ~azure.mgmt.eventgrid.models.PartnerAuthorization + :keyword provisioning_state: Provisioning state of the partner configuration. Known values are: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerConfigurationProvisioningState """ super().__init__(**kwargs) - self.azure_subscription_id = azure_subscription_id - self.resource_group_name = resource_group_name - self.name = name - self.endpoint_type: Optional[str] = None - self.endpoint_service_context = endpoint_service_context - self.resource_move_change_history = resource_move_change_history + self.system_data = None + self.location = location + self.tags = tags + self.partner_authorization = partner_authorization + self.provisioning_state = provisioning_state -class PartnerDestinationsListResult(_serialization.Model): - """Result of the List Partner Destinations operation. +class PartnerConfigurationsListResult(_serialization.Model): + """Result of the List partner configurations operation. - :ivar value: A collection of partner destinations. - :vartype value: list[~azure.mgmt.eventgrid.models.PartnerDestination] - :ivar next_link: A link for the next page of partner destinations. + :ivar value: A collection of partner configurations. + :vartype value: list[~azure.mgmt.eventgrid.models.PartnerConfiguration] + :ivar next_link: A link for the next page of partner configurations. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[PartnerDestination]"}, + "value": {"key": "value", "type": "[PartnerConfiguration]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.PartnerDestination"]] = None, + value: Optional[List["_models.PartnerConfiguration"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: A collection of partner destinations. - :paramtype value: list[~azure.mgmt.eventgrid.models.PartnerDestination] - :keyword next_link: A link for the next page of partner destinations. + :keyword value: A collection of partner configurations. + :paramtype value: list[~azure.mgmt.eventgrid.models.PartnerConfiguration] + :keyword next_link: A link for the next page of partner configurations. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5798,24 +4828,41 @@ def __init__( self.next_link = next_link -class PartnerDestinationUpdateParameters(_serialization.Model): - """Properties of the Partner Destination that can be updated. +class PartnerConfigurationUpdateParameters(_serialization.Model): + """Properties of the partner configuration update. - :ivar tags: Tags of the Partner Destination resource. + :ivar tags: Tags of the partner configuration resource. :vartype tags: dict[str, str] + :ivar default_maximum_expiration_time_in_days: The default time used to validate the maximum + expiration time for each authorized partners in days. Allowed values ar between 1 and 365 days. + :vartype default_maximum_expiration_time_in_days: int """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "default_maximum_expiration_time_in_days": { + "key": "properties.defaultMaximumExpirationTimeInDays", + "type": "int", + }, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + default_maximum_expiration_time_in_days: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Tags of the Partner Destination resource. + :keyword tags: Tags of the partner configuration resource. :paramtype tags: dict[str, str] + :keyword default_maximum_expiration_time_in_days: The default time used to validate the maximum + expiration time for each authorized partners in days. Allowed values ar between 1 and 365 days. + :paramtype default_maximum_expiration_time_in_days: int """ super().__init__(**kwargs) self.tags = tags + self.default_maximum_expiration_time_in_days = default_maximum_expiration_time_in_days class PartnerDetails(_serialization.Model): @@ -5865,41 +4912,7 @@ def __init__( self.setup_uri = setup_uri -class PartnerEventSubscriptionDestination(EventSubscriptionDestination): - """PartnerEventSubscriptionDestination. - - All required parameters must be populated in order to send to server. - - :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. - Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource Id that represents the endpoint of a Partner Destination - of an event subscription. - :vartype resource_id: str - """ - - _validation = { - "endpoint_type": {"required": True}, - } - - _attribute_map = { - "endpoint_type": {"key": "endpointType", "type": "str"}, - "resource_id": {"key": "properties.resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: The Azure Resource Id that represents the endpoint of a Partner - Destination of an event subscription. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.endpoint_type: str = "PartnerDestination" - self.resource_id = resource_id - - -class PartnerNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes +class PartnerNamespace(TrackedResource): """EventGrid Partner Namespace. Variables are only populated by the server, and will be ignored when sending a request. @@ -5916,7 +4929,7 @@ class PartnerNamespace(TrackedResource): # pylint: disable=too-many-instance-at :vartype location: str :ivar tags: Tags of the resource. :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to Partner Namespace resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: @@ -5939,7 +4952,7 @@ class PartnerNamespace(TrackedResource): # pylint: disable=too-many-instance-at default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -6022,7 +5035,7 @@ def __init__( default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -6145,7 +5158,7 @@ class PartnerNamespaceUpdateParameters(_serialization.Model): default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -6184,7 +5197,7 @@ def __init__( default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -6222,7 +5235,7 @@ class PartnerRegistration(TrackedResource): :vartype location: str :ivar tags: Tags of the resource. :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to Partner Registration resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar provisioning_state: Provisioning state of the partner registration. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". @@ -6332,7 +5345,7 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N self.tags = tags -class PartnerTopic(TrackedResource): # pylint: disable=too-many-instance-attributes +class PartnerTopic(TrackedResource): """Event Grid Partner Topic. Variables are only populated by the server, and will be ignored when sending a request. @@ -6349,7 +5362,7 @@ class PartnerTopic(TrackedResource): # pylint: disable=too-many-instance-attrib :vartype location: str :ivar tags: Tags of the resource. :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to Partner Topic resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar identity: Identity information for the Partner Topic resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo @@ -6600,34 +5613,6 @@ def __init__( self.identity = identity -class PartnerUpdateDestinationInfo(_serialization.Model): - """Properties of the corresponding partner destination of a Channel. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - WebhookUpdatePartnerDestinationInfo - - All required parameters must be populated in order to send to server. - - :ivar endpoint_type: Type of the endpoint for the partner destination. Required. "WebHook" - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.PartnerEndpointType - """ - - _validation = { - "endpoint_type": {"required": True}, - } - - _attribute_map = { - "endpoint_type": {"key": "endpointType", "type": "str"}, - } - - _subtype_map = {"endpoint_type": {"WebHook": "WebhookUpdatePartnerDestinationInfo"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.endpoint_type: Optional[str] = None - - class PartnerUpdateTopicInfo(_serialization.Model): """Update properties for the corresponding partner topic of a channel. @@ -6659,7 +5644,7 @@ class PermissionBinding(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to the PermissionBinding resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar description: Description for the Permission Binding resource. :vartype description: str @@ -6991,7 +5976,7 @@ class PushInfo(_serialization.Model): :vartype max_delivery_count: int :ivar event_time_to_live: Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time the message was published. - This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', + This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\', where: .. code-block:: @@ -7014,8 +5999,8 @@ class PushInfo(_serialization.Model): .. code-block:: - - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. - - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. + - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes. + - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day. :vartype event_time_to_live: str :ivar dead_letter_destination_with_resource_identity: The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter @@ -7066,7 +6051,7 @@ def __init__( :paramtype max_delivery_count: int :keyword event_time_to_live: Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time the message was published. - This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', + This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\', where: .. code-block:: @@ -7089,8 +6074,8 @@ def __init__( .. code-block:: - - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. - - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. + - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes. + - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day. :paramtype event_time_to_live: str :keyword dead_letter_destination_with_resource_identity: The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead @@ -7140,7 +6125,7 @@ class QueueInfo(_serialization.Model): ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity :ivar event_time_to_live: Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time the message was published. - This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', + This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\', where: .. code-block:: @@ -7163,8 +6148,8 @@ class QueueInfo(_serialization.Model): .. code-block:: - - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. - - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. + - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes. + - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day. :vartype event_time_to_live: ~datetime.timedelta """ @@ -7206,7 +6191,7 @@ def __init__( ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity :keyword event_time_to_live: Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time the message was published. - This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', + This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\', where: .. code-block:: @@ -7229,8 +6214,8 @@ def __init__( .. code-block:: - - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. - - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. + - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes. + - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day. :paramtype event_time_to_live: ~datetime.timedelta """ super().__init__(**kwargs) @@ -7240,103 +6225,6 @@ def __init__( self.event_time_to_live = event_time_to_live -class ResourceAssociation(_serialization.Model): - """Nsp resource association. - - :ivar name: Association name. - :vartype name: str - :ivar access_mode: Network security perimeter access mode. Known values are: "Learning", - "Enforced", and "Audit". - :vartype access_mode: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterAssociationAccessMode - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_mode": {"key": "accessMode", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - access_mode: Optional[Union[str, "_models.NetworkSecurityPerimeterAssociationAccessMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Association name. - :paramtype name: str - :keyword access_mode: Network security perimeter access mode. Known values are: "Learning", - "Enforced", and "Audit". - :paramtype access_mode: str or - ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterAssociationAccessMode - """ - super().__init__(**kwargs) - self.name = name - self.access_mode = access_mode - - -class ResourceMoveChangeHistory(_serialization.Model): - """The change history of the resource move. - - :ivar azure_subscription_id: Azure subscription ID of the resource. - :vartype azure_subscription_id: str - :ivar resource_group_name: Azure Resource Group of the resource. - :vartype resource_group_name: str - :ivar changed_time_utc: UTC timestamp of when the resource was changed. - :vartype changed_time_utc: ~datetime.datetime - """ - - _attribute_map = { - "azure_subscription_id": {"key": "azureSubscriptionId", "type": "str"}, - "resource_group_name": {"key": "resourceGroupName", "type": "str"}, - "changed_time_utc": {"key": "changedTimeUtc", "type": "iso-8601"}, - } - - def __init__( - self, - *, - azure_subscription_id: Optional[str] = None, - resource_group_name: Optional[str] = None, - changed_time_utc: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_subscription_id: Azure subscription ID of the resource. - :paramtype azure_subscription_id: str - :keyword resource_group_name: Azure Resource Group of the resource. - :paramtype resource_group_name: str - :keyword changed_time_utc: UTC timestamp of when the resource was changed. - :paramtype changed_time_utc: ~datetime.datetime - """ - super().__init__(**kwargs) - self.azure_subscription_id = azure_subscription_id - self.resource_group_name = resource_group_name - self.changed_time_utc = changed_time_utc - - -class ResourceSku(_serialization.Model): - """Describes an EventGrid Resource Sku. - - :ivar name: The Sku name of the resource. The possible values are: Basic or Premium. Known - values are: "Basic" and "Premium". - :vartype name: str or ~azure.mgmt.eventgrid.models.Sku - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Union[str, "_models.Sku"] = "Basic", **kwargs: Any) -> None: - """ - :keyword name: The Sku name of the resource. The possible values are: Basic or Premium. Known - values are: "Basic" and "Premium". - :paramtype name: str or ~azure.mgmt.eventgrid.models.Sku - """ - super().__init__(**kwargs) - self.name = name - - class RetryPolicy(_serialization.Model): """Information about the retry policy for an event subscription. @@ -7438,7 +6326,7 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. @@ -7489,7 +6377,7 @@ class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. @@ -7699,7 +6587,7 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. @@ -8402,7 +7290,7 @@ class Subscription(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to Event Subscription resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar provisioning_state: Provisioning state of the event subscription. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", "AwaitingManualAction", @@ -8634,7 +7522,7 @@ def __init__( self.last_modified_at = last_modified_at -class SystemTopic(TrackedResource): # pylint: disable=too-many-instance-attributes +class SystemTopic(TrackedResource): """EventGrid System Topic. Variables are only populated by the server, and will be ignored when sending a request. @@ -8651,7 +7539,7 @@ class SystemTopic(TrackedResource): # pylint: disable=too-many-instance-attribu :vartype location: str :ivar tags: Tags of the resource. :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to System Topic resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar identity: Identity information for the resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo @@ -8777,7 +7665,7 @@ def __init__( self.identity = identity -class Topic(TrackedResource): # pylint: disable=too-many-instance-attributes +class Topic(TrackedResource): """EventGrid Topic. Variables are only populated by the server, and will be ignored when sending a request. @@ -8794,15 +7682,9 @@ class Topic(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype location: str :ivar tags: Tags of the resource. :vartype tags: dict[str, str] - :ivar sku: The Sku pricing tier for the topic. - :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar identity: Identity information for the resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar kind: Kind of the resource. Known values are: "Azure" and "AzureArc". - :vartype kind: str or ~azure.mgmt.eventgrid.models.ResourceKind - :ivar extended_location: Extended location of the resource. - :vartype extended_location: ~azure.mgmt.eventgrid.models.ExtendedLocation - :ivar system_data: The system metadata relating to Topic resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: @@ -8833,7 +7715,7 @@ class Topic(TrackedResource): # pylint: disable=too-many-instance-attributes default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -8865,10 +7747,7 @@ class Topic(TrackedResource): # pylint: disable=too-many-instance-attributes "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "ResourceSku"}, "identity": {"key": "identity", "type": "IdentityInfo"}, - "kind": {"key": "kind", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "system_data": {"key": "systemData", "type": "SystemData"}, "private_endpoint_connections": { "key": "properties.privateEndpointConnections", @@ -8892,10 +7771,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.ResourceSku"] = None, identity: Optional["_models.IdentityInfo"] = None, - kind: Union[str, "_models.ResourceKind"] = "Azure", - extended_location: Optional["_models.ExtendedLocation"] = None, event_type_info: Optional["_models.EventTypeInfo"] = None, minimum_tls_version_allowed: Optional[Union[str, "_models.TlsVersion"]] = None, input_schema: Optional[Union[str, "_models.InputSchema"]] = None, @@ -8911,14 +7787,8 @@ def __init__( :paramtype location: str :keyword tags: Tags of the resource. :paramtype tags: dict[str, str] - :keyword sku: The Sku pricing tier for the topic. - :paramtype sku: ~azure.mgmt.eventgrid.models.ResourceSku :keyword identity: Identity information for the resource. :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword kind: Kind of the resource. Known values are: "Azure" and "AzureArc". - :paramtype kind: str or ~azure.mgmt.eventgrid.models.ResourceKind - :keyword extended_location: Extended location of the resource. - :paramtype extended_location: ~azure.mgmt.eventgrid.models.ExtendedLocation :keyword event_type_info: Event Type Information for the user topic. This information is provided by the publisher and can be used by the subscriber to view different types of events that are published. @@ -8938,7 +7808,7 @@ def __init__( default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -8952,10 +7822,7 @@ def __init__( :paramtype data_residency_boundary: str or ~azure.mgmt.eventgrid.models.DataResidencyBoundary """ super().__init__(location=location, tags=tags, **kwargs) - self.sku = sku self.identity = identity - self.kind = kind - self.extended_location = extended_location self.system_data = None self.private_endpoint_connections = None self.provisioning_state = None @@ -9094,7 +7961,7 @@ class TopicSpace(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to the TopicSpace resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar description: Description for the Topic Space resource. :vartype description: str @@ -9165,8 +8032,6 @@ class TopicSpacesConfiguration(_serialization.Model): :vartype hostname: str :ivar routing_enrichments: Routing enrichments for topic spaces configuration. :vartype routing_enrichments: ~azure.mgmt.eventgrid.models.RoutingEnrichments - :ivar client_authentication: Client authentication settings for topic spaces configuration. - :vartype client_authentication: ~azure.mgmt.eventgrid.models.ClientAuthenticationSettings :ivar maximum_session_expiry_in_hours: The maximum session expiry in hours. The property default value is 1 hour. Min allowed value is 1 hour and max allowed value is 8 hours. @@ -9190,7 +8055,6 @@ class TopicSpacesConfiguration(_serialization.Model): "route_topic_resource_id": {"key": "routeTopicResourceId", "type": "str"}, "hostname": {"key": "hostname", "type": "str"}, "routing_enrichments": {"key": "routingEnrichments", "type": "RoutingEnrichments"}, - "client_authentication": {"key": "clientAuthentication", "type": "ClientAuthenticationSettings"}, "maximum_session_expiry_in_hours": {"key": "maximumSessionExpiryInHours", "type": "int"}, "maximum_client_sessions_per_authentication_name": { "key": "maximumClientSessionsPerAuthenticationName", @@ -9206,7 +8070,6 @@ def __init__( state: Optional[Union[str, "_models.TopicSpacesConfigurationState"]] = None, route_topic_resource_id: Optional[str] = None, routing_enrichments: Optional["_models.RoutingEnrichments"] = None, - client_authentication: Optional["_models.ClientAuthenticationSettings"] = None, maximum_session_expiry_in_hours: Optional[int] = None, maximum_client_sessions_per_authentication_name: Optional[int] = None, routing_identity_info: Optional["_models.RoutingIdentityInfo"] = None, @@ -9225,8 +8088,6 @@ def __init__( :paramtype route_topic_resource_id: str :keyword routing_enrichments: Routing enrichments for topic spaces configuration. :paramtype routing_enrichments: ~azure.mgmt.eventgrid.models.RoutingEnrichments - :keyword client_authentication: Client authentication settings for topic spaces configuration. - :paramtype client_authentication: ~azure.mgmt.eventgrid.models.ClientAuthenticationSettings :keyword maximum_session_expiry_in_hours: The maximum session expiry in hours. The property default value is 1 hour. Min allowed value is 1 hour and max allowed value is 8 hours. @@ -9245,7 +8106,6 @@ def __init__( self.route_topic_resource_id = route_topic_resource_id self.hostname = None self.routing_enrichments = routing_enrichments - self.client_authentication = client_authentication self.maximum_session_expiry_in_hours = maximum_session_expiry_in_hours self.maximum_client_sessions_per_authentication_name = maximum_client_sessions_per_authentication_name self.routing_identity_info = routing_identity_info @@ -9308,7 +8168,7 @@ def __init__( self.is_data_action = is_data_action -class TopicTypeInfo(Resource): # pylint: disable=too-many-instance-attributes +class TopicTypeInfo(Resource): """Properties of a topic type info. Variables are only populated by the server, and will be ignored when sending a request. @@ -9458,13 +8318,11 @@ class TopicUpdateParameters(_serialization.Model): :vartype tags: dict[str, str] :ivar identity: Topic resource identity information. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar sku: The Sku pricing tier for the topic. - :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -9486,7 +8344,6 @@ class TopicUpdateParameters(_serialization.Model): _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "IdentityInfo"}, - "sku": {"key": "sku", "type": "ResourceSku"}, "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "inbound_ip_rules": {"key": "properties.inboundIpRules", "type": "[InboundIpRule]"}, "minimum_tls_version_allowed": {"key": "properties.minimumTlsVersionAllowed", "type": "str"}, @@ -9500,7 +8357,6 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.IdentityInfo"] = None, - sku: Optional["_models.ResourceSku"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, inbound_ip_rules: Optional[List["_models.InboundIpRule"]] = None, minimum_tls_version_allowed: Optional[Union[str, "_models.TlsVersion"]] = None, @@ -9514,13 +8370,11 @@ def __init__( :paramtype tags: dict[str, str] :keyword identity: Topic resource identity information. :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword sku: The Sku pricing tier for the topic. - :paramtype sku: ~azure.mgmt.eventgrid.models.ResourceSku :keyword public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + />`. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. @@ -9541,7 +8395,6 @@ def __init__( super().__init__(**kwargs) self.tags = tags self.identity = identity - self.sku = sku self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules self.minimum_tls_version_allowed = minimum_tls_version_allowed @@ -9583,8 +8436,6 @@ class UpdateTopicSpacesConfigurationInfo(_serialization.Model): :vartype route_topic_resource_id: str :ivar routing_enrichments: Routing enrichments for topic spaces configuration. :vartype routing_enrichments: ~azure.mgmt.eventgrid.models.RoutingEnrichments - :ivar client_authentication: Client authentication settings for topic spaces configuration. - :vartype client_authentication: ~azure.mgmt.eventgrid.models.ClientAuthenticationSettings :ivar maximum_session_expiry_in_hours: The maximum session expiry in hours. The property default value is 1 hour. Min allowed value is 1 hour and max allowed value is 8 hours. @@ -9603,7 +8454,6 @@ class UpdateTopicSpacesConfigurationInfo(_serialization.Model): "state": {"key": "state", "type": "str"}, "route_topic_resource_id": {"key": "routeTopicResourceId", "type": "str"}, "routing_enrichments": {"key": "routingEnrichments", "type": "RoutingEnrichments"}, - "client_authentication": {"key": "clientAuthentication", "type": "ClientAuthenticationSettings"}, "maximum_session_expiry_in_hours": {"key": "maximumSessionExpiryInHours", "type": "int"}, "maximum_client_sessions_per_authentication_name": { "key": "maximumClientSessionsPerAuthenticationName", @@ -9619,7 +8469,6 @@ def __init__( state: Optional[Union[str, "_models.TopicSpacesConfigurationState"]] = None, route_topic_resource_id: Optional[str] = None, routing_enrichments: Optional["_models.RoutingEnrichments"] = None, - client_authentication: Optional["_models.ClientAuthenticationSettings"] = None, maximum_session_expiry_in_hours: Optional[int] = None, maximum_client_sessions_per_authentication_name: Optional[int] = None, routing_identity_info: Optional["_models.RoutingIdentityInfo"] = None, @@ -9635,8 +8484,6 @@ def __init__( :paramtype route_topic_resource_id: str :keyword routing_enrichments: Routing enrichments for topic spaces configuration. :paramtype routing_enrichments: ~azure.mgmt.eventgrid.models.RoutingEnrichments - :keyword client_authentication: Client authentication settings for topic spaces configuration. - :paramtype client_authentication: ~azure.mgmt.eventgrid.models.ClientAuthenticationSettings :keyword maximum_session_expiry_in_hours: The maximum session expiry in hours. The property default value is 1 hour. Min allowed value is 1 hour and max allowed value is 8 hours. @@ -9654,7 +8501,6 @@ def __init__( self.state = state self.route_topic_resource_id = route_topic_resource_id self.routing_enrichments = routing_enrichments - self.client_authentication = client_authentication self.maximum_session_expiry_in_hours = maximum_session_expiry_in_hours self.maximum_client_sessions_per_authentication_name = maximum_client_sessions_per_authentication_name self.routing_identity_info = routing_identity_info @@ -9698,7 +8544,7 @@ class VerifiedPartner(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :ivar system_data: The system metadata relating to Verified Partner resource. + :ivar system_data: The system metadata relating to the Event Grid resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar partner_registration_immutable_id: ImmutableId of the corresponding partner registration. :vartype partner_registration_immutable_id: str @@ -9708,8 +8554,6 @@ class VerifiedPartner(Resource): :vartype partner_display_name: str :ivar partner_topic_details: Details of the partner topic scenario. :vartype partner_topic_details: ~azure.mgmt.eventgrid.models.PartnerDetails - :ivar partner_destination_details: Details of the partner destination scenario. - :vartype partner_destination_details: ~azure.mgmt.eventgrid.models.PartnerDetails :ivar provisioning_state: Provisioning state of the verified partner. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or @@ -9732,7 +8576,6 @@ class VerifiedPartner(Resource): "organization_name": {"key": "properties.organizationName", "type": "str"}, "partner_display_name": {"key": "properties.partnerDisplayName", "type": "str"}, "partner_topic_details": {"key": "properties.partnerTopicDetails", "type": "PartnerDetails"}, - "partner_destination_details": {"key": "properties.partnerDestinationDetails", "type": "PartnerDetails"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } @@ -9743,7 +8586,6 @@ def __init__( organization_name: Optional[str] = None, partner_display_name: Optional[str] = None, partner_topic_details: Optional["_models.PartnerDetails"] = None, - partner_destination_details: Optional["_models.PartnerDetails"] = None, provisioning_state: Optional[Union[str, "_models.VerifiedPartnerProvisioningState"]] = None, **kwargs: Any ) -> None: @@ -9757,8 +8599,6 @@ def __init__( :paramtype partner_display_name: str :keyword partner_topic_details: Details of the partner topic scenario. :paramtype partner_topic_details: ~azure.mgmt.eventgrid.models.PartnerDetails - :keyword partner_destination_details: Details of the partner destination scenario. - :paramtype partner_destination_details: ~azure.mgmt.eventgrid.models.PartnerDetails :keyword provisioning_state: Provisioning state of the verified partner. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". :paramtype provisioning_state: str or @@ -9770,7 +8610,6 @@ def __init__( self.organization_name = organization_name self.partner_display_name = partner_display_name self.partner_topic_details = partner_topic_details - self.partner_destination_details = partner_destination_details self.provisioning_state = provisioning_state @@ -9811,7 +8650,7 @@ class WebHookEventSubscriptionDestination(EventSubscriptionDestination): :ivar endpoint_type: Type of the endpoint for the event subscription destination. Required. Known values are: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", - "ServiceBusTopic", "AzureFunction", "PartnerDestination", "MonitorAlert", and "NamespaceTopic". + "ServiceBusTopic", "AzureFunction", "MonitorAlert", and "NamespaceTopic". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar endpoint_url: The URL that represents the endpoint of the destination of an event subscription. @@ -9904,150 +8743,3 @@ def __init__( self.azure_active_directory_application_id_or_uri = azure_active_directory_application_id_or_uri self.delivery_attribute_mappings = delivery_attribute_mappings self.minimum_tls_version_allowed = minimum_tls_version_allowed - - -class WebhookPartnerDestinationInfo(PartnerDestinationInfo): - """Information about the WebHook of the partner destination. - - All required parameters must be populated in order to send to server. - - :ivar azure_subscription_id: Azure subscription ID of the subscriber. The partner destination - associated with the channel will be - created under this Azure subscription. - :vartype azure_subscription_id: str - :ivar resource_group_name: Azure Resource Group of the subscriber. The partner destination - associated with the channel will be - created under this resource group. - :vartype resource_group_name: str - :ivar name: Name of the partner destination associated with the channel. - :vartype name: str - :ivar endpoint_type: Type of the endpoint for the partner destination. Required. "WebHook" - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.PartnerEndpointType - :ivar endpoint_service_context: Additional context of the partner destination endpoint. - :vartype endpoint_service_context: str - :ivar resource_move_change_history: Change history of the resource move. - :vartype resource_move_change_history: - list[~azure.mgmt.eventgrid.models.ResourceMoveChangeHistory] - :ivar endpoint_url: The URL that represents the endpoint of the partner destination. - :vartype endpoint_url: str - :ivar endpoint_base_url: The base URL that represents the endpoint of the partner destination. - :vartype endpoint_base_url: str - :ivar client_authentication: Partner client authentication. - :vartype client_authentication: ~azure.mgmt.eventgrid.models.PartnerClientAuthentication - """ - - _validation = { - "endpoint_type": {"required": True}, - } - - _attribute_map = { - "azure_subscription_id": {"key": "azureSubscriptionId", "type": "str"}, - "resource_group_name": {"key": "resourceGroupName", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "endpoint_type": {"key": "endpointType", "type": "str"}, - "endpoint_service_context": {"key": "endpointServiceContext", "type": "str"}, - "resource_move_change_history": {"key": "resourceMoveChangeHistory", "type": "[ResourceMoveChangeHistory]"}, - "endpoint_url": {"key": "properties.endpointUrl", "type": "str"}, - "endpoint_base_url": {"key": "properties.endpointBaseUrl", "type": "str"}, - "client_authentication": {"key": "properties.clientAuthentication", "type": "PartnerClientAuthentication"}, - } - - def __init__( - self, - *, - azure_subscription_id: Optional[str] = None, - resource_group_name: Optional[str] = None, - name: Optional[str] = None, - endpoint_service_context: Optional[str] = None, - resource_move_change_history: Optional[List["_models.ResourceMoveChangeHistory"]] = None, - endpoint_url: Optional[str] = None, - endpoint_base_url: Optional[str] = None, - client_authentication: Optional["_models.PartnerClientAuthentication"] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_subscription_id: Azure subscription ID of the subscriber. The partner - destination associated with the channel will be - created under this Azure subscription. - :paramtype azure_subscription_id: str - :keyword resource_group_name: Azure Resource Group of the subscriber. The partner destination - associated with the channel will be - created under this resource group. - :paramtype resource_group_name: str - :keyword name: Name of the partner destination associated with the channel. - :paramtype name: str - :keyword endpoint_service_context: Additional context of the partner destination endpoint. - :paramtype endpoint_service_context: str - :keyword resource_move_change_history: Change history of the resource move. - :paramtype resource_move_change_history: - list[~azure.mgmt.eventgrid.models.ResourceMoveChangeHistory] - :keyword endpoint_url: The URL that represents the endpoint of the partner destination. - :paramtype endpoint_url: str - :keyword endpoint_base_url: The base URL that represents the endpoint of the partner - destination. - :paramtype endpoint_base_url: str - :keyword client_authentication: Partner client authentication. - :paramtype client_authentication: ~azure.mgmt.eventgrid.models.PartnerClientAuthentication - """ - super().__init__( - azure_subscription_id=azure_subscription_id, - resource_group_name=resource_group_name, - name=name, - endpoint_service_context=endpoint_service_context, - resource_move_change_history=resource_move_change_history, - **kwargs - ) - self.endpoint_type: str = "WebHook" - self.endpoint_url = endpoint_url - self.endpoint_base_url = endpoint_base_url - self.client_authentication = client_authentication - - -class WebhookUpdatePartnerDestinationInfo(PartnerUpdateDestinationInfo): - """Information about the update of the WebHook of the partner destination. - - All required parameters must be populated in order to send to server. - - :ivar endpoint_type: Type of the endpoint for the partner destination. Required. "WebHook" - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.PartnerEndpointType - :ivar endpoint_url: The URL that represents the endpoint of the partner destination. - :vartype endpoint_url: str - :ivar endpoint_base_url: The base URL that represents the endpoint of the partner destination. - :vartype endpoint_base_url: str - :ivar client_authentication: Partner client authentication. - :vartype client_authentication: ~azure.mgmt.eventgrid.models.PartnerClientAuthentication - """ - - _validation = { - "endpoint_type": {"required": True}, - } - - _attribute_map = { - "endpoint_type": {"key": "endpointType", "type": "str"}, - "endpoint_url": {"key": "properties.endpointUrl", "type": "str"}, - "endpoint_base_url": {"key": "properties.endpointBaseUrl", "type": "str"}, - "client_authentication": {"key": "properties.clientAuthentication", "type": "PartnerClientAuthentication"}, - } - - def __init__( - self, - *, - endpoint_url: Optional[str] = None, - endpoint_base_url: Optional[str] = None, - client_authentication: Optional["_models.PartnerClientAuthentication"] = None, - **kwargs: Any - ) -> None: - """ - :keyword endpoint_url: The URL that represents the endpoint of the partner destination. - :paramtype endpoint_url: str - :keyword endpoint_base_url: The base URL that represents the endpoint of the partner - destination. - :paramtype endpoint_base_url: str - :keyword client_authentication: Partner client authentication. - :paramtype client_authentication: ~azure.mgmt.eventgrid.models.PartnerClientAuthentication - """ - super().__init__(**kwargs) - self.endpoint_type: str = "WebHook" - self.endpoint_url = endpoint_url - self.endpoint_base_url = endpoint_base_url - self.client_authentication = client_authentication diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py index a245f48233e3..780e5563fc94 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py @@ -5,41 +5,45 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._ca_certificates_operations import CaCertificatesOperations -from ._channels_operations import ChannelsOperations -from ._client_groups_operations import ClientGroupsOperations -from ._clients_operations import ClientsOperations -from ._domains_operations import DomainsOperations -from ._domain_topics_operations import DomainTopicsOperations -from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations -from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations -from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations -from ._event_subscriptions_operations import EventSubscriptionsOperations -from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations -from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations -from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations -from ._namespaces_operations import NamespacesOperations -from ._namespace_topics_operations import NamespaceTopicsOperations -from ._operations import Operations -from ._partner_configurations_operations import PartnerConfigurationsOperations -from ._partner_destinations_operations import PartnerDestinationsOperations -from ._partner_namespaces_operations import PartnerNamespacesOperations -from ._partner_registrations_operations import PartnerRegistrationsOperations -from ._partner_topics_operations import PartnerTopicsOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._permission_bindings_operations import PermissionBindingsOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._system_topics_operations import SystemTopicsOperations -from ._topics_operations import TopicsOperations -from ._extension_topics_operations import ExtensionTopicsOperations -from ._topic_spaces_operations import TopicSpacesOperations -from ._topic_types_operations import TopicTypesOperations -from ._verified_partners_operations import VerifiedPartnersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._ca_certificates_operations import CaCertificatesOperations # type: ignore +from ._channels_operations import ChannelsOperations # type: ignore +from ._client_groups_operations import ClientGroupsOperations # type: ignore +from ._clients_operations import ClientsOperations # type: ignore +from ._domains_operations import DomainsOperations # type: ignore +from ._domain_topics_operations import DomainTopicsOperations # type: ignore +from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations # type: ignore +from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations # type: ignore +from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations # type: ignore +from ._event_subscriptions_operations import EventSubscriptionsOperations # type: ignore +from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations # type: ignore +from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations # type: ignore +from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations # type: ignore +from ._namespaces_operations import NamespacesOperations # type: ignore +from ._namespace_topics_operations import NamespaceTopicsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._topics_operations import TopicsOperations # type: ignore +from ._partner_configurations_operations import PartnerConfigurationsOperations # type: ignore +from ._partner_namespaces_operations import PartnerNamespacesOperations # type: ignore +from ._partner_registrations_operations import PartnerRegistrationsOperations # type: ignore +from ._partner_topics_operations import PartnerTopicsOperations # type: ignore +from ._permission_bindings_operations import PermissionBindingsOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._system_topics_operations import SystemTopicsOperations # type: ignore +from ._extension_topics_operations import ExtensionTopicsOperations # type: ignore +from ._topic_spaces_operations import TopicSpacesOperations # type: ignore +from ._topic_types_operations import TopicTypesOperations # type: ignore +from ._verified_partners_operations import VerifiedPartnersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -49,31 +53,29 @@ "ClientsOperations", "DomainsOperations", "DomainTopicsOperations", - "DomainTopicEventSubscriptionsOperations", "TopicEventSubscriptionsOperations", "DomainEventSubscriptionsOperations", + "NamespaceTopicEventSubscriptionsOperations", "EventSubscriptionsOperations", + "DomainTopicEventSubscriptionsOperations", "SystemTopicEventSubscriptionsOperations", - "NamespaceTopicEventSubscriptionsOperations", "PartnerTopicEventSubscriptionsOperations", "NamespacesOperations", "NamespaceTopicsOperations", "Operations", + "TopicsOperations", "PartnerConfigurationsOperations", - "PartnerDestinationsOperations", "PartnerNamespacesOperations", "PartnerRegistrationsOperations", "PartnerTopicsOperations", - "NetworkSecurityPerimeterConfigurationsOperations", "PermissionBindingsOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", "SystemTopicsOperations", - "TopicsOperations", "ExtensionTopicsOperations", "TopicSpacesOperations", "TopicTypesOperations", "VerifiedPartnersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py index 1c744445662a..d940873a4acf 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +166,7 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +235,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.CaCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +258,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -269,7 +272,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CaCertificate", pipeline_response) + deserialized = self._deserialize("CaCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -283,8 +286,8 @@ def _create_or_update_initial( ca_certificate_name: str, ca_certificate_info: Union[_models.CaCertificate, IO[bytes]], **kwargs: Any - ) -> _models.CaCertificate: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +300,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.CaCertificate] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -319,10 +322,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -330,15 +333,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("CaCertificate", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CaCertificate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,10 +464,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CaCertificate", pipeline_response) + deserialized = self._deserialize("CaCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,10 +492,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, ca_certificate_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +507,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -514,10 +518,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -525,6 +529,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -533,8 +541,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -564,7 +576,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, ca_certificate_name=ca_certificate_name, @@ -574,6 +586,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -637,7 +650,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CaCertificatesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -674,7 +686,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py index 0d92aa9952e2..7b3a95705881 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +81,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -111,7 +115,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -138,7 +142,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( @@ -176,7 +180,7 @@ def build_list_by_partner_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +215,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,7 +279,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.Channel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,7 +302,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +315,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Channel", pipeline_response) + deserialized = self._deserialize("Channel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,7 +413,7 @@ def create_or_update( :rtype: ~azure.mgmt.eventgrid.models.Channel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +448,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -459,21 +461,17 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Channel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Channel", pipeline_response) + deserialized = self._deserialize("Channel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, partner_namespace_name: str, channel_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +483,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -496,10 +494,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -507,6 +505,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -514,8 +516,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -545,7 +551,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, partner_namespace_name=partner_namespace_name, channel_name=channel_name, @@ -555,6 +561,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -577,7 +584,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload - def update( # pylint: disable=inconsistent-return-statements + def update( self, resource_group_name: str, partner_namespace_name: str, @@ -609,7 +616,7 @@ def update( # pylint: disable=inconsistent-return-statements """ @overload - def update( # pylint: disable=inconsistent-return-statements + def update( self, resource_group_name: str, partner_namespace_name: str, @@ -668,7 +675,7 @@ def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +710,6 @@ def update( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -760,7 +766,7 @@ def list_by_partner_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChannelsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,7 +787,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -797,7 +802,6 @@ def prepare_request(next_link=None): _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 @@ -845,7 +849,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -868,7 +872,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -882,7 +885,7 @@ def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py index feb47b262b39..631a6b5fe20e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +166,7 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +235,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.ClientGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +258,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -269,7 +272,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClientGroup", pipeline_response) + deserialized = self._deserialize("ClientGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -283,8 +286,8 @@ def _create_or_update_initial( client_group_name: str, client_group_info: Union[_models.ClientGroup, IO[bytes]], **kwargs: Any - ) -> _models.ClientGroup: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +300,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.ClientGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -319,10 +322,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -330,15 +333,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("ClientGroup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ClientGroup", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,10 +464,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClientGroup", pipeline_response) + deserialized = self._deserialize("ClientGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,10 +492,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, client_group_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +507,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -514,10 +518,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -525,6 +529,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -533,8 +541,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -564,7 +576,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, client_group_name=client_group_name, @@ -574,6 +586,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -637,7 +650,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientGroupsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -674,7 +686,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py index 2f4d382c6d68..29dbe7e6f429 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +166,7 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +233,7 @@ def get(self, resource_group_name: str, namespace_name: str, client_name: str, * :rtype: ~azure.mgmt.eventgrid.models.Client :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +256,6 @@ def get(self, resource_group_name: str, namespace_name: str, client_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -267,7 +270,7 @@ def get(self, resource_group_name: str, namespace_name: str, client_name: str, * error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Client", pipeline_response) + deserialized = self._deserialize("Client", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -281,8 +284,8 @@ def _create_or_update_initial( client_name: str, client_info: Union[_models.Client, IO[bytes]], **kwargs: Any - ) -> _models.Client: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +298,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Client] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -317,10 +320,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -328,15 +331,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("Client", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Client", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -455,10 +458,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Client", pipeline_response) + deserialized = self._deserialize("Client", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -482,10 +486,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, client_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +501,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -508,10 +512,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -519,6 +523,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -527,8 +535,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -558,7 +570,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, client_name=client_name, @@ -568,6 +580,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -631,7 +644,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClientsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,7 +665,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -668,7 +680,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py index 47f7488c6800..c7fc202832f3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_delivery_attributes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,7 +148,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -170,7 +175,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +210,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,7 +248,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,6 @@ def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -347,7 +351,7 @@ def get_delivery_attributes( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,7 +377,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +400,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +413,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,8 +427,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +441,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -460,10 +463,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -471,14 +474,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -609,10 +612,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -634,10 +638,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, domain_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +653,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -660,10 +664,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -671,6 +675,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -678,8 +686,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -709,7 +721,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, event_subscription_name=event_subscription_name, @@ -719,6 +731,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -747,8 +760,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -761,7 +774,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -783,10 +796,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -794,10 +807,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -922,10 +939,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -966,7 +984,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -989,7 +1007,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1003,7 +1020,7 @@ def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1050,7 +1067,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1071,7 +1088,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1087,7 +1103,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py index 44138e6e7b74..bf839ac2ce30 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,44 +44,6 @@ _SERIALIZER.client_side_validation = False -def build_get_delivery_attributes_request( - resource_group_name: str, - domain_name: str, - topic_name: str, - event_subscription_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _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_get_request( resource_group_name: str, domain_name: str, @@ -88,7 +55,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +93,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +133,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -199,7 +166,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -240,7 +207,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,7 +247,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,6 +277,44 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_delivery_attributes_request( + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_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", "2025-02-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str"), + "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), + } + + _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) + + class DomainTopicEventSubscriptionsOperations: """ .. warning:: @@ -329,72 +334,6 @@ 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 get_delivery_attributes( - self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> _models.DeliveryAttributeListResult: - """Get delivery attributes for an event subscription for domain topic. - - Get all delivery attributes for an event subscription for domain topic. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param domain_name: Name of the top level domain. Required. - :type domain_name: str - :param topic_name: Name of the domain topic. Required. - :type topic_name: str - :param event_subscription_name: Name of the event subscription. Required. - :type event_subscription_name: str - :return: DeliveryAttributeListResult or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult - :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.DeliveryAttributeListResult] = kwargs.pop("cls", None) - - _request = build_get_delivery_attributes_request( - resource_group_name=resource_group_name, - domain_name=domain_name, - topic_name=topic_name, - event_subscription_name=event_subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def get( self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any @@ -416,7 +355,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -440,7 +379,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +392,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -469,8 +407,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,7 +421,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -506,10 +444,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -517,14 +455,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -665,10 +603,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -690,10 +629,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -705,7 +644,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +656,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,6 +667,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -735,8 +678,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -768,7 +715,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, topic_name=topic_name, @@ -779,6 +726,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -808,8 +756,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -822,7 +770,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -845,10 +793,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -856,10 +804,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -994,10 +946,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1040,7 +993,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1064,7 +1017,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1078,7 +1030,7 @@ def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1128,7 +1080,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1150,7 +1102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1166,7 +1117,6 @@ def prepare_request(next_link=None): _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 @@ -1194,3 +1144,68 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_delivery_attributes( + self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any + ) -> _models.DeliveryAttributeListResult: + """Get delivery attributes for an event subscription for domain topic. + + Get all delivery attributes for an event subscription for domain topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + Required. + :type resource_group_name: str + :param domain_name: Name of the top level domain. Required. + :type domain_name: str + :param topic_name: Name of the domain topic. Required. + :type topic_name: str + :param event_subscription_name: Name of the event subscription. Required. + :type event_subscription_name: str + :return: DeliveryAttributeListResult or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.DeliveryAttributeListResult] = kwargs.pop("cls", None) + + _request = build_get_delivery_attributes_request( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py index 7afe831b44cf..1cfde067d399 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -15,13 +15,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +30,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +48,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +111,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -140,7 +144,7 @@ def build_list_by_domain_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +211,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.DomainTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +234,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +247,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainTopic", pipeline_response) + deserialized = self._deserialize("DomainTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -253,8 +256,8 @@ def get( def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any - ) -> _models.DomainTopic: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +269,7 @@ def _create_or_update_initial( _params = 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.DomainTopic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -277,10 +280,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -288,10 +291,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,10 +344,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DomainTopic", pipeline_response) + deserialized = self._deserialize("DomainTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -362,10 +370,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +385,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -388,10 +396,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -399,6 +407,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -406,8 +418,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -437,7 +453,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, domain_topic_name=domain_topic_name, @@ -447,6 +463,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -508,7 +525,7 @@ def list_by_domain( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DomainTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -529,7 +546,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -545,7 +561,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py index 5d0a201f64ce..d21f88ed260a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_get_request(resource_group_name: str, domain_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +79,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -107,7 +112,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -133,7 +138,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +172,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +207,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +241,7 @@ def build_list_shared_access_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -267,7 +272,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -329,7 +334,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod :rtype: ~azure.mgmt.eventgrid.models.Domain :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +356,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,7 +369,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -374,8 +378,8 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain_info: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -388,7 +392,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -409,10 +413,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -420,10 +424,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,10 +536,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -553,10 +562,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, domain_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -568,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -578,10 +585,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -589,6 +596,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -596,8 +607,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> LROPoller[None]: @@ -623,7 +638,7 @@ def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, domain_name=domain_name, api_version=api_version, @@ -632,6 +647,7 @@ def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -659,8 +675,8 @@ def _update_initial( domain_name: str, domain_update_parameters: Union[_models.DomainUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Domain]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +689,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.Domain]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -694,10 +710,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -705,12 +721,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -821,10 +839,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -876,7 +895,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -895,7 +914,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -911,7 +929,6 @@ def prepare_request(next_link=None): _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 @@ -973,7 +990,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1009,7 +1025,6 @@ def prepare_request(next_link=None): _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 @@ -1055,7 +1070,7 @@ def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1077,7 +1092,6 @@ def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1091,7 +1105,7 @@ def list_shared_access_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1181,7 +1195,7 @@ def regenerate_key( :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1215,7 +1229,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1229,7 +1242,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py index 70e20774cafa..60880d7b5411 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,39 +44,11 @@ _SERIALIZER.client_side_validation = False -def build_get_delivery_attributes_request(scope: str, event_subscription_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _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_get_request(scope: str, event_subscription_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", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +75,7 @@ def build_create_or_update_request(scope: str, event_subscription_name: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,7 +104,7 @@ def build_create_or_update_request(scope: str, event_subscription_name: str, **k def build_delete_request(scope: str, event_subscription_name: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}" @@ -149,7 +126,7 @@ def build_update_request(scope: str, event_subscription_name: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -179,7 +156,7 @@ def build_get_full_url_request(scope: str, event_subscription_name: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +185,7 @@ def build_list_global_by_subscription_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,7 +222,7 @@ def build_list_global_by_subscription_for_topic_type_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +261,7 @@ def build_list_global_by_resource_group_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +301,7 @@ def build_list_global_by_resource_group_for_topic_type_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -359,7 +336,7 @@ def build_list_regional_by_subscription_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -399,7 +376,7 @@ def build_list_regional_by_resource_group_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -440,7 +417,7 @@ def build_list_regional_by_subscription_for_topic_type_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +459,7 @@ def build_list_regional_by_resource_group_for_topic_type_request( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -526,7 +503,7 @@ def build_list_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -570,7 +547,7 @@ def build_list_by_domain_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -600,6 +577,34 @@ def build_list_by_domain_topic_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_delivery_attributes_request(scope: str, event_subscription_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", "2025-02-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), + } + + _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) + + class EventSubscriptionsOperations: """ .. warning:: @@ -619,73 +624,9 @@ 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 get_delivery_attributes( - self, scope: str, event_subscription_name: str, **kwargs: Any - ) -> _models.DeliveryAttributeListResult: - """Get delivery attributes for an event subscription. - - Get all delivery attributes for an event subscription. - - :param scope: The scope of the event subscription. The scope can be a subscription, or a - resource group, or a top level resource belonging to a resource provider namespace, or an - EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' - for a resource, and - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' - for an EventGrid topic. Required. - :type scope: str - :param event_subscription_name: Name of the event subscription. Required. - :type event_subscription_name: str - :return: DeliveryAttributeListResult or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult - :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.DeliveryAttributeListResult] = kwargs.pop("cls", None) - - _request = build_get_delivery_attributes_request( - scope=scope, - event_subscription_name=event_subscription_name, - api_version=api_version, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _models.EventSubscription: + # pylint: disable=line-too-long """Get an event subscription. Get properties of an event subscription. @@ -705,7 +646,7 @@ def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +667,6 @@ def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -740,7 +680,7 @@ def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _model map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -753,8 +693,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -767,7 +707,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -787,10 +727,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -798,10 +738,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -818,6 +762,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -859,6 +804,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -898,6 +844,7 @@ def begin_create_or_update( event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -946,10 +893,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -971,10 +919,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, scope: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, scope: str, event_subscription_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -986,7 +932,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( scope=scope, @@ -995,10 +941,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1006,6 +952,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1013,11 +963,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any) -> LROPoller[None]: + # pylint: disable=line-too-long """Delete an event subscription. Delete an existing event subscription. @@ -1046,7 +1001,7 @@ def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any) 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 + raw_result = self._delete_initial( scope=scope, event_subscription_name=event_subscription_name, api_version=api_version, @@ -1055,6 +1010,7 @@ def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1082,8 +1038,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1096,7 +1052,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1116,10 +1072,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1127,10 +1083,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1147,6 +1107,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Update an event subscription. Asynchronously updates an existing event subscription. @@ -1184,6 +1145,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Update an event subscription. Asynchronously updates an existing event subscription. @@ -1218,6 +1180,7 @@ def begin_update( event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.EventSubscription]: + # pylint: disable=line-too-long """Update an event subscription. Asynchronously updates an existing event subscription. @@ -1263,10 +1226,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1290,6 +1254,7 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _models.EventSubscriptionFullUrl: + # pylint: disable=line-too-long """Get full URL of an event subscription. Get the full endpoint URL for an event subscription. @@ -1309,7 +1274,7 @@ def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any) :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1330,7 +1295,6 @@ def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1344,7 +1308,7 @@ def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1381,7 +1345,7 @@ def list_global_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1400,7 +1364,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1416,7 +1379,6 @@ def prepare_request(next_link=None): _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 @@ -1477,7 +1439,7 @@ def list_global_by_subscription_for_topic_type( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1497,7 +1459,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1513,7 +1474,6 @@ def prepare_request(next_link=None): _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 @@ -1575,7 +1535,7 @@ def list_global_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1595,7 +1555,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1611,7 +1570,6 @@ def prepare_request(next_link=None): _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 @@ -1680,7 +1638,7 @@ def list_global_by_resource_group_for_topic_type( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1701,7 +1659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1717,7 +1674,6 @@ def prepare_request(next_link=None): _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 @@ -1778,7 +1734,7 @@ def list_regional_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1798,7 +1754,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1814,7 +1769,6 @@ def prepare_request(next_link=None): _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 @@ -1884,7 +1838,7 @@ def list_regional_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1905,7 +1859,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1921,7 +1874,6 @@ def prepare_request(next_link=None): _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 @@ -1990,7 +1942,7 @@ def list_regional_by_subscription_for_topic_type( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2011,7 +1963,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2027,7 +1978,6 @@ def prepare_request(next_link=None): _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 @@ -2101,7 +2051,7 @@ def list_regional_by_resource_group_for_topic_type( # pylint: disable=name-too- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2123,7 +2073,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2139,7 +2088,6 @@ def prepare_request(next_link=None): _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 @@ -2214,7 +2162,7 @@ def list_by_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2237,7 +2185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2200,6 @@ def prepare_request(next_link=None): _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 @@ -2325,7 +2271,7 @@ def list_by_domain_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2347,7 +2293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2363,7 +2308,6 @@ def prepare_request(next_link=None): _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 @@ -2391,3 +2335,68 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_delivery_attributes( + self, scope: str, event_subscription_name: str, **kwargs: Any + ) -> _models.DeliveryAttributeListResult: + # pylint: disable=line-too-long + """Get delivery attributes for an event subscription. + + Get all delivery attributes for an event subscription. + + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. Required. + :type scope: str + :param event_subscription_name: Name of the event subscription. Required. + :type event_subscription_name: str + :return: DeliveryAttributeListResult or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.DeliveryAttributeListResult] = kwargs.pop("cls", None) + + _request = build_get_delivery_attributes_request( + scope=scope, + event_subscription_name=event_subscription_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py index c08a4a864614..357e6af5bb99 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -17,16 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +40,7 @@ def build_get_request(scope: 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", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,6 +81,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: + # pylint: disable=line-too-long """Get properties of an extension topic. Get the properties of an extension topic. @@ -94,7 +97,7 @@ def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: :rtype: ~azure.mgmt.eventgrid.models.ExtensionTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +117,6 @@ def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +130,7 @@ def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExtensionTopic", pipeline_response) + deserialized = self._deserialize("ExtensionTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py index db4c277db6f0..baad29e3b4f0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +104,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -151,7 +156,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +205,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -254,7 +259,7 @@ def build_list_by_namespace_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -299,7 +304,7 @@ def build_get_delivery_attributes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -348,7 +353,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -431,7 +436,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.Subscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -455,7 +460,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -470,7 +474,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = self._deserialize("Subscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,8 +489,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.Subscription, IO[bytes]], **kwargs: Any - ) -> _models.Subscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +503,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Subscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -522,10 +526,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -533,15 +537,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("Subscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -685,10 +689,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = self._deserialize("Subscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -712,15 +717,15 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,7 +737,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -744,10 +749,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -755,6 +760,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -763,8 +772,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -801,7 +814,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, @@ -812,6 +825,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -843,8 +857,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.Subscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +871,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.Subscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -880,10 +894,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -891,18 +905,19 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Subscription", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1037,10 +1052,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Subscription", pipeline_response) + deserialized = self._deserialize("Subscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1107,7 +1123,7 @@ def list_by_namespace_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1129,7 +1145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1145,7 +1160,6 @@ def prepare_request(next_link=None): _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 @@ -1201,7 +1215,7 @@ def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1225,7 +1239,6 @@ def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1240,7 +1253,7 @@ def get_delivery_attributes( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1273,7 +1286,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.SubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1310,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1312,7 +1324,7 @@ def get_full_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py index 40ae9610eda2..076d11657ae6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +86,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +125,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +161,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +206,7 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +243,7 @@ def build_list_shared_access_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +279,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -345,7 +350,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.NamespaceTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +373,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -383,7 +387,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,8 +401,8 @@ def _create_or_update_initial( topic_name: str, namespace_topic_info: Union[_models.NamespaceTopic, IO[bytes]], **kwargs: Any - ) -> _models.NamespaceTopic: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +415,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.NamespaceTopic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -433,10 +437,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -444,15 +448,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("NamespaceTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -575,10 +579,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -602,10 +607,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +622,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -628,10 +633,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -639,6 +644,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -647,8 +656,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -678,7 +691,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_name=topic_name, @@ -688,6 +701,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -718,8 +732,8 @@ def _update_initial( topic_name: str, namespace_topic_update_parameters: Union[_models.NamespaceTopicUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.NamespaceTopic: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,7 +746,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.NamespaceTopic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -754,10 +768,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -765,18 +779,19 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("NamespaceTopic", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -901,10 +916,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NamespaceTopic", pipeline_response) + deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -968,7 +984,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamespaceTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -989,7 +1005,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1005,7 +1020,6 @@ def prepare_request(next_link=None): _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 @@ -1054,7 +1068,7 @@ def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1077,7 +1091,6 @@ def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1092,7 +1105,7 @@ def list_shared_access_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1106,8 +1119,8 @@ def _regenerate_key_initial( topic_name: str, regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TopicSharedAccessKeys]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1120,7 +1133,7 @@ def _regenerate_key_initial( api_version: str = kwargs.pop("api_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.TopicSharedAccessKeys]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1142,10 +1155,10 @@ def _regenerate_key_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1153,18 +1166,20 @@ def _regenerate_key_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("TopicSharedAccessKeys", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1287,10 +1302,11 @@ def begin_regenerate_key( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py index b9b766db6ac5..72007ec818a5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +83,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -114,7 +119,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +152,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,7 +188,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +223,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +257,7 @@ def build_list_shared_access_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +290,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -321,7 +326,7 @@ def build_validate_custom_domain_ownership_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -382,7 +387,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.eventgrid.models.Namespace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +409,6 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +423,7 @@ def get(self, resource_group_name: str, namespace_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("Namespace", pipeline_response) + deserialized = self._deserialize("Namespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -432,8 +436,8 @@ def _create_or_update_initial( namespace_name: str, namespace_info: Union[_models.Namespace, IO[bytes]], **kwargs: Any - ) -> _models.Namespace: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -446,7 +450,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Namespace] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -467,10 +471,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -478,15 +482,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("Namespace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,10 +600,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = self._deserialize("Namespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -623,10 +628,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, namespace_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -638,7 +641,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -648,10 +651,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -659,6 +662,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -667,8 +674,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]: @@ -694,7 +705,7 @@ def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, api_version=api_version, @@ -703,6 +714,7 @@ def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -732,8 +744,8 @@ def _update_initial( namespace_name: str, namespace_update_parameters: Union[_models.NamespaceUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.Namespace: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,7 +758,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.Namespace] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -767,10 +779,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -778,18 +790,19 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Namespace", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -900,10 +913,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Namespace", pipeline_response) + deserialized = self._deserialize("Namespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -957,7 +971,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -976,7 +990,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -992,7 +1005,6 @@ def prepare_request(next_link=None): _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 @@ -1055,7 +1067,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1075,7 +1087,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1091,7 +1102,6 @@ def prepare_request(next_link=None): _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 @@ -1138,7 +1148,7 @@ def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.NamespaceSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1160,7 +1170,6 @@ def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1175,7 +1184,7 @@ def list_shared_access_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1188,8 +1197,8 @@ def _regenerate_key_initial( namespace_name: str, regenerate_key_request: Union[_models.NamespaceRegenerateKeyRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.NamespaceSharedAccessKeys]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1202,7 +1211,7 @@ def _regenerate_key_initial( api_version: str = kwargs.pop("api_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.NamespaceSharedAccessKeys]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1223,10 +1232,10 @@ def _regenerate_key_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1234,18 +1243,20 @@ def _regenerate_key_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("NamespaceSharedAccessKeys", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1358,10 +1369,11 @@ def begin_regenerate_key( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1387,8 +1399,8 @@ def get_long_running_output(pipeline_response): def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long self, resource_group_name: str, namespace_name: str, **kwargs: Any - ) -> Optional[_models.CustomDomainOwnershipValidationResult]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1400,7 +1412,7 @@ def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.CustomDomainOwnershipValidationResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_validate_custom_domain_ownership_request( resource_group_name=resource_group_name, @@ -1410,10 +1422,10 @@ def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1421,18 +1433,20 @@ def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("CustomDomainOwnershipValidationResult", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1475,10 +1489,11 @@ def begin_validate_custom_domain_ownership( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response) + deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py deleted file mode 100644 index 7d6ac4058e07..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,504 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 - -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( - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{resourceType}/{resourceName}/networkSecurityPerimeterConfigurations/{perimeterGuid}.{associationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=50, min_length=3, pattern=r"^[a-zA-Z0-9-]*$" - ), - "perimeterGuid": _SERIALIZER.url("perimeter_guid", perimeter_guid, "str"), - "associationName": _SERIALIZER.url("association_name", association_name, "str"), - } - - _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_reconcile_request( - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{resourceType}/{resourceName}/networkSecurityPerimeterConfigurations/{perimeterGuid}.{associationName}/reconcile", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=50, min_length=3, pattern=r"^[a-zA-Z0-9-]*$" - ), - "perimeterGuid": _SERIALIZER.url("perimeter_guid", perimeter_guid, "str"), - "associationName": _SERIALIZER.url("association_name", association_name, "str"), - } - - _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_list_request( - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{resourceType}/{resourceName}/networkSecurityPerimeterConfigurations", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=50, min_length=3, pattern=r"^[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) - - -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.eventgrid.EventGridManagementClient`'s - :attr:`network_security_perimeter_configurations` 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, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_name: str, - **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Get a specific network security perimeter configuration. - - Get a specific network security perimeter configuration with a topic or domain. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param resource_type: The type of the resource. This can be either \'topics\', or \'domains\'. - Known values are: "topics" and "domains". Required. - :type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType - :param resource_name: The name of the resource (namely, either, the topic name or domain name). - Required. - :type resource_name: str - :param perimeter_guid: Unique identifier for perimeter. Required. - :type perimeter_guid: str - :param association_name: Association name to association network security perimeter resource to - profile. Required. - :type association_name: str - :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration - :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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_type=resource_type, - resource_name=resource_name, - perimeter_guid=perimeter_guid, - association_name=association_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("NetworkSecurityPerimeterConfiguration", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _reconcile_initial( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_name: str, - **kwargs: Any - ) -> Optional[_models.NetworkSecurityPerimeterConfiguration]: - 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[Optional[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) - - _request = build_reconcile_request( - resource_group_name=resource_group_name, - resource_type=resource_type, - resource_name=resource_name, - perimeter_guid=perimeter_guid, - association_name=association_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("NetworkSecurityPerimeterConfiguration", 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) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reconcile( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - perimeter_guid: str, - association_name: str, - **kwargs: Any - ) -> LROPoller[_models.NetworkSecurityPerimeterConfiguration]: - """Reconcile a specific network security perimeter configuration for a given network security - perimeter association. - - Reconcile a specific network security perimeter configuration for a given network security - perimeter association with a topic or domain. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'. - Known values are: "topics" and "domains". Required. - :type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType - :param resource_name: The name of the resource (namely, either, the topic name or domain name). - Required. - :type resource_name: str - :param perimeter_guid: Unique identifier for perimeter. Required. - :type perimeter_guid: str - :param association_name: Association name to association network security perimeter resource to - profile. Required. - :type association_name: str - :return: An instance of LROPoller that returns either NetworkSecurityPerimeterConfiguration or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration] - :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.NetworkSecurityPerimeterConfiguration] = 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._reconcile_initial( - resource_group_name=resource_group_name, - resource_type=resource_type, - resource_name=resource_name, - perimeter_guid=perimeter_guid, - association_name=association_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): - deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - 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[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NetworkSecurityPerimeterConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_type: Union[str, _models.NetworkSecurityPerimeterResourceType], - resource_name: str, - **kwargs: Any - ) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]: - """Get all network security perimeter configurations for resource. - - Get all network security perimeter configurations associated with a topic or domain. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'. - Known values are: "topics" and "domains". Required. - :type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType - :param resource_name: The name of the resource (namely, either, the topic name or domain name). - Required. - :type resource_name: str - :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration] - :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.NetworkSecurityPerimeterConfigurationList] = 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, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("NetworkSecurityPerimeterConfigurationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py index 87d02f3558e0..1020759af2be 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +92,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +123,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py index c0c150ae67a8..7d2234bfdc96 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_get_request(resource_group_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +76,7 @@ def build_create_or_update_request(resource_group_name: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -101,7 +106,7 @@ def build_create_or_update_request(resource_group_name: str, subscription_id: st def build_delete_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -124,7 +129,7 @@ def build_update_request(resource_group_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +160,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +190,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,7 +220,7 @@ def build_authorize_partner_request(resource_group_name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -246,7 +251,7 @@ def build_unauthorize_partner_request(resource_group_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -305,7 +310,7 @@ def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerConfigu :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +331,6 @@ def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerConfigu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +344,7 @@ def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerConfigu map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -352,8 +356,8 @@ def _create_or_update_initial( resource_group_name: str, partner_configuration_info: Union[_models.PartnerConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.PartnerConfiguration: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +370,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PartnerConfiguration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -386,10 +390,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -397,14 +401,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -508,10 +512,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -533,10 +538,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +551,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -557,10 +560,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -568,6 +571,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -575,8 +582,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[None]: @@ -600,7 +611,7 @@ def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[Non 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, api_version=api_version, cls=lambda x, y, z: x, @@ -608,6 +619,7 @@ def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[Non params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -634,8 +646,8 @@ def _update_initial( resource_group_name: str, partner_configuration_update_parameters: Union[_models.PartnerConfigurationUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.PartnerConfiguration: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +660,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.PartnerConfiguration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -670,10 +682,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -681,14 +693,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -795,10 +807,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -842,7 +855,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +873,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -876,7 +888,6 @@ def prepare_request(next_link=None): _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 @@ -936,7 +947,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -955,7 +966,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -971,7 +981,6 @@ def prepare_request(next_link=None): _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 @@ -1070,7 +1079,7 @@ def authorize_partner( :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1103,7 +1112,6 @@ def authorize_partner( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1117,7 +1125,7 @@ def authorize_partner( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1194,7 +1202,7 @@ def unauthorize_partner( :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1227,7 +1235,6 @@ def unauthorize_partner( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1241,7 +1248,7 @@ def unauthorize_partner( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerConfiguration", pipeline_response) + deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py deleted file mode 100644 index 7234261bc60e..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py +++ /dev/null @@ -1,1151 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license 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_get_request( - resource_group_name: str, partner_destination_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "partnerDestinationName": _SERIALIZER.url( - "partner_destination_name", - partner_destination_name, - "str", - max_length=50, - min_length=3, - pattern=r"^[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, partner_destination_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", "2024-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "partnerDestinationName": _SERIALIZER.url( - "partner_destination_name", - partner_destination_name, - "str", - max_length=50, - min_length=3, - pattern=r"^[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_delete_request( - resource_group_name: str, partner_destination_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "partnerDestinationName": _SERIALIZER.url( - "partner_destination_name", - partner_destination_name, - "str", - max_length=50, - min_length=3, - pattern=r"^[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_update_request( - resource_group_name: str, partner_destination_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", "2024-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "partnerDestinationName": _SERIALIZER.url( - "partner_destination_name", - partner_destination_name, - "str", - max_length=50, - min_length=3, - pattern=r"^[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, *, filter: Optional[str] = None, top: Optional[int] = None, **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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - - # 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, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - **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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_activate_request( - resource_group_name: str, partner_destination_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "partnerDestinationName": _SERIALIZER.url( - "partner_destination_name", - partner_destination_name, - "str", - max_length=50, - min_length=3, - pattern=r"^[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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PartnerDestinationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.eventgrid.EventGridManagementClient`'s - :attr:`partner_destinations` 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, resource_group_name: str, partner_destination_name: str, **kwargs: Any) -> _models.PartnerDestination: - """Get a partner destination. - - Get properties of a partner destination. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :return: PartnerDestination or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination - :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.PartnerDestination] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: Union[_models.PartnerDestination, IO[bytes]], - **kwargs: Any - ) -> _models.PartnerDestination: - 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.PartnerDestination] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(partner_destination, (IOBase, bytes)): - _content = partner_destination - else: - _json = self._serialize.body(partner_destination, "PartnerDestination") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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("PartnerDestination", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: _models.PartnerDestination, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PartnerDestination]: - """Create a partner destination. - - Asynchronously creates a new partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination: Partner destination create information. Required. - :type partner_destination: ~azure.mgmt.eventgrid.models.PartnerDestination - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PartnerDestination]: - """Create a partner destination. - - Asynchronously creates a new partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination: Partner destination create information. Required. - :type partner_destination: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination: Union[_models.PartnerDestination, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PartnerDestination]: - """Create a partner destination. - - Asynchronously creates a new partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination: Partner destination create information. Is either a - PartnerDestination type or a IO[bytes] type. Required. - :type partner_destination: ~azure.mgmt.eventgrid.models.PartnerDestination or IO[bytes] - :return: An instance of LROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestination] = 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, - partner_destination_name=partner_destination_name, - partner_destination=partner_destination, - 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("PartnerDestination", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - 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[_models.PartnerDestination].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PartnerDestination]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, partner_destination_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, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, partner_destination_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a partner destination. - - Delete existing partner destination. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :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, - partner_destination_name=partner_destination_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, {}) # type: ignore - - 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[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: Union[_models.PartnerDestinationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.PartnerDestination: - 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.PartnerDestination] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(partner_destination_update_parameters, (IOBase, bytes)): - _content = partner_destination_update_parameters - else: - _json = self._serialize.body(partner_destination_update_parameters, "PartnerDestinationUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: _models.PartnerDestinationUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PartnerDestination]: - """Update a partner destination. - - Asynchronously updates a partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination_update_parameters: Partner destination update information. Required. - :type partner_destination_update_parameters: - ~azure.mgmt.eventgrid.models.PartnerDestinationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PartnerDestination]: - """Update a partner destination. - - Asynchronously updates a partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination_update_parameters: Partner destination update information. Required. - :type partner_destination_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - partner_destination_name: str, - partner_destination_update_parameters: Union[_models.PartnerDestinationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PartnerDestination]: - """Update a partner destination. - - Asynchronously updates a partner destination with the specified parameters. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :param partner_destination_update_parameters: Partner destination update information. Is either - a PartnerDestinationUpdateParameters type or a IO[bytes] type. Required. - :type partner_destination_update_parameters: - ~azure.mgmt.eventgrid.models.PartnerDestinationUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either PartnerDestination or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestination] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - partner_destination_update_parameters=partner_destination_update_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("PartnerDestination", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - 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[_models.PartnerDestination].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PartnerDestination]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_subscription( - self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.PartnerDestination"]: - """List partner destinations under an Azure subscription. - - List all the partner destinations under an Azure subscription. - - :param filter: The query used to filter the search results using OData syntax. Filtering is - permitted on the 'name' property only and with limited number of OData operations. These - operations are: the 'contains' function as well as the following logical operations: not, and, - or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The - following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. - The following is not a valid filter example: $filter=location eq 'westus'. Default value is - None. - :type filter: str - :param top: The number of results to return per page for the list operation. Valid range for - top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 - items per page. Default value is None. - :type top: int - :return: An iterator like instance of either PartnerDestination or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestinationsListResult] = 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, - filter=filter, - top=top, - api_version=api_version, - 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("PartnerDestinationsListResult", 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) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.PartnerDestination"]: - """List partner destinations under a resource group. - - List all the partner destinations under a resource group. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param filter: The query used to filter the search results using OData syntax. Filtering is - permitted on the 'name' property only and with limited number of OData operations. These - operations are: the 'contains' function as well as the following logical operations: not, and, - or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The - following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. - The following is not a valid filter example: $filter=location eq 'westus'. Default value is - None. - :type filter: str - :param top: The number of results to return per page for the list operation. Valid range for - top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 - items per page. Default value is None. - :type top: int - :return: An iterator like instance of either PartnerDestination or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerDestination] - :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.PartnerDestinationsListResult] = 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, - filter=filter, - top=top, - api_version=api_version, - 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("PartnerDestinationsListResult", 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) - - @distributed_trace - def activate( - self, resource_group_name: str, partner_destination_name: str, **kwargs: Any - ) -> _models.PartnerDestination: - """Activate a partner destination. - - Activate a newly created partner destination. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param partner_destination_name: Name of the partner destination. Required. - :type partner_destination_name: str - :return: PartnerDestination or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination - :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.PartnerDestination] = kwargs.pop("cls", None) - - _request = build_activate_request( - resource_group_name=resource_group_name, - partner_destination_name=partner_destination_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("PartnerDestination", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py index c42f1193cba2..8dadb8c39ecd 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +81,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -110,7 +115,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +146,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -175,7 +180,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +215,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +249,7 @@ def build_list_shared_access_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,7 +280,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -337,7 +342,7 @@ def get(self, resource_group_name: str, partner_namespace_name: str, **kwargs: A :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +364,6 @@ def get(self, resource_group_name: str, partner_namespace_name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +378,7 @@ def get(self, resource_group_name: str, partner_namespace_name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -387,8 +391,8 @@ def _create_or_update_initial( partner_namespace_name: str, partner_namespace_info: Union[_models.PartnerNamespace, IO[bytes]], **kwargs: Any - ) -> _models.PartnerNamespace: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +405,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PartnerNamespace] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -422,10 +426,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -433,11 +437,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("PartnerNamespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -550,10 +558,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -575,10 +584,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +597,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -600,10 +607,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -611,6 +618,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -619,8 +630,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any) -> LROPoller[None]: @@ -646,7 +661,7 @@ def begin_delete(self, resource_group_name: str, partner_namespace_name: str, ** 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, partner_namespace_name=partner_namespace_name, api_version=api_version, @@ -655,6 +670,7 @@ def begin_delete(self, resource_group_name: str, partner_namespace_name: str, ** params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -682,8 +698,8 @@ def _update_initial( partner_namespace_name: str, partner_namespace_update_parameters: Union[_models.PartnerNamespaceUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PartnerNamespace]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +712,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.PartnerNamespace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -717,10 +733,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,13 +744,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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 - if response.status_code == 201: - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -849,10 +867,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerNamespace", pipeline_response) + deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -904,7 +923,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -923,7 +942,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -939,7 +957,6 @@ def prepare_request(next_link=None): _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 @@ -1002,7 +1019,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1022,7 +1039,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1038,7 +1054,6 @@ def prepare_request(next_link=None): _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 @@ -1085,7 +1100,7 @@ def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1107,7 +1122,6 @@ def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1122,7 +1136,7 @@ def list_shared_access_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1212,7 +1226,7 @@ def regenerate_key( :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1246,7 +1260,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1261,7 +1274,7 @@ def regenerate_key( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py index e13c7b90f3c2..4bc80807d225 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +81,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +114,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -135,7 +140,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +174,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,7 +211,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +275,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +297,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -306,7 +310,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,8 +323,8 @@ def _create_or_update_initial( partner_registration_name: str, partner_registration_info: Union[_models.PartnerRegistration, IO[bytes]], **kwargs: Any - ) -> _models.PartnerRegistration: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +337,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PartnerRegistration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -354,10 +358,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -365,20 +369,17 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PartnerRegistration", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @@ -488,10 +489,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -513,10 +515,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, partner_registration_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +530,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -538,10 +540,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -549,6 +551,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -556,8 +562,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, partner_registration_name: str, **kwargs: Any) -> LROPoller[None]: @@ -583,7 +593,7 @@ def begin_delete(self, resource_group_name: str, partner_registration_name: str, 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, partner_registration_name=partner_registration_name, api_version=api_version, @@ -592,6 +602,7 @@ def begin_delete(self, resource_group_name: str, partner_registration_name: str, params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -619,8 +630,8 @@ def _update_initial( partner_registration_name: str, partner_registration_update_parameters: Union[_models.PartnerRegistrationUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PartnerRegistration]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +644,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.PartnerRegistration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -654,10 +665,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -665,12 +676,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,10 +800,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PartnerRegistration", pipeline_response) + deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -842,7 +856,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -861,7 +875,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -877,7 +890,6 @@ def prepare_request(next_link=None): _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 @@ -939,7 +951,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -959,7 +971,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -975,7 +986,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py index a0f78037ab34..671a1c6eff81 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +82,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -111,7 +116,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -138,7 +143,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -173,7 +178,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +216,7 @@ def build_list_by_partner_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +251,7 @@ def build_get_delivery_attributes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -347,7 +351,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -361,8 +365,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +379,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -397,10 +401,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -408,14 +412,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -549,10 +553,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -574,10 +579,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, partner_topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +594,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -600,10 +605,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -611,6 +616,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -618,8 +627,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -649,7 +662,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, partner_topic_name=partner_topic_name, event_subscription_name=event_subscription_name, @@ -659,6 +672,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -687,8 +701,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +715,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -723,10 +737,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -734,10 +748,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,10 +880,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -906,7 +925,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -929,7 +948,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +961,7 @@ def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -990,7 +1008,7 @@ def list_by_partner_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1011,7 +1029,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1027,7 +1044,6 @@ def prepare_request(next_link=None): _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 @@ -1075,7 +1091,7 @@ def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1098,7 +1114,6 @@ def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1127,7 @@ def get_delivery_attributes( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py index a6ce194d46e5..c2672d345e65 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +81,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +114,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -135,7 +140,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +174,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +209,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +243,7 @@ def build_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -269,7 +274,7 @@ def build_deactivate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -328,7 +333,7 @@ def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +355,6 @@ def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -364,7 +368,7 @@ def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +457,7 @@ def create_or_update( :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +491,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -501,21 +504,15 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PartnerTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, partner_topic_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,7 +524,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -537,10 +534,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -548,6 +545,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -555,8 +556,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) -> LROPoller[None]: @@ -582,7 +587,7 @@ def begin_delete(self, resource_group_name: str, partner_topic_name: str, **kwar 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, partner_topic_name=partner_topic_name, api_version=api_version, @@ -591,6 +596,7 @@ def begin_delete(self, resource_group_name: str, partner_topic_name: str, **kwar params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -696,7 +702,7 @@ def update( :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -730,7 +736,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -746,7 +751,7 @@ def update( deserialized = None if response.status_code == 201: - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -783,7 +788,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +807,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -818,7 +822,6 @@ def prepare_request(next_link=None): _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 @@ -880,7 +883,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -900,7 +903,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -916,7 +918,6 @@ def prepare_request(next_link=None): _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 @@ -960,7 +961,7 @@ def activate(self, resource_group_name: str, partner_topic_name: str, **kwargs: :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -982,7 +983,6 @@ def activate(self, resource_group_name: str, partner_topic_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -996,7 +996,7 @@ def activate(self, resource_group_name: str, partner_topic_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1018,7 +1018,7 @@ def deactivate(self, resource_group_name: str, partner_topic_name: str, **kwargs :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1040,7 +1040,6 @@ def deactivate(self, resource_group_name: str, partner_topic_name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1054,7 +1053,7 @@ def deactivate(self, resource_group_name: str, partner_topic_name: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PartnerTopic", pipeline_response) + deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py index ff78cb3b2b5c..440c3b4c55e8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +90,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +134,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +181,7 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +250,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.PermissionBinding :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +273,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +287,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PermissionBinding", pipeline_response) + deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,8 +301,8 @@ def _create_or_update_initial( permission_binding_name: str, permission_binding_info: Union[_models.PermissionBinding, IO[bytes]], **kwargs: Any - ) -> _models.PermissionBinding: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -312,7 +315,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.PermissionBinding] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +337,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +348,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("PermissionBinding", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PermissionBinding", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,10 +479,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PermissionBinding", pipeline_response) + deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -503,10 +507,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, permission_binding_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -518,7 +522,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -529,10 +533,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -540,6 +544,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -548,8 +556,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -579,7 +591,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, permission_binding_name=permission_binding_name, @@ -589,6 +601,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -652,7 +665,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PermissionBindingsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -689,7 +701,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py index 87b0985fc387..482e749bd67c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +54,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +94,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +136,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -169,7 +173,7 @@ def build_list_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,9 +239,9 @@ def get( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -249,7 +253,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +277,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +290,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -302,8 +305,8 @@ def _update_initial( private_endpoint_connection_name: str, private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,7 +319,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -339,10 +342,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -350,14 +353,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,9 +386,9 @@ def begin_update( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -423,9 +426,9 @@ def begin_update( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -461,9 +464,9 @@ def begin_update( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -503,10 +506,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -528,15 +532,15 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, parent_type: Union[str, _models.PrivateEndpointConnectionsParentType], parent_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +552,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -560,10 +564,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -571,6 +575,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -578,8 +586,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -598,9 +610,9 @@ def begin_delete( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -621,7 +633,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, parent_type=parent_type, parent_name=parent_name, @@ -632,6 +644,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -670,9 +683,9 @@ def list_by_resource( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains", - "partnerNamespaces", and "namespaces". Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics", + "domains", "partnerNamespaces", and "namespaces". Required. :type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -700,7 +713,7 @@ def list_by_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +735,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -738,7 +750,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py index 3d44a225f4de..a1ae4c06e055 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +89,7 @@ def build_list_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,8 +154,8 @@ def get( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required. :type parent_type: str :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or namespace name). Required. @@ -165,7 +167,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,7 +191,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -203,7 +204,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,8 +228,8 @@ def list_by_resource( :param resource_group_name: The name of the resource group within the user's subscription. Required. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be either \'topics\', - \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required. + :param parent_type: The type of the parent resource. This can be either \\'topics\\', + \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required. :type parent_type: str :param parent_name: The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace name). Required. @@ -255,7 +256,7 @@ def list_by_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +278,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +293,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py index c0aeff3e6e02..1942433edfed 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,45 +44,13 @@ _SERIALIZER.client_side_validation = False -def build_get_delivery_attributes_request( - resource_group_name: str, system_topic_name: str, event_subscription_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _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_get_request( resource_group_name: str, system_topic_name: str, event_subscription_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", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +82,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,7 +116,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -170,7 +143,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +178,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,7 +216,7 @@ def build_list_by_system_topic_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,6 +245,38 @@ def build_list_by_system_topic_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_delivery_attributes_request( + resource_group_name: str, system_topic_name: str, event_subscription_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", "2025-02-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, "str"), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), + } + + _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) + + class SystemTopicEventSubscriptionsOperations: """ .. warning:: @@ -291,69 +296,6 @@ 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 get_delivery_attributes( - self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> _models.DeliveryAttributeListResult: - """Get delivery attributes for an event subscription. - - Get all delivery attributes for an event subscription. - - :param resource_group_name: The name of the resource group within the user's subscription. - Required. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. Required. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription. Required. - :type event_subscription_name: str - :return: DeliveryAttributeListResult or the result of cls(response) - :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult - :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.DeliveryAttributeListResult] = kwargs.pop("cls", None) - - _request = build_get_delivery_attributes_request( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - event_subscription_name=event_subscription_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def get( self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any @@ -373,7 +315,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +338,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +351,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,8 +365,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +379,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -460,10 +401,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -471,10 +412,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -608,10 +553,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -633,10 +579,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +594,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -659,10 +605,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -670,6 +616,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -677,8 +627,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -708,7 +662,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, system_topic_name=system_topic_name, event_subscription_name=event_subscription_name, @@ -718,6 +672,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -746,8 +701,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -760,7 +715,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -782,10 +737,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -793,10 +748,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -921,10 +880,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -965,7 +925,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -988,7 +948,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1002,7 +961,7 @@ def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1049,7 +1008,7 @@ def list_by_system_topic( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1070,7 +1029,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1086,7 +1044,6 @@ def prepare_request(next_link=None): _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 @@ -1114,3 +1071,65 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_delivery_attributes( + self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any + ) -> _models.DeliveryAttributeListResult: + """Get delivery attributes for an event subscription. + + Get all delivery attributes for an event subscription. + + :param resource_group_name: The name of the resource group within the user's subscription. + Required. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. Required. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription. Required. + :type event_subscription_name: str + :return: DeliveryAttributeListResult or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.DeliveryAttributeListResult] = kwargs.pop("cls", None) + + _request = build_get_delivery_attributes_request( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py index 23da48b6116c..21ee21d79b9c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +81,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +114,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -135,7 +140,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +174,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +209,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -266,7 +271,7 @@ def get(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) - :rtype: ~azure.mgmt.eventgrid.models.SystemTopic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +293,6 @@ def get(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +306,7 @@ def get(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = self._deserialize("SystemTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -315,8 +319,8 @@ def _create_or_update_initial( system_topic_name: str, system_topic_info: Union[_models.SystemTopic, IO[bytes]], **kwargs: Any - ) -> _models.SystemTopic: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +333,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.SystemTopic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,10 +354,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -361,14 +365,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SystemTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -481,10 +485,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = self._deserialize("SystemTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -506,10 +511,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, system_topic_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +524,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -531,10 +534,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -542,6 +545,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -549,8 +556,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -> LROPoller[None]: @@ -576,7 +587,7 @@ def begin_delete(self, resource_group_name: str, system_topic_name: str, **kwarg 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, system_topic_name=system_topic_name, api_version=api_version, @@ -585,6 +596,7 @@ def begin_delete(self, resource_group_name: str, system_topic_name: str, **kwarg params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -612,8 +624,8 @@ def _update_initial( system_topic_name: str, system_topic_update_parameters: Union[_models.SystemTopicUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.SystemTopic: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -626,7 +638,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.SystemTopic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -647,10 +659,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -658,14 +670,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SystemTopic", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -779,10 +791,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SystemTopic", pipeline_response) + deserialized = self._deserialize("SystemTopic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -834,7 +847,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -853,7 +866,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -869,7 +881,6 @@ def prepare_request(next_link=None): _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 @@ -931,7 +942,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -951,7 +962,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -967,7 +977,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py index ddff0b6190c3..264a0c019182 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_get_delivery_attributes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,7 +148,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -170,7 +175,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +210,7 @@ def build_get_full_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,7 +248,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def get_delivery_attributes( :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,6 @@ def get_delivery_attributes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -347,7 +351,7 @@ def get_delivery_attributes( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response) + deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,7 +377,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.EventSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +400,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +413,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,8 +427,8 @@ def _create_or_update_initial( event_subscription_name: str, event_subscription_info: Union[_models.EventSubscription, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +441,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -460,10 +463,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -471,14 +474,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EventSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -609,10 +612,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -634,10 +638,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +653,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -660,10 +664,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -671,6 +675,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -678,8 +686,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -709,7 +721,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, topic_name=topic_name, event_subscription_name=event_subscription_name, @@ -719,6 +731,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -747,8 +760,8 @@ def _update_initial( event_subscription_name: str, event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.EventSubscription: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -761,7 +774,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.EventSubscription] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -783,10 +796,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -794,10 +807,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -922,10 +939,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EventSubscription", pipeline_response) + deserialized = self._deserialize("EventSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -966,7 +984,7 @@ def get_full_url( :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -989,7 +1007,6 @@ def get_full_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1003,7 +1020,7 @@ def get_full_url( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response) + deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1050,7 +1067,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1071,7 +1088,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1087,7 +1103,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py index 1f931c1c7805..8eaef440486c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +166,7 @@ def build_list_by_namespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +235,7 @@ def get( :rtype: ~azure.mgmt.eventgrid.models.TopicSpace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +258,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -269,7 +272,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicSpace", pipeline_response) + deserialized = self._deserialize("TopicSpace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -283,8 +286,8 @@ def _create_or_update_initial( topic_space_name: str, topic_space_info: Union[_models.TopicSpace, IO[bytes]], **kwargs: Any - ) -> _models.TopicSpace: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +300,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.TopicSpace] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -319,10 +322,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -330,15 +333,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, 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("TopicSpace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("TopicSpace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -458,10 +461,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TopicSpace", pipeline_response) + deserialized = self._deserialize("TopicSpace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -485,10 +489,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, namespace_name: str, topic_space_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,7 +504,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -511,10 +515,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -522,6 +526,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -530,8 +538,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -561,7 +573,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, namespace_name=namespace_name, topic_space_name=topic_space_name, @@ -571,6 +583,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -634,7 +647,7 @@ def list_by_namespace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicSpacesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +668,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -671,7 +683,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py index 5c0e9876c2d0..240ff7f92914 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +61,7 @@ def build_get_request(topic_type_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", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +85,7 @@ def build_list_event_types_request(topic_type_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +140,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.TopicTypeInfo"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicTypesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +156,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -170,7 +171,6 @@ def prepare_request(next_link=None): _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 @@ -211,7 +211,7 @@ def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInfo: :rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +231,6 @@ def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInfo: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -245,7 +244,7 @@ def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInfo: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicTypeInfo", pipeline_response) + deserialized = self._deserialize("TopicTypeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -270,7 +269,7 @@ def list_event_types(self, topic_type_name: str, **kwargs: Any) -> Iterable["_mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,7 +286,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -303,7 +301,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py index bbc051e8c748..58c642cf8eea 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_get_request(resource_group_name: str, topic_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +79,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +110,7 @@ def build_create_or_update_request( def build_delete_request(resource_group_name: str, topic_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) # Construct URL _url = kwargs.pop( "template_url", @@ -129,7 +134,7 @@ def build_update_request(resource_group_name: str, topic_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -163,7 +168,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +203,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +237,7 @@ def build_list_shared_access_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +268,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -302,7 +307,7 @@ def build_list_event_types_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -363,7 +368,7 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.eventgrid.models.Topic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +390,6 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -399,7 +403,7 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = self._deserialize("Topic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,8 +412,8 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode def _create_or_update_initial( self, resource_group_name: str, topic_name: str, topic_info: Union[_models.Topic, IO[bytes]], **kwargs: Any - ) -> _models.Topic: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +426,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_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.Topic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -443,10 +447,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -454,10 +458,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -562,10 +570,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = self._deserialize("Topic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -587,10 +596,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, topic_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -602,7 +609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -612,10 +619,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -623,6 +630,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -630,8 +641,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> LROPoller[None]: @@ -657,7 +672,7 @@ def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any) 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, topic_name=topic_name, api_version=api_version, @@ -666,6 +681,7 @@ def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -693,8 +709,8 @@ def _update_initial( topic_name: str, topic_update_parameters: Union[_models.TopicUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Topic]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -707,7 +723,7 @@ def _update_initial( api_version: str = kwargs.pop("api_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.Topic]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -728,10 +744,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -739,12 +755,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,10 +872,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Topic", pipeline_response) + deserialized = self._deserialize("Topic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -909,7 +928,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -928,7 +947,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -944,7 +962,6 @@ def prepare_request(next_link=None): _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 @@ -1006,7 +1023,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1026,7 +1043,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1042,7 +1058,6 @@ def prepare_request(next_link=None): _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 @@ -1088,7 +1103,7 @@ def list_shared_access_keys( :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1125,6 @@ def list_shared_access_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1124,7 +1138,7 @@ def list_shared_access_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1137,8 +1151,8 @@ def _regenerate_key_initial( topic_name: str, regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TopicSharedAccessKeys]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1165,7 @@ def _regenerate_key_initial( api_version: str = kwargs.pop("api_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.TopicSharedAccessKeys]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1172,10 +1186,10 @@ def _regenerate_key_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1183,17 +1197,19 @@ def _regenerate_key_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1306,10 +1322,11 @@ def begin_regenerate_key( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response) + deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1363,7 +1380,7 @@ def list_event_types( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1384,7 +1401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1400,7 +1416,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py index d8f7c10ad09a..c04506a273d2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,7 @@ def build_get_request(verified_partner_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", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +66,7 @@ def build_list_request(*, filter: Optional[str] = None, top: Optional[int] = Non _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +116,7 @@ def get(self, verified_partner_name: str, **kwargs: Any) -> _models.VerifiedPart :rtype: ~azure.mgmt.eventgrid.models.VerifiedPartner :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +136,6 @@ def get(self, verified_partner_name: str, **kwargs: Any) -> _models.VerifiedPart headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -148,7 +149,7 @@ def get(self, verified_partner_name: str, **kwargs: Any) -> _models.VerifiedPart map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VerifiedPartner", pipeline_response) + deserialized = self._deserialize("VerifiedPartner", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -185,7 +186,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VerifiedPartnersListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +204,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -219,7 +219,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py index afdaa054f508..1325729b11e4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -46,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/CaCertificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py index 4e882eb7e5a9..76a92c5a4195 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/CaCertificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py index fc43d7a2a108..60cb0b86bfea 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/CaCertificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py index 80e854aa8013..4cadf2deecd2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_ListByNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/CaCertificates_ListByNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py index 801272deb41d..dadd5f900cd1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.channels.create_or_update( @@ -42,7 +40,7 @@ def main(): "expirationTimeIfNotActivatedUtc": "2021-10-21T22:50:25.410433Z", "messageForActivation": "Example message to approver", "partnerTopicInfo": { - "azureSubscriptionId": "8f6b6269-84f2-4d09-9e31-1127efcd1e40", + "azureSubscriptionId": "5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "name": "examplePartnerTopic1", "resourceGroupName": "examplerg2", "source": "ContosoCorp.Accounts.User1", @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Channels_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py index 60e6d104a04b..b73bd76f8831 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.channels.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Channels_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py index 1cb34fa49040..813c2a13fb85 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.channels.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Channels_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py index 5550e19f372c..a3fe2621e9ff 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.channels.get_full_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Channels_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py index a9b477d43028..90884021d3d1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.channels.list_by_partner_namespace( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_ListByPartnerNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Channels_ListByPartnerNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py index 66204cbd5dba..b183ce7cfed5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.channels.update( @@ -40,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Channels_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py index b1e7c5d2f384..284754c3edcd 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/ClientGroups_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py index 8bf37ce0a9d1..9cdab016b953 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/ClientGroups_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py index cfcf43d62288..db6ea73b9071 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/ClientGroups_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py index 1beb30c03eaa..3d73f7c1d4b2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_ListByNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/ClientGroups_ListByNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py index dfa704641b7e..fb539b613559 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Clients_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py index 064496815e32..014a73a2e7c4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Clients_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py index 890159d80f36..c09e6df3149e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Clients_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py index f8e23762a1d1..108b5e6ca2de 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_ListByNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Clients_ListByNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py index 18c3bf41c576..1792bca80e00 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_event_subscriptions.begin_create_or_update( @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py index f26770e2f62d..f9ac5563fdd5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.domain_event_subscriptions.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py index 763e1e67ad70..b4f185da1d44 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_event_subscriptions.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py index 12df13cfa5d9..bd5ed87ab455 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_event_subscriptions.get_delivery_attributes( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py index 172dbbe7349e..8ed6462bd7ce 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_event_subscriptions.get_full_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py index e0ccc3f698a0..c9b622b28d4f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_event_subscriptions.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_List.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_List.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py index b9d5931a01ad..bd8c8665fbb5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_event_subscriptions.begin_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainEventSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py index bcd3a4860f23..de6c38a82492 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topic_event_subscriptions.begin_create_or_update( @@ -54,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py index 22db1b809f32..0052931bcdc0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.domain_topic_event_subscriptions.begin_delete( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py index 5302ced1e526..10bb4669b847 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topic_event_subscriptions.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py index dfa1293961e4..12e32fd6aa64 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topic_event_subscriptions.get_delivery_attributes( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py index 3d98ace751e4..5aa0585f8d8b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topic_event_subscriptions.get_full_url( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py index d12d74fa35d3..0ba3b2df2b22 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topic_event_subscriptions.list( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_List.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_List.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py index c258666fc71e..9cac5709947e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topic_event_subscriptions.begin_update( @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopicEventSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py index 36d492d17a2f..9dcfd2064797 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topics.begin_create_or_update( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopics_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py index b1d067ec806b..be66e50f9e89 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.domain_topics.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py index b89f065d44d3..2ab1bb2aeecc 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topics.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopics_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py index 6ca1e08f0a92..4e8445c49e7e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domain_topics.list_by_domain( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_ListByDomain.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/DomainTopics_ListByDomain.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py index 4e94fcf98dd5..bd6a50bab6d3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.begin_create_or_update( @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py index efdb05c41ae2..2f60e814c873 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.domains.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py index bd7c1aa27465..db203beae2e4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py index aaf30fbf44a0..5ea425c9649e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py index 63c57ad3d365..a38a6c9ae64d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py index ada61320b039..b26ccfee4b39 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.list_shared_access_keys( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_ListSharedAccessKeys.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_ListSharedAccessKeys.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py index 01cb8758e161..f6d64d67c091 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.regenerate_key( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_RegenerateKey.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py index 617427b6e4de..99500cbdc808 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.domains.begin_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Domains_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py index ac4b2d899864..7ea01bc405ac 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -54,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py index d91d9503b71e..ae44e2f6ac3e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -61,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py index da0589305bf0..0dd177f00670 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -61,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py index a173f74e38c5..ff86e55e23ea 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -61,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py index 1aedd1a57c83..becf5649fa3c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -61,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py index af6298eac124..7950d5322309 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -61,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py index 14e2347d5cc3..86b75b471d6c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { @@ -47,7 +45,6 @@ def main(): "destination": { "endpointType": "StorageQueue", "properties": { - "queueMessageTimeToLiveInSeconds": 300, "queueName": "queue1", "resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg", }, @@ -63,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py index 2a579c204791..727ea52801ec 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,14 +31,14 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_info={ "properties": { "destination": { - "endpointType": "EventHub", + "endpointType": "WebHook", "properties": { - "resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1" + "endpointUrl": "https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE" }, }, "filter": { @@ -54,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py index 6f92a40ed2f9..17242707e478 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", event_subscription_name="examplesubscription10", event_subscription_info={ "properties": { @@ -52,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py index 7c53cc127c42..1a0fa4bb14a6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", event_subscription_name="examplesubscription2", event_subscription_info={ "properties": { @@ -52,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py index d0bace5a713e..9fda68d37960 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_create_or_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", event_subscription_name="examplesubscription3", event_subscription_info={ "properties": { @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForSubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py index 3d0f076533a1..66d75a5869aa 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py @@ -31,11 +31,11 @@ def main(): ) client.event_subscriptions.begin_delete( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForCustomTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_DeleteForCustomTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py index fd955ebab918..5af5c64f990a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py @@ -31,11 +31,11 @@ def main(): ) client.event_subscriptions.begin_delete( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", event_subscription_name="examplesubscription10", ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_DeleteForResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py index b54e8ca6a2b0..b7a762361b59 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py @@ -31,11 +31,11 @@ def main(): ) client.event_subscriptions.begin_delete( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", event_subscription_name="examplesubscription2", ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_DeleteForResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py index 279077d81ca6..376e57e0a327 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py @@ -31,11 +31,11 @@ def main(): ) client.event_subscriptions.begin_delete( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", event_subscription_name="examplesubscription3", ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForSubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_DeleteForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py index 9d18f91c10a8..9a2dc9049608 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get_delivery_attributes( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", - event_subscription_name="examplesubscription1", + scope="aaaaaaaaaaaaaaaaaaaaaaaaa", + event_subscription_name="aaaaaaaaaaaaaaaaaa", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py index 84ff68d157b6..fbb8ee37bc8d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py index ee5b650e1276..9e801489ca9c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py index 395691fff266..f8124ed7b444 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py index e42c24ccab9b..edcb1ae5b5c7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py index 7cfc389efdb4..35326fff83e1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py index 3458c5036516..3cfe47c04a1e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py index f2633e3b02cd..689777ae3aa8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py index 0abf5b9614be..47c8b0cf6a53 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py index 77d7fde02bfd..c36e3150ab20 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py index 20be22e2fb29..7142c6ce62a5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", event_subscription_name="examplesubscription2", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py index a1b8bb15ce3b..d760a4b93661 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", event_subscription_name="examplesubscription3", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForSubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py index fb2e0e5b2598..e7a99c7736ea 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get_full_url( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForCustomTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetFullUrlForCustomTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py index ebfc57bfac49..e1fc948cff2f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get_full_url( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", event_subscription_name="examplesubscription1", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetFullUrlForResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py index f944ef5f2e64..5875086f9c24 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get_full_url( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", event_subscription_name="examplesubscription2", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetFullUrlForResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py index 28625bcb6a39..e1cc001fc0a1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py @@ -31,12 +31,12 @@ def main(): ) response = client.event_subscriptions.get_full_url( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", event_subscription_name="examplesubscription3", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForSubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_GetFullUrlForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py index 0cf82cd7555d..f998cb1a22d7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_by_domain_topic( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListByDomainTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListByDomainTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py index 98427f3d6e84..f5b71016b90e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_by_resource( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListByResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListByResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py index 07e856c0fdb2..b2a595796593 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_global_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListGlobalByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py index c0173d24f89f..d97ea383bb9e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_global_by_resource_group_for_topic_type( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalByResourceGroupForTopicType.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListGlobalByResourceGroupForTopicType.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py index 40246da98072..c8238acd1d25 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_global_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListGlobalBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py index cfec8676e71f..743114cf0934 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_global_by_subscription_for_topic_type( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalBySubscriptionForTopicType.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListGlobalBySubscriptionForTopicType.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py index db2703bc58b0..82a77dbea645 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_regional_by_resource_group( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListRegionalByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py index 0804786c5c26..254c6b1f2938 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_regional_by_resource_group_for_topic_type( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalByResourceGroupForTopicType.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListRegionalByResourceGroupForTopicType.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py index 3533692d8df2..412b4e7dda2b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_regional_by_subscription( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListRegionalBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py index a0860908f4f9..0d371fa93902 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.event_subscriptions.list_regional_by_subscription_for_topic_type( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalBySubscriptionForTopicType.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_ListRegionalBySubscriptionForTopicType.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py index 3ae4692ccee8..b31798afc460 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}}, @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py index ca1e053f5967..5272d2b0fb00 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "deadLetterDestination": { @@ -59,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py index c5b5c5e00ece..91a9b6fd8c31 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "destination": { @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py index 61570c47086e..ca2c65669dff 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "destination": { @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py index f8540f0f4571..3e403ef26970 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "deadLetterDestination": { @@ -59,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py index 1049d6c6c239..f87c9b44d429 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "destination": { @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py index 122036ce1770..5511f31deb6e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "deadLetterDestination": { @@ -61,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py index 7eb9ed1f0186..45ec3af85596 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}}, @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py index 8e5ed94ad0d4..9f56e1256b71 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", event_subscription_name="examplesubscription1", event_subscription_update_parameters={ "destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}}, @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py index 1fe1bd0f29f8..f44d9eb9a98d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", event_subscription_name="examplesubscription2", event_subscription_update_parameters={ "destination": { @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py index f8291ac003d4..b88af3cf9778 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -33,7 +31,7 @@ def main(): ) response = client.event_subscriptions.begin_update( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", event_subscription_name="examplesubscription3", event_subscription_update_parameters={ "destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}}, @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForSubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/EventSubscriptions_UpdateForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py index 3af6efdf5109..99e08f5cb153 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py @@ -27,15 +27,15 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.extension_topics.get( - scope="subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default", + scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default", ) print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ExtensionTopics_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/ExtensionTopics_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py index 1f91a47cdb4c..3784ffa4a558 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py index c8028f06e430..6eef73b9ee22 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py index bdc488991d18..55b680ce71c8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py index d985649e15a6..f0a6665276bb 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py index ab8584c15c42..e88d23d8f872 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py index 3d4f0e4546a3..fcc7c567e5a0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_ListByNamespaceTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_ListByNamespaceTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py index 4d656d4630ad..dbd0ab3b3cbc 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopicEventSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py index 0c2ed8346283..c08f3dd39814 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py index 8c498b58dfb1..74237be1b47a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py index 3f041444c702..a5d46351abcb 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py index 08cae210b16e..bc6bab3fa663 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_ListByNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_ListByNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py index df897a5d76b3..93d68e899ecc 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_ListSharedAccessKeys.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_ListSharedAccessKeys.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py index 469c7b92f15d..d28ee066f78e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_RegenerateKey.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py index 602a9827b8b7..7a87cd9020b3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/NamespaceTopics_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py index b1c809d9229c..69e661c1f66c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py index 6f1d32f88b76..3aed465e9196 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py index 27cad8b8e1ee..17fd66e910f3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py index ed64c11a9bd0..b29304e337fb 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py index a07be92ee57a..e86dcfd9200a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py index 1113f529fa06..8042975c8a46 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ListSharedAccessKeys.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_ListSharedAccessKeys.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py index 434599fa18ef..4580ada119aa 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_RegenerateKey.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py index 48a78369eb4f..46e0b9e23a31 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py index 3c924649551f..a780c84f4997 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ValidateCustomDomainOwnership.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Namespaces_ValidateCustomDomainOwnership.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py deleted file mode 100644 index e57480d50f33..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.eventgrid import EventGridManagementClient - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python network_security_perimeter_configurations_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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.network_security_perimeter_configurations.get( - resource_group_name="examplerg", - resource_type="topics", - resource_name="exampleResourceName", - perimeter_guid="8f6b6269-84f2-4d09-9e31-1127efcd1e40perimeter", - association_name="someAssociation", - ) - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurations_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py deleted file mode 100644 index 201d1ccdfd96..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.eventgrid import EventGridManagementClient - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python network_security_perimeter_configurations_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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.network_security_perimeter_configurations.list( - resource_group_name="examplerg", - resource_type="topics", - resource_name="exampleResourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurations_List.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py deleted file mode 100644 index 3588fa58adec..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.eventgrid import EventGridManagementClient - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python network_security_perimeter_configurations_reconcile.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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.network_security_perimeter_configurations.begin_reconcile( - resource_group_name="examplerg", - resource_type="topics", - resource_name="exampleResourceName", - perimeter_guid="8f6b6269-84f2-4d09-9e31-1127efcd1e40perimeter", - association_name="someAssociation", - ).result() - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurations_Reconcile.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py index d9d4fb92ab38..b9ce2fc3a94a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py index ae8dc8224ee0..a177e40f12d9 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.authorize_partner( @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_AuthorizePartner.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_AuthorizePartner.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py index 6d6f11c8aaa6..9523369f407a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.begin_create_or_update( @@ -57,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py index 49e4a8d7e0c5..6f235fc0ef6a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.partner_configurations.begin_delete( @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py index bff1100db47f..668b4eb72a84 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py index 867614fab19d..13abf9efe6e3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py index c91be01db1af..4fd81a8429ca 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py index 7bb1ee07a640..0198f94e3f6b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.unauthorize_partner( @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_UnauthorizePartner.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_UnauthorizePartner.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py index 5e6fb4b44ab5..9304de4bc8e4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_configurations.begin_update( @@ -42,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerConfigurations_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py deleted file mode 100644 index 99234c2c2e2b..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.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.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_activate.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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.partner_destinations.activate( - resource_group_name="examplerg", - partner_destination_name="examplePartnerDestination1", - ) - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Activate.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py deleted file mode 100644 index 352e13d6df33..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_create_or_update.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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.partner_destinations.begin_create_or_update( - resource_group_name="examplerg", - partner_destination_name="examplePartnerDestinationName1", - partner_destination={ - "location": "westus2", - "properties": { - "endpointBaseUrl": "https://www.example/endpoint", - "endpointServiceContext": "This is an example", - "expirationTimeIfNotActivatedUtc": "2022-03-14T19:33:43.430Z", - "messageForActivation": "Sample Activation message", - "partnerRegistrationImmutableId": "0bd70ee2-7d95-447e-ab1f-c4f320019404", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py deleted file mode 100644 index fac47c42a17e..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py +++ /dev/null @@ -1,41 +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.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - client.partner_destinations.begin_delete( - resource_group_name="examplerg", - partner_destination_name="examplePartnerDestinationName1", - ).result() - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py deleted file mode 100644 index 038c5879cc8b..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_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.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.partner_destinations.get( - resource_group_name="examplerg", - partner_destination_name="examplePartnerDestinationName1", - ) - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py deleted file mode 100644 index 0283e27f5ed7..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.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.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.partner_destinations.list_by_resource_group( - resource_group_name="examplerg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_ListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py deleted file mode 100644 index 618d8ad1f8e9..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py +++ /dev/null @@ -1,40 +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.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.partner_destinations.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_ListBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py deleted file mode 100644 index 9f9bc291fcd5..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python partner_destinations_update.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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.partner_destinations.begin_update( - resource_group_name="examplerg", - partner_destination_name="examplePartnerDestinationName1", - partner_destination_update_parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Update.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py index ff8a2db3f235..b6fd177df9ef 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.begin_create_or_update( @@ -38,7 +36,7 @@ def main(): partner_namespace_info={ "location": "westus", "properties": { - "partnerRegistrationFullyQualifiedId": "/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1" + "partnerRegistrationFullyQualifiedId": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1" }, "tags": {"tag1": "value1", "tag2": "value2"}, }, @@ -46,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py index 50b44d588eb6..4286566ef28a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.partner_namespaces.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py index 054186657a59..634976156f29 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py index 9d00c00ad818..999cecd3e860 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py index b02cec14e7e4..47f2809a4293 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py index 2f762a414f75..03b9b20bf07a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.list_shared_access_keys( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_ListSharedAccessKeys.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_ListSharedAccessKeys.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py index 695721d91de8..b39918deb855 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.regenerate_key( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_RegenerateKey.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py index 7df4f30151d5..cbe315fc884f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_namespaces.begin_update( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerNamespaces_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py index 86ea0d5608d9..cddb8be69083 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_registrations.begin_create_or_update( @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerRegistrations_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py index 75e6c2097bcb..9ae51f80d748 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.partner_registrations.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerRegistrations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py index a848fb41cb76..99da8a11fcb9 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_registrations.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerRegistrations_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py index ee03518a1777..26167cf5c533 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_registrations.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerRegistrations_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py index c56890cd24c7..6a28e27b9fd7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_registrations.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerRegistrations_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py index efc68c3ee425..a5916cfd874a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,17 +27,17 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_registrations.begin_update( resource_group_name="examplerg", partner_registration_name="examplePartnerRegistrationName1", - partner_registration_update_parameters={"tags": {"NewKey": "NewValue"}}, + partner_registration_update_parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, ).result() print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerRegistrations_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py index b658645df99a..32658e146b64 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topic_event_subscriptions.begin_create_or_update( @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py index 998c713188e1..593f20820e0b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.partner_topic_event_subscriptions.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py index 1ea75dd129a1..41d78b1c3f70 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topic_event_subscriptions.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py index fb3c09398e35..402ffc392e62 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topic_event_subscriptions.get_delivery_attributes( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py index 3be1fc6ca985..d69c69e5c06b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topic_event_subscriptions.get_full_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py index 006b9bfe47a5..5db2d49d6dac 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topic_event_subscriptions.list_by_partner_topic( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_ListByPartnerTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_ListByPartnerTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py index 13d943828b19..221ecf9a71e3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topic_event_subscriptions.begin_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopicEventSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py index afcfbe291a91..fe933935085d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.activate( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Activate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_Activate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py index 027ae7d706e8..6a6d4f4ad952 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.create_or_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py index 5df6f53495ca..9e02c64dce26 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.deactivate( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Deactivate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_Deactivate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py index ff72e86f4a6e..2eb7d03252e6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.partner_topics.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py index 7f66fdd17c0c..8e947fcd0c08 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py index 35d5d1ac6cce..1c01cfbec908 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py index 0a389ca1daf3..300971bf36d2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py index 7d2e70a01034..07d4de5c0e74 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.partner_topics.update( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PartnerTopics_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py index 81b1e21ce88a..ddca20598dbf 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -47,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PermissionBindings_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py index 308bd6c3f665..fadf141dafd0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PermissionBindings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py index dec90fac3f4b..dac9286e0af7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PermissionBindings_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py index e9189eef41cc..abc6f2ba7926 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_ListByNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PermissionBindings_ListByNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py index fe19264fefdc..fa8b70b90f46 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -32,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.private_endpoint_connections.begin_delete( @@ -43,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PrivateEndpointConnections_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py index dda03916c088..b94e8da03287 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -32,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.private_endpoint_connections.get( @@ -44,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PrivateEndpointConnections_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py index e5dd25a7f9e0..d23b8175b6d4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -32,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.private_endpoint_connections.list_by_resource( @@ -44,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_ListByResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PrivateEndpointConnections_ListByResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py index 27c7d31732c4..f8060aee06e2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -32,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.private_endpoint_connections.begin_update( @@ -53,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PrivateEndpointConnections_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py index ff7232f4663b..ffd97be7c1a0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.private_link_resources.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateLinkResources_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PrivateLinkResources_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py index d0b135b18ba2..a05766e874f6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.private_link_resources.list_by_resource( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateLinkResources_ListByResource.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/PrivateLinkResources_ListByResource.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py index 9699db8e732a..6d03287a233f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topic_event_subscriptions.begin_create_or_update( @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py index 8fa1cd60651c..6638d9bae66d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.system_topic_event_subscriptions.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py index 8f940e37ec40..e6a1dc5475a8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topic_event_subscriptions.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py index 0244568dcfbf..bd90eb458a9a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topic_event_subscriptions.get_delivery_attributes( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py index 3558a998f407..fedd477ff1fa 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topic_event_subscriptions.get_full_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py index 2f84310646c4..450d8fb4144d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topic_event_subscriptions.list_by_system_topic( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_ListBySystemTopic.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_ListBySystemTopic.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py index 3855955fbbcc..7f2a97dbd459 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topic_event_subscriptions.begin_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopicEventSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py index d6390388ba34..c9029ed1a29c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topics.begin_create_or_update( @@ -38,7 +36,7 @@ def main(): system_topic_info={ "location": "westus2", "properties": { - "source": "/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e", + "source": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e", "topicType": "microsoft.storage.storageaccounts", }, "tags": {"tag1": "value1", "tag2": "value2"}, @@ -47,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopics_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py index 1c6db356c6cf..877302d1ed45 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.system_topics.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py index 01cfc1c3184a..7a73e51ab910 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topics.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopics_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py index fd78bdf9b5fd..613d6f9a68ce 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topics.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopics_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py index d14221a7df36..c160173b4f8d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topics.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopics_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py index 46a52a0af489..ff6a27bd82a8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.system_topics.begin_update( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/SystemTopics_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py index d001da8ce001..e8330515932c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topic_event_subscriptions.begin_create_or_update( @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py index ceb856922371..32f31dddf9d3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py @@ -27,16 +27,16 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.topic_event_subscriptions.begin_delete( resource_group_name="examplerg", - topic_name="exampleTopic1", - event_subscription_name="examplesubscription1", + topic_name="exampleTopic", + event_subscription_name="examplesubscription", ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py index a532fb2f820c..f8a9ad8ea734 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topic_event_subscriptions.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py index 62c33bafb4fd..bb792701d359 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topic_event_subscriptions.get_delivery_attributes( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_GetDeliveryAttributes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_GetDeliveryAttributes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py index cda769c8e53b..d0ecc99288f6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topic_event_subscriptions.get_full_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_GetFullUrl.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_GetFullUrl.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py index 0b4222575406..594e23891d9e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topic_event_subscriptions.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_List.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_List.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py index 60e2238cc81d..95d24852b78d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topic_event_subscriptions.begin_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicEventSubscriptions_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py index 8acebd8bb079..afdd0b07c4b9 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicSpaces_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py index aa3b709e2538..18580cc45de6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicSpaces_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py index 1334dbf42627..e50b89df1495 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicSpaces_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py index 497724ebc337..da909b477c86 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_ListByNamespace.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicSpaces_ListByNamespace.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py index c2e60a95b888..67c12f270ce5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicTypes_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicTypes_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py index 01fd0cbf15e1..ed1ba022d0d1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicTypes_List.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicTypes_List.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py index 8bcfb9334987..14e301ed32b4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicTypes_ListEventTypes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/TopicTypes_ListEventTypes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py index cf9135b129f2..3e6a0a0043ec 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.begin_create_or_update( @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_CreateOrUpdate.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py deleted file mode 100644 index b0bf04b3cb35..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.eventgrid import EventGridManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-eventgrid -# USAGE - python topics_create_or_update_for_azure_arc.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 = EventGridManagementClient( - credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", - ) - - response = client.topics.begin_create_or_update( - resource_group_name="examplerg", - topic_name="exampletopic1", - topic_info={ - "extendedLocation": { - "name": "/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourcegroups/examplerg/providers/Microsoft.ExtendedLocation/CustomLocations/exampleCustomLocation", - "type": "CustomLocation", - }, - "kind": "AzureArc", - "location": "westus2", - "properties": {"inputSchema": "CloudEventSchemaV1_0"}, - "tags": {"tag1": "value1", "tag2": "value2"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_CreateOrUpdateForAzureArc.json -if __name__ == "__main__": - main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py index 78a70f8a2562..e0a7a0006c61 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py @@ -27,15 +27,15 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) client.topics.begin_delete( - resource_group_name="examplerg1", - topic_name="exampletopic1", + resource_group_name="examplerg", + topic_name="exampletopic", ).result() -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_Delete.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py index 5ba6abe2555d..22cfb98f57e0 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py index b89fdee5599b..2b4ff05f9e13 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListByResourceGroup.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py index 02aa675d7c7b..cbbd3d2d69fa 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListBySubscription.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py index 07e105fa8963..7c82fe209338 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.list_event_types( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListEventTypes.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_ListEventTypes.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py index 4a58e1681bd9..935b57c2235e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py @@ -27,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.list_shared_access_keys( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListSharedAccessKeys.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_ListSharedAccessKeys.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py index d6368c4b7290..eab57f0a8bca 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.begin_regenerate_key( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_RegenerateKey.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py index b7a2acb00154..eabb43261f3f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.eventgrid import EventGridManagementClient @@ -29,7 +27,7 @@ def main(): client = EventGridManagementClient( credential=DefaultAzureCredential(), - subscription_id="8f6b6269-84f2-4d09-9e31-1127efcd1e40", + subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4", ) response = client.topics.begin_update( @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_Update.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_Update.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py index d6684c96a87f..1a26c9522d92 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/VerifiedPartners_Get.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/VerifiedPartners_Get.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py index 12110010367b..faf0415611e4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/VerifiedPartners_List.json +# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/VerifiedPartners_List.json if __name__ == "__main__": main() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py new file mode 100644 index 000000000000..b99ede8d9508 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + eventgridmanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + eventgridmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + eventgridmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + eventgridmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=eventgridmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=eventgridmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=eventgridmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=eventgridmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py new file mode 100644 index 000000000000..0f2b863d6568 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementCaCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ca_certificates_get(self, resource_group): + response = self.client.ca_certificates.get( + resource_group_name=resource_group.name, + namespace_name="str", + ca_certificate_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ca_certificates_begin_create_or_update(self, resource_group): + response = self.client.ca_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + ca_certificate_name="str", + ca_certificate_info={ + "description": "str", + "encodedCertificate": "str", + "expiryTimeInUtc": "2020-02-20 00:00:00", + "id": "str", + "issueTimeInUtc": "2020-02-20 00:00:00", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ca_certificates_begin_delete(self, resource_group): + response = self.client.ca_certificates.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + ca_certificate_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ca_certificates_list_by_namespace(self, resource_group): + response = self.client.ca_certificates.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py new file mode 100644 index 000000000000..55c27c89351b --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementCaCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ca_certificates_get(self, resource_group): + response = await self.client.ca_certificates.get( + resource_group_name=resource_group.name, + namespace_name="str", + ca_certificate_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ca_certificates_begin_create_or_update(self, resource_group): + response = await ( + await self.client.ca_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + ca_certificate_name="str", + ca_certificate_info={ + "description": "str", + "encodedCertificate": "str", + "expiryTimeInUtc": "2020-02-20 00:00:00", + "id": "str", + "issueTimeInUtc": "2020-02-20 00:00:00", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ca_certificates_begin_delete(self, resource_group): + response = await ( + await self.client.ca_certificates.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + ca_certificate_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ca_certificates_list_by_namespace(self, resource_group): + response = self.client.ca_certificates.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py new file mode 100644 index 000000000000..0633f6b38dd5 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py @@ -0,0 +1,147 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementChannelsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_channels_get(self, resource_group): + response = self.client.channels.get( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_channels_create_or_update(self, resource_group): + response = self.client.channels.create_or_update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + channel_info={ + "channelType": "str", + "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00", + "id": "str", + "messageForActivation": "str", + "name": "str", + "partnerTopicInfo": { + "azureSubscriptionId": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "name": "str", + "resourceGroupName": "str", + "source": "str", + }, + "provisioningState": "str", + "readinessState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_channels_begin_delete(self, resource_group): + response = self.client.channels.begin_delete( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_channels_update(self, resource_group): + response = self.client.channels.update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + channel_update_parameters={ + "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00", + "partnerTopicInfo": { + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + } + }, + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_channels_list_by_partner_namespace(self, resource_group): + response = self.client.channels.list_by_partner_namespace( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_channels_get_full_url(self, resource_group): + response = self.client.channels.get_full_url( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py new file mode 100644 index 000000000000..0e411f87cba9 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py @@ -0,0 +1,150 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementChannelsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_channels_get(self, resource_group): + response = await self.client.channels.get( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_channels_create_or_update(self, resource_group): + response = await self.client.channels.create_or_update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + channel_info={ + "channelType": "str", + "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00", + "id": "str", + "messageForActivation": "str", + "name": "str", + "partnerTopicInfo": { + "azureSubscriptionId": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "name": "str", + "resourceGroupName": "str", + "source": "str", + }, + "provisioningState": "str", + "readinessState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_channels_begin_delete(self, resource_group): + response = await ( + await self.client.channels.begin_delete( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_channels_update(self, resource_group): + response = await self.client.channels.update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + channel_update_parameters={ + "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00", + "partnerTopicInfo": { + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + } + }, + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_channels_list_by_partner_namespace(self, resource_group): + response = self.client.channels.list_by_partner_namespace( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_channels_get_full_url(self, resource_group): + response = await self.client.channels.get_full_url( + resource_group_name=resource_group.name, + partner_namespace_name="str", + channel_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py new file mode 100644 index 000000000000..b353f29c4fc3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementClientGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_client_groups_get(self, resource_group): + response = self.client.client_groups.get( + resource_group_name=resource_group.name, + namespace_name="str", + client_group_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_client_groups_begin_create_or_update(self, resource_group): + response = self.client.client_groups.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + client_group_name="str", + client_group_info={ + "description": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "query": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_client_groups_begin_delete(self, resource_group): + response = self.client.client_groups.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + client_group_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_client_groups_list_by_namespace(self, resource_group): + response = self.client.client_groups.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py new file mode 100644 index 000000000000..6424bc8e264f --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementClientGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_client_groups_get(self, resource_group): + response = await self.client.client_groups.get( + resource_group_name=resource_group.name, + namespace_name="str", + client_group_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_client_groups_begin_create_or_update(self, resource_group): + response = await ( + await self.client.client_groups.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + client_group_name="str", + client_group_info={ + "description": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "query": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_client_groups_begin_delete(self, resource_group): + response = await ( + await self.client.client_groups.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + client_group_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_client_groups_list_by_namespace(self, resource_group): + response = self.client.client_groups.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.py new file mode 100644 index 000000000000..979379eb28c4 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementClientsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clients_get(self, resource_group): + response = self.client.clients.get( + resource_group_name=resource_group.name, + namespace_name="str", + client_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clients_begin_create_or_update(self, resource_group): + response = self.client.clients.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + client_name="str", + client_info={ + "attributes": {"str": {}}, + "authenticationName": "str", + "clientCertificateAuthentication": {"allowedThumbprints": ["str"], "validationScheme": "str"}, + "description": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "state": "Enabled", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clients_begin_delete(self, resource_group): + response = self.client.clients.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + client_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clients_list_by_namespace(self, resource_group): + response = self.client.clients.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py new file mode 100644 index 000000000000..58b56f778551 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementClientsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_clients_get(self, resource_group): + response = await self.client.clients.get( + resource_group_name=resource_group.name, + namespace_name="str", + client_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_clients_begin_create_or_update(self, resource_group): + response = await ( + await self.client.clients.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + client_name="str", + client_info={ + "attributes": {"str": {}}, + "authenticationName": "str", + "clientCertificateAuthentication": {"allowedThumbprints": ["str"], "validationScheme": "str"}, + "description": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "state": "Enabled", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_clients_begin_delete(self, resource_group): + response = await ( + await self.client.clients.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + client_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_clients_list_by_namespace(self, resource_group): + response = self.client.clients.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py new file mode 100644 index 000000000000..def83de28d09 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.domain_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_get(self, resource_group): + response = self.client.domain_event_subscriptions.get( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.domain_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_begin_delete(self, resource_group): + response = self.client.domain_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_begin_update(self, resource_group): + response = self.client.domain_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_get_full_url(self, resource_group): + response = self.client.domain_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_event_subscriptions_list(self, resource_group): + response = self.client.domain_event_subscriptions.list( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..a9d33f24c86e --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.domain_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_get(self, resource_group): + response = await self.client.domain_event_subscriptions.get( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.domain_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.domain_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.domain_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.domain_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + domain_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_event_subscriptions_list(self, resource_group): + response = self.client.domain_event_subscriptions.list( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..7330af7ca379 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_get(self, resource_group): + response = self.client.domain_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.domain_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_begin_delete(self, resource_group): + response = self.client.domain_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_begin_update(self, resource_group): + response = self.client.domain_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_get_full_url(self, resource_group): + response = self.client.domain_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_list(self, resource_group): + response = self.client.domain_topic_event_subscriptions.list( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.domain_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..096680b1d8e6 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py @@ -0,0 +1,184 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_get(self, resource_group): + response = await self.client.domain_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.domain_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.domain_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.domain_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.domain_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_list(self, resource_group): + response = self.client.domain_topic_event_subscriptions.list( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.domain_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py new file mode 100644 index 000000000000..5a86cc1d0cd1 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainTopicsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topics_get(self, resource_group): + response = self.client.domain_topics.get( + resource_group_name=resource_group.name, + domain_name="str", + domain_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topics_begin_create_or_update(self, resource_group): + response = self.client.domain_topics.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + domain_topic_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topics_begin_delete(self, resource_group): + response = self.client.domain_topics.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + domain_topic_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domain_topics_list_by_domain(self, resource_group): + response = self.client.domain_topics.list_by_domain( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py new file mode 100644 index 000000000000..e953ad85cf30 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainTopicsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topics_get(self, resource_group): + response = await self.client.domain_topics.get( + resource_group_name=resource_group.name, + domain_name="str", + domain_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topics_begin_create_or_update(self, resource_group): + response = await ( + await self.client.domain_topics.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + domain_topic_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topics_begin_delete(self, resource_group): + response = await ( + await self.client.domain_topics.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + domain_topic_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domain_topics_list_by_domain(self, resource_group): + response = self.client.domain_topics.list_by_domain( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py new file mode 100644 index 000000000000..0d93367eb941 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py @@ -0,0 +1,199 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_get(self, resource_group): + response = self.client.domains.get( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_begin_create_or_update(self, resource_group): + response = self.client.domains.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + domain_info={ + "location": "str", + "autoCreateTopicWithFirstSubscription": True, + "autoDeleteTopicWithLastSubscription": True, + "dataResidencyBoundary": "str", + "disableLocalAuth": False, + "endpoint": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "inputSchema": "str", + "inputSchemaMapping": "input_schema_mapping", + "metricResourceId": "str", + "minimumTlsVersionAllowed": "str", + "name": "str", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_begin_delete(self, resource_group): + response = self.client.domains.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_begin_update(self, resource_group): + response = self.client.domains.begin_update( + resource_group_name=resource_group.name, + domain_name="str", + domain_update_parameters={ + "autoCreateTopicWithFirstSubscription": bool, + "autoDeleteTopicWithLastSubscription": bool, + "dataResidencyBoundary": "str", + "disableLocalAuth": bool, + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_list_by_subscription(self, resource_group): + response = self.client.domains.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_list_by_resource_group(self, resource_group): + response = self.client.domains.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_list_shared_access_keys(self, resource_group): + response = self.client.domains.list_shared_access_keys( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_domains_regenerate_key(self, resource_group): + response = self.client.domains.regenerate_key( + resource_group_name=resource_group.name, + domain_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py new file mode 100644 index 000000000000..dec6df9ab1c7 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py @@ -0,0 +1,206 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementDomainsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_get(self, resource_group): + response = await self.client.domains.get( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_begin_create_or_update(self, resource_group): + response = await ( + await self.client.domains.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + domain_info={ + "location": "str", + "autoCreateTopicWithFirstSubscription": True, + "autoDeleteTopicWithLastSubscription": True, + "dataResidencyBoundary": "str", + "disableLocalAuth": False, + "endpoint": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "inputSchema": "str", + "inputSchemaMapping": "input_schema_mapping", + "metricResourceId": "str", + "minimumTlsVersionAllowed": "str", + "name": "str", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_begin_delete(self, resource_group): + response = await ( + await self.client.domains.begin_delete( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_begin_update(self, resource_group): + response = await ( + await self.client.domains.begin_update( + resource_group_name=resource_group.name, + domain_name="str", + domain_update_parameters={ + "autoCreateTopicWithFirstSubscription": bool, + "autoDeleteTopicWithLastSubscription": bool, + "dataResidencyBoundary": "str", + "disableLocalAuth": bool, + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_list_by_subscription(self, resource_group): + response = self.client.domains.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_list_by_resource_group(self, resource_group): + response = self.client.domains.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_list_shared_access_keys(self, resource_group): + response = await self.client.domains.list_shared_access_keys( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_domains_regenerate_key(self, resource_group): + response = await self.client.domains.regenerate_key( + resource_group_name=resource_group.name, + domain_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py new file mode 100644 index 000000000000..53f175e4fff3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py @@ -0,0 +1,271 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_get(self, resource_group): + response = self.client.event_subscriptions.get( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.event_subscriptions.begin_create_or_update( + scope="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_begin_delete(self, resource_group): + response = self.client.event_subscriptions.begin_delete( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_begin_update(self, resource_group): + response = self.client.event_subscriptions.begin_update( + scope="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_get_full_url(self, resource_group): + response = self.client.event_subscriptions.get_full_url( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_global_by_subscription(self, resource_group): + response = self.client.event_subscriptions.list_global_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_global_by_subscription_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_global_by_subscription_for_topic_type( + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_global_by_resource_group(self, resource_group): + response = self.client.event_subscriptions.list_global_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_global_by_resource_group_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_global_by_resource_group_for_topic_type( + resource_group_name=resource_group.name, + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_regional_by_subscription(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_subscription( + location="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_regional_by_resource_group(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_resource_group( + resource_group_name=resource_group.name, + location="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_regional_by_subscription_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_subscription_for_topic_type( + location="str", + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_regional_by_resource_group_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_resource_group_for_topic_type( + resource_group_name=resource_group.name, + location="str", + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_by_resource(self, resource_group): + response = self.client.event_subscriptions.list_by_resource( + resource_group_name=resource_group.name, + provider_namespace="str", + resource_type_name="str", + resource_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_list_by_domain_topic(self, resource_group): + response = self.client.event_subscriptions.list_by_domain_topic( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.event_subscriptions.get_delivery_attributes( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..13f9535c4c13 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py @@ -0,0 +1,278 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_get(self, resource_group): + response = await self.client.event_subscriptions.get( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.event_subscriptions.begin_create_or_update( + scope="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.event_subscriptions.begin_delete( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.event_subscriptions.begin_update( + scope="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.event_subscriptions.get_full_url( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_global_by_subscription(self, resource_group): + response = self.client.event_subscriptions.list_global_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_global_by_subscription_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_global_by_subscription_for_topic_type( + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_global_by_resource_group(self, resource_group): + response = self.client.event_subscriptions.list_global_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_global_by_resource_group_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_global_by_resource_group_for_topic_type( + resource_group_name=resource_group.name, + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_regional_by_subscription(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_subscription( + location="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_regional_by_resource_group(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_resource_group( + resource_group_name=resource_group.name, + location="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_regional_by_subscription_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_subscription_for_topic_type( + location="str", + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_regional_by_resource_group_for_topic_type(self, resource_group): + response = self.client.event_subscriptions.list_regional_by_resource_group_for_topic_type( + resource_group_name=resource_group.name, + location="str", + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_by_resource(self, resource_group): + response = self.client.event_subscriptions.list_by_resource( + resource_group_name=resource_group.name, + provider_namespace="str", + resource_type_name="str", + resource_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_list_by_domain_topic(self, resource_group): + response = self.client.event_subscriptions.list_by_domain_topic( + resource_group_name=resource_group.name, + domain_name="str", + topic_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.event_subscriptions.get_delivery_attributes( + scope="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py new file mode 100644 index 000000000000..16a0ff5102a0 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementExtensionTopicsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_extension_topics_get(self, resource_group): + response = self.client.extension_topics.get( + scope="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py new file mode 100644 index 000000000000..532ea5e669b1 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementExtensionTopicsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_extension_topics_get(self, resource_group): + response = await self.client.extension_topics.get( + scope="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..26393d3a5cd2 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py @@ -0,0 +1,188 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementNamespaceTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_get(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deliveryConfiguration": { + "deliveryMode": "str", + "push": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventTimeToLive": "str", + "maxDeliveryCount": 0, + }, + "queue": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "eventTimeToLive": "1 day, 0:00:00", + "maxDeliveryCount": 0, + "receiveLockDurationInSeconds": 0, + }, + }, + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]}, + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_begin_delete(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_begin_update(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deliveryConfiguration": { + "deliveryMode": "str", + "push": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventTimeToLive": "str", + "maxDeliveryCount": 0, + }, + "queue": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "eventTimeToLive": "1 day, 0:00:00", + "maxDeliveryCount": 0, + "receiveLockDurationInSeconds": 0, + }, + }, + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_list_by_namespace_topic(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.list_by_namespace_topic( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topic_event_subscriptions_get_full_url(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..93c275345064 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py @@ -0,0 +1,195 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementNamespaceTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_get(self, resource_group): + response = await self.client.namespace_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.namespace_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deliveryConfiguration": { + "deliveryMode": "str", + "push": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventTimeToLive": "str", + "maxDeliveryCount": 0, + }, + "queue": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "eventTimeToLive": "1 day, 0:00:00", + "maxDeliveryCount": 0, + "receiveLockDurationInSeconds": 0, + }, + }, + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]}, + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.namespace_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.namespace_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deliveryConfiguration": { + "deliveryMode": "str", + "push": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventTimeToLive": "str", + "maxDeliveryCount": 0, + }, + "queue": { + "deadLetterDestinationWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "eventTimeToLive": "1 day, 0:00:00", + "maxDeliveryCount": 0, + "receiveLockDurationInSeconds": 0, + }, + }, + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_list_by_namespace_topic(self, resource_group): + response = self.client.namespace_topic_event_subscriptions.list_by_namespace_topic( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.namespace_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topic_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.namespace_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py new file mode 100644 index 000000000000..f380fb6593e5 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementNamespaceTopicsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_get(self, resource_group): + response = self.client.namespace_topics.get( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_begin_create_or_update(self, resource_group): + response = self.client.namespace_topics.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + namespace_topic_info={ + "eventRetentionInDays": 0, + "id": "str", + "inputSchema": "CloudEventSchemaV1_0", + "name": "str", + "provisioningState": "str", + "publisherType": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_begin_delete(self, resource_group): + response = self.client.namespace_topics.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_begin_update(self, resource_group): + response = self.client.namespace_topics.begin_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + namespace_topic_update_parameters={"eventRetentionInDays": 0}, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_list_by_namespace(self, resource_group): + response = self.client.namespace_topics.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_list_shared_access_keys(self, resource_group): + response = self.client.namespace_topics.list_shared_access_keys( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespace_topics_begin_regenerate_key(self, resource_group): + response = self.client.namespace_topics.begin_regenerate_key( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py new file mode 100644 index 000000000000..49f416341354 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py @@ -0,0 +1,137 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementNamespaceTopicsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_get(self, resource_group): + response = await self.client.namespace_topics.get( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_begin_create_or_update(self, resource_group): + response = await ( + await self.client.namespace_topics.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + namespace_topic_info={ + "eventRetentionInDays": 0, + "id": "str", + "inputSchema": "CloudEventSchemaV1_0", + "name": "str", + "provisioningState": "str", + "publisherType": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_begin_delete(self, resource_group): + response = await ( + await self.client.namespace_topics.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_begin_update(self, resource_group): + response = await ( + await self.client.namespace_topics.begin_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + namespace_topic_update_parameters={"eventRetentionInDays": 0}, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_list_by_namespace(self, resource_group): + response = self.client.namespace_topics.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_list_shared_access_keys(self, resource_group): + response = await self.client.namespace_topics.list_shared_access_keys( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespace_topics_begin_regenerate_key(self, resource_group): + response = await ( + await self.client.namespace_topics.begin_regenerate_key( + resource_group_name=resource_group.name, + namespace_name="str", + topic_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py new file mode 100644 index 000000000000..5d360a9a9d08 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py @@ -0,0 +1,247 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementNamespacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_get(self, resource_group): + response = self.client.namespaces.get( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_begin_create_or_update(self, resource_group): + response = self.client.namespaces.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + namespace_info={ + "location": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "isZoneRedundant": bool, + "minimumTlsVersionAllowed": "str", + "name": "str", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "sku": {"capacity": 0, "name": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "topicSpacesConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ], + "hostname": "str", + "maximumClientSessionsPerAuthenticationName": 0, + "maximumSessionExpiryInHours": 0, + "routeTopicResourceId": "str", + "routingEnrichments": { + "dynamic": [{"key": "str", "value": "str"}], + "static": ["static_routing_enrichment"], + }, + "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"}, + "state": "str", + }, + "topicsConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ], + "hostname": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_begin_delete(self, resource_group): + response = self.client.namespaces.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_begin_update(self, resource_group): + response = self.client.namespaces.begin_update( + resource_group_name=resource_group.name, + namespace_name="str", + namespace_update_parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "publicNetworkAccess": "str", + "sku": {"capacity": 0, "name": "str"}, + "tags": {"str": "str"}, + "topicSpacesConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ], + "maximumClientSessionsPerAuthenticationName": 0, + "maximumSessionExpiryInHours": 0, + "routeTopicResourceId": "str", + "routingEnrichments": { + "dynamic": [{"key": "str", "value": "str"}], + "static": ["static_routing_enrichment"], + }, + "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"}, + "state": "str", + }, + "topicsConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ] + }, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_list_by_subscription(self, resource_group): + response = self.client.namespaces.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_list_by_resource_group(self, resource_group): + response = self.client.namespaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_list_shared_access_keys(self, resource_group): + response = self.client.namespaces.list_shared_access_keys( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_begin_regenerate_key(self, resource_group): + response = self.client.namespaces.begin_regenerate_key( + resource_group_name=resource_group.name, + namespace_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_namespaces_begin_validate_custom_domain_ownership(self, resource_group): + response = self.client.namespaces.begin_validate_custom_domain_ownership( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py new file mode 100644 index 000000000000..216386e2933d --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py @@ -0,0 +1,258 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementNamespacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_get(self, resource_group): + response = await self.client.namespaces.get( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_begin_create_or_update(self, resource_group): + response = await ( + await self.client.namespaces.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + namespace_info={ + "location": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "isZoneRedundant": bool, + "minimumTlsVersionAllowed": "str", + "name": "str", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "sku": {"capacity": 0, "name": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "topicSpacesConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ], + "hostname": "str", + "maximumClientSessionsPerAuthenticationName": 0, + "maximumSessionExpiryInHours": 0, + "routeTopicResourceId": "str", + "routingEnrichments": { + "dynamic": [{"key": "str", "value": "str"}], + "static": ["static_routing_enrichment"], + }, + "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"}, + "state": "str", + }, + "topicsConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ], + "hostname": "str", + }, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_begin_delete(self, resource_group): + response = await ( + await self.client.namespaces.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_begin_update(self, resource_group): + response = await ( + await self.client.namespaces.begin_update( + resource_group_name=resource_group.name, + namespace_name="str", + namespace_update_parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "publicNetworkAccess": "str", + "sku": {"capacity": 0, "name": "str"}, + "tags": {"str": "str"}, + "topicSpacesConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ], + "maximumClientSessionsPerAuthenticationName": 0, + "maximumSessionExpiryInHours": 0, + "routeTopicResourceId": "str", + "routingEnrichments": { + "dynamic": [{"key": "str", "value": "str"}], + "static": ["static_routing_enrichment"], + }, + "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"}, + "state": "str", + }, + "topicsConfiguration": { + "customDomains": [ + { + "fullyQualifiedDomainName": "str", + "certificateUrl": "str", + "expectedTxtRecordName": "str", + "expectedTxtRecordValue": "str", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + "validationState": "str", + } + ] + }, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_list_by_subscription(self, resource_group): + response = self.client.namespaces.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_list_by_resource_group(self, resource_group): + response = self.client.namespaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_list_shared_access_keys(self, resource_group): + response = await self.client.namespaces.list_shared_access_keys( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_begin_regenerate_key(self, resource_group): + response = await ( + await self.client.namespaces.begin_regenerate_key( + resource_group_name=resource_group.name, + namespace_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_namespaces_begin_validate_custom_domain_ownership(self, resource_group): + response = await ( + await self.client.namespaces.begin_validate_custom_domain_ownership( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py new file mode 100644 index 000000000000..377980e891ce --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py new file mode 100644 index 000000000000..6d2bd9c22f02 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py new file mode 100644 index 000000000000..5418848e66cf --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_get(self, resource_group): + response = self.client.partner_configurations.get( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_begin_create_or_update(self, resource_group): + response = self.client.partner_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + partner_configuration_info={ + "id": "str", + "location": "str", + "name": "str", + "partnerAuthorization": { + "authorizedPartnersList": [ + { + "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00", + "partnerName": "str", + "partnerRegistrationImmutableId": "str", + } + ], + "defaultMaximumExpirationTimeInDays": 0, + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_begin_delete(self, resource_group): + response = self.client.partner_configurations.begin_delete( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_begin_update(self, resource_group): + response = self.client.partner_configurations.begin_update( + resource_group_name=resource_group.name, + partner_configuration_update_parameters={"defaultMaximumExpirationTimeInDays": 0, "tags": {"str": "str"}}, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_list_by_resource_group(self, resource_group): + response = self.client.partner_configurations.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_list_by_subscription(self, resource_group): + response = self.client.partner_configurations.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_authorize_partner(self, resource_group): + response = self.client.partner_configurations.authorize_partner( + resource_group_name=resource_group.name, + partner_info={ + "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00", + "partnerName": "str", + "partnerRegistrationImmutableId": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_configurations_unauthorize_partner(self, resource_group): + response = self.client.partner_configurations.unauthorize_partner( + resource_group_name=resource_group.name, + partner_info={ + "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00", + "partnerName": "str", + "partnerRegistrationImmutableId": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py new file mode 100644 index 000000000000..3de745b5a5ae --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py @@ -0,0 +1,153 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_get(self, resource_group): + response = await self.client.partner_configurations.get( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_begin_create_or_update(self, resource_group): + response = await ( + await self.client.partner_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + partner_configuration_info={ + "id": "str", + "location": "str", + "name": "str", + "partnerAuthorization": { + "authorizedPartnersList": [ + { + "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00", + "partnerName": "str", + "partnerRegistrationImmutableId": "str", + } + ], + "defaultMaximumExpirationTimeInDays": 0, + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_begin_delete(self, resource_group): + response = await ( + await self.client.partner_configurations.begin_delete( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_begin_update(self, resource_group): + response = await ( + await self.client.partner_configurations.begin_update( + resource_group_name=resource_group.name, + partner_configuration_update_parameters={ + "defaultMaximumExpirationTimeInDays": 0, + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_list_by_resource_group(self, resource_group): + response = self.client.partner_configurations.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_list_by_subscription(self, resource_group): + response = self.client.partner_configurations.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_authorize_partner(self, resource_group): + response = await self.client.partner_configurations.authorize_partner( + resource_group_name=resource_group.name, + partner_info={ + "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00", + "partnerName": "str", + "partnerRegistrationImmutableId": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_configurations_unauthorize_partner(self, resource_group): + response = await self.client.partner_configurations.unauthorize_partner( + resource_group_name=resource_group.name, + partner_info={ + "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00", + "partnerName": "str", + "partnerRegistrationImmutableId": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py new file mode 100644 index 000000000000..2b4901497ed2 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerNamespacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_get(self, resource_group): + response = self.client.partner_namespaces.get( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_begin_create_or_update(self, resource_group): + response = self.client.partner_namespaces.begin_create_or_update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + partner_namespace_info={ + "location": "str", + "disableLocalAuth": False, + "endpoint": "str", + "id": "str", + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "name": "str", + "partnerRegistrationFullyQualifiedId": "str", + "partnerTopicRoutingMode": "SourceEventAttribute", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_begin_delete(self, resource_group): + response = self.client.partner_namespaces.begin_delete( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_begin_update(self, resource_group): + response = self.client.partner_namespaces.begin_update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + partner_namespace_update_parameters={ + "disableLocalAuth": bool, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_list_by_subscription(self, resource_group): + response = self.client.partner_namespaces.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_list_by_resource_group(self, resource_group): + response = self.client.partner_namespaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_list_shared_access_keys(self, resource_group): + response = self.client.partner_namespaces.list_shared_access_keys( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_namespaces_regenerate_key(self, resource_group): + response = self.client.partner_namespaces.regenerate_key( + resource_group_name=resource_group.name, + partner_namespace_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py new file mode 100644 index 000000000000..4db56774ea80 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py @@ -0,0 +1,165 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerNamespacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_get(self, resource_group): + response = await self.client.partner_namespaces.get( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_begin_create_or_update(self, resource_group): + response = await ( + await self.client.partner_namespaces.begin_create_or_update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + partner_namespace_info={ + "location": "str", + "disableLocalAuth": False, + "endpoint": "str", + "id": "str", + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "name": "str", + "partnerRegistrationFullyQualifiedId": "str", + "partnerTopicRoutingMode": "SourceEventAttribute", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_begin_delete(self, resource_group): + response = await ( + await self.client.partner_namespaces.begin_delete( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_begin_update(self, resource_group): + response = await ( + await self.client.partner_namespaces.begin_update( + resource_group_name=resource_group.name, + partner_namespace_name="str", + partner_namespace_update_parameters={ + "disableLocalAuth": bool, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_list_by_subscription(self, resource_group): + response = self.client.partner_namespaces.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_list_by_resource_group(self, resource_group): + response = self.client.partner_namespaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_list_shared_access_keys(self, resource_group): + response = await self.client.partner_namespaces.list_shared_access_keys( + resource_group_name=resource_group.name, + partner_namespace_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_namespaces_regenerate_key(self, resource_group): + response = await self.client.partner_namespaces.regenerate_key( + resource_group_name=resource_group.name, + partner_namespace_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py new file mode 100644 index 000000000000..bdc1e65b0b25 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerRegistrationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_registrations_get(self, resource_group): + response = self.client.partner_registrations.get( + resource_group_name=resource_group.name, + partner_registration_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_registrations_begin_create_or_update(self, resource_group): + response = self.client.partner_registrations.begin_create_or_update( + resource_group_name=resource_group.name, + partner_registration_name="str", + partner_registration_info={ + "location": "str", + "id": "str", + "name": "str", + "partnerRegistrationImmutableId": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_registrations_begin_delete(self, resource_group): + response = self.client.partner_registrations.begin_delete( + resource_group_name=resource_group.name, + partner_registration_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_registrations_begin_update(self, resource_group): + response = self.client.partner_registrations.begin_update( + resource_group_name=resource_group.name, + partner_registration_name="str", + partner_registration_update_parameters={"tags": {"str": "str"}}, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_registrations_list_by_subscription(self, resource_group): + response = self.client.partner_registrations.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_registrations_list_by_resource_group(self, resource_group): + response = self.client.partner_registrations.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py new file mode 100644 index 000000000000..765d6046f6da --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerRegistrationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_registrations_get(self, resource_group): + response = await self.client.partner_registrations.get( + resource_group_name=resource_group.name, + partner_registration_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_registrations_begin_create_or_update(self, resource_group): + response = await ( + await self.client.partner_registrations.begin_create_or_update( + resource_group_name=resource_group.name, + partner_registration_name="str", + partner_registration_info={ + "location": "str", + "id": "str", + "name": "str", + "partnerRegistrationImmutableId": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_registrations_begin_delete(self, resource_group): + response = await ( + await self.client.partner_registrations.begin_delete( + resource_group_name=resource_group.name, + partner_registration_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_registrations_begin_update(self, resource_group): + response = await ( + await self.client.partner_registrations.begin_update( + resource_group_name=resource_group.name, + partner_registration_name="str", + partner_registration_update_parameters={"tags": {"str": "str"}}, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_registrations_list_by_subscription(self, resource_group): + response = self.client.partner_registrations.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_registrations_list_by_resource_group(self, resource_group): + response = self.client.partner_registrations.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..876e2c75dbf3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_get(self, resource_group): + response = self.client.partner_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.partner_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_begin_delete(self, resource_group): + response = self.client.partner_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_begin_update(self, resource_group): + response = self.client.partner_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_get_full_url(self, resource_group): + response = self.client.partner_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_list_by_partner_topic(self, resource_group): + response = self.client.partner_topic_event_subscriptions.list_by_partner_topic( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.partner_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..90bf07130ba3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_get(self, resource_group): + response = await self.client.partner_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.partner_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.partner_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.partner_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.partner_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_list_by_partner_topic(self, resource_group): + response = self.client.partner_topic_event_subscriptions.list_by_partner_topic( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.partner_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + partner_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py new file mode 100644 index 000000000000..c156d24a6292 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py @@ -0,0 +1,160 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerTopicsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_get(self, resource_group): + response = self.client.partner_topics.get( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_create_or_update(self, resource_group): + response = self.client.partner_topics.create_or_update( + resource_group_name=resource_group.name, + partner_topic_name="str", + partner_topic_info={ + "location": "str", + "activationState": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "messageForActivation": "str", + "name": "str", + "partnerRegistrationImmutableId": "str", + "partnerTopicFriendlyDescription": "str", + "provisioningState": "str", + "source": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_begin_delete(self, resource_group): + response = self.client.partner_topics.begin_delete( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_update(self, resource_group): + response = self.client.partner_topics.update( + resource_group_name=resource_group.name, + partner_topic_name="str", + partner_topic_update_parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_list_by_subscription(self, resource_group): + response = self.client.partner_topics.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_list_by_resource_group(self, resource_group): + response = self.client.partner_topics.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_activate(self, resource_group): + response = self.client.partner_topics.activate( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_partner_topics_deactivate(self, resource_group): + response = self.client.partner_topics.deactivate( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py new file mode 100644 index 000000000000..0c1b033df549 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py @@ -0,0 +1,163 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPartnerTopicsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_get(self, resource_group): + response = await self.client.partner_topics.get( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_create_or_update(self, resource_group): + response = await self.client.partner_topics.create_or_update( + resource_group_name=resource_group.name, + partner_topic_name="str", + partner_topic_info={ + "location": "str", + "activationState": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "messageForActivation": "str", + "name": "str", + "partnerRegistrationImmutableId": "str", + "partnerTopicFriendlyDescription": "str", + "provisioningState": "str", + "source": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_begin_delete(self, resource_group): + response = await ( + await self.client.partner_topics.begin_delete( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_update(self, resource_group): + response = await self.client.partner_topics.update( + resource_group_name=resource_group.name, + partner_topic_name="str", + partner_topic_update_parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_list_by_subscription(self, resource_group): + response = self.client.partner_topics.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_list_by_resource_group(self, resource_group): + response = self.client.partner_topics.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_activate(self, resource_group): + response = await self.client.partner_topics.activate( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_partner_topics_deactivate(self, resource_group): + response = await self.client.partner_topics.deactivate( + resource_group_name=resource_group.name, + partner_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py new file mode 100644 index 000000000000..a0bf9209473f --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPermissionBindingsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_permission_bindings_get(self, resource_group): + response = self.client.permission_bindings.get( + resource_group_name=resource_group.name, + namespace_name="str", + permission_binding_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_permission_bindings_begin_create_or_update(self, resource_group): + response = self.client.permission_bindings.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + permission_binding_name="str", + permission_binding_info={ + "clientGroupName": "str", + "description": "str", + "id": "str", + "name": "str", + "permission": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topicSpaceName": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_permission_bindings_begin_delete(self, resource_group): + response = self.client.permission_bindings.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + permission_binding_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_permission_bindings_list_by_namespace(self, resource_group): + response = self.client.permission_bindings.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py new file mode 100644 index 000000000000..62e4e0fa48e3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPermissionBindingsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_permission_bindings_get(self, resource_group): + response = await self.client.permission_bindings.get( + resource_group_name=resource_group.name, + namespace_name="str", + permission_binding_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_permission_bindings_begin_create_or_update(self, resource_group): + response = await ( + await self.client.permission_bindings.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + permission_binding_name="str", + permission_binding_info={ + "clientGroupName": "str", + "description": "str", + "id": "str", + "name": "str", + "permission": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topicSpaceName": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_permission_bindings_begin_delete(self, resource_group): + response = await ( + await self.client.permission_bindings.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + permission_binding_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_permission_bindings_list_by_namespace(self, resource_group): + response = self.client.permission_bindings.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..498b405e7887 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_endpoint_connection_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_begin_update(self, resource_group): + response = self.client.private_endpoint_connections.begin_update( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_begin_delete(self, resource_group): + response = self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_endpoint_connection_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list_by_resource(self, resource_group): + response = self.client.private_endpoint_connections.list_by_resource( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..7d0df36a0279 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py @@ -0,0 +1,92 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_endpoint_connection_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_begin_update(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_update( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_begin_delete(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_endpoint_connection_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list_by_resource(self, resource_group): + response = self.client.private_endpoint_connections.list_by_resource( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py new file mode 100644 index 000000000000..10872f9b024a --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_get(self, resource_group): + response = self.client.private_link_resources.get( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_link_resource_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_list_by_resource(self, resource_group): + response = self.client.private_link_resources.list_by_resource( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py new file mode 100644 index 000000000000..488b0b19f444 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_get(self, resource_group): + response = await self.client.private_link_resources.get( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + private_link_resource_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_list_by_resource(self, resource_group): + response = self.client.private_link_resources.list_by_resource( + resource_group_name=resource_group.name, + parent_type="str", + parent_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..e21aede3044d --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementSystemTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_get(self, resource_group): + response = self.client.system_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.system_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_begin_delete(self, resource_group): + response = self.client.system_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_begin_update(self, resource_group): + response = self.client.system_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_get_full_url(self, resource_group): + response = self.client.system_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_list_by_system_topic(self, resource_group): + response = self.client.system_topic_event_subscriptions.list_by_system_topic( + resource_group_name=resource_group.name, + system_topic_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.system_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..920bf713a8a9 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementSystemTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_get(self, resource_group): + response = await self.client.system_topic_event_subscriptions.get( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.system_topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.system_topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.system_topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.system_topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_list_by_system_topic(self, resource_group): + response = self.client.system_topic_event_subscriptions.list_by_system_topic( + resource_group_name=resource_group.name, + system_topic_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.system_topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + system_topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py new file mode 100644 index 000000000000..c4b6649467e7 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementSystemTopicsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topics_get(self, resource_group): + response = self.client.system_topics.get( + resource_group_name=resource_group.name, + system_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topics_begin_create_or_update(self, resource_group): + response = self.client.system_topics.begin_create_or_update( + resource_group_name=resource_group.name, + system_topic_name="str", + system_topic_info={ + "location": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "metricResourceId": "str", + "name": "str", + "provisioningState": "str", + "source": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "topicType": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topics_begin_delete(self, resource_group): + response = self.client.system_topics.begin_delete( + resource_group_name=resource_group.name, + system_topic_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topics_begin_update(self, resource_group): + response = self.client.system_topics.begin_update( + resource_group_name=resource_group.name, + system_topic_name="str", + system_topic_update_parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topics_list_by_subscription(self, resource_group): + response = self.client.system_topics.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_system_topics_list_by_resource_group(self, resource_group): + response = self.client.system_topics.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py new file mode 100644 index 000000000000..14279aedb61f --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementSystemTopicsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topics_get(self, resource_group): + response = await self.client.system_topics.get( + resource_group_name=resource_group.name, + system_topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topics_begin_create_or_update(self, resource_group): + response = await ( + await self.client.system_topics.begin_create_or_update( + resource_group_name=resource_group.name, + system_topic_name="str", + system_topic_info={ + "location": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "metricResourceId": "str", + "name": "str", + "provisioningState": "str", + "source": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "topicType": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topics_begin_delete(self, resource_group): + response = await ( + await self.client.system_topics.begin_delete( + resource_group_name=resource_group.name, + system_topic_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topics_begin_update(self, resource_group): + response = await ( + await self.client.system_topics.begin_update( + resource_group_name=resource_group.name, + system_topic_name="str", + system_topic_update_parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topics_list_by_subscription(self, resource_group): + response = self.client.system_topics.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_system_topics_list_by_resource_group(self, resource_group): + response = self.client.system_topics.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..67c473c736b1 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = self.client.topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_get(self, resource_group): + response = self.client.topic_event_subscriptions.get( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = self.client.topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_begin_delete(self, resource_group): + response = self.client.topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_begin_update(self, resource_group): + response = self.client.topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_get_full_url(self, resource_group): + response = self.client.topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_event_subscriptions_list(self, resource_group): + response = self.client.topic_event_subscriptions.list( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py new file mode 100644 index 000000000000..5900d9777349 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_get_delivery_attributes(self, resource_group): + response = await self.client.topic_event_subscriptions.get_delivery_attributes( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_get(self, resource_group): + response = await self.client.topic_event_subscriptions.get( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_begin_create_or_update(self, resource_group): + response = await ( + await self.client.topic_event_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + event_subscription_info={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "id": "str", + "labels": ["str"], + "name": "str", + "provisioningState": "str", + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_begin_delete(self, resource_group): + response = await ( + await self.client.topic_event_subscriptions.begin_delete( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_begin_update(self, resource_group): + response = await ( + await self.client.topic_event_subscriptions.begin_update( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + event_subscription_update_parameters={ + "deadLetterDestination": "dead_letter_destination", + "deadLetterWithResourceIdentity": { + "deadLetterDestination": "dead_letter_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "deliveryWithResourceIdentity": { + "destination": "event_subscription_destination", + "identity": {"type": "str", "userAssignedIdentity": "str"}, + }, + "destination": "event_subscription_destination", + "eventDeliverySchema": "str", + "expirationTimeUtc": "2020-02-20 00:00:00", + "filter": { + "advancedFilters": ["advanced_filter"], + "enableAdvancedFilteringOnArrays": bool, + "includedEventTypes": ["str"], + "isSubjectCaseSensitive": False, + "subjectBeginsWith": "str", + "subjectEndsWith": "str", + }, + "labels": ["str"], + "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_get_full_url(self, resource_group): + response = await self.client.topic_event_subscriptions.get_full_url( + resource_group_name=resource_group.name, + topic_name="str", + event_subscription_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_event_subscriptions_list(self, resource_group): + response = self.client.topic_event_subscriptions.list( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py new file mode 100644 index 000000000000..e595f7f0ba06 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicSpacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_spaces_get(self, resource_group): + response = self.client.topic_spaces.get( + resource_group_name=resource_group.name, + namespace_name="str", + topic_space_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_spaces_begin_create_or_update(self, resource_group): + response = self.client.topic_spaces.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_space_name="str", + topic_space_info={ + "description": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topicTemplates": ["str"], + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_spaces_begin_delete(self, resource_group): + response = self.client.topic_spaces.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + topic_space_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_spaces_list_by_namespace(self, resource_group): + response = self.client.topic_spaces.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py new file mode 100644 index 000000000000..693257aa77d3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicSpacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_spaces_get(self, resource_group): + response = await self.client.topic_spaces.get( + resource_group_name=resource_group.name, + namespace_name="str", + topic_space_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_spaces_begin_create_or_update(self, resource_group): + response = await ( + await self.client.topic_spaces.begin_create_or_update( + resource_group_name=resource_group.name, + namespace_name="str", + topic_space_name="str", + topic_space_info={ + "description": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topicTemplates": ["str"], + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_spaces_begin_delete(self, resource_group): + response = await ( + await self.client.topic_spaces.begin_delete( + resource_group_name=resource_group.name, + namespace_name="str", + topic_space_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_spaces_list_by_namespace(self, resource_group): + response = self.client.topic_spaces.list_by_namespace( + resource_group_name=resource_group.name, + namespace_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py new file mode 100644 index 000000000000..ac06fdf34ba0 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicTypesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_types_list(self, resource_group): + response = self.client.topic_types.list( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_types_get(self, resource_group): + response = self.client.topic_types.get( + topic_type_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topic_types_list_event_types(self, resource_group): + response = self.client.topic_types.list_event_types( + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.py new file mode 100644 index 000000000000..b3add0f7ef98 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicTypesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_types_list(self, resource_group): + response = self.client.topic_types.list( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_types_get(self, resource_group): + response = await self.client.topic_types.get( + topic_type_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topic_types_list_event_types(self, resource_group): + response = self.client.topic_types.list_event_types( + topic_type_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py new file mode 100644 index 000000000000..05b9ea56ea49 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py @@ -0,0 +1,209 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_get(self, resource_group): + response = self.client.topics.get( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_begin_create_or_update(self, resource_group): + response = self.client.topics.begin_create_or_update( + resource_group_name=resource_group.name, + topic_name="str", + topic_info={ + "location": "str", + "dataResidencyBoundary": "str", + "disableLocalAuth": False, + "endpoint": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "inputSchema": "str", + "inputSchemaMapping": "input_schema_mapping", + "metricResourceId": "str", + "minimumTlsVersionAllowed": "str", + "name": "str", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_begin_delete(self, resource_group): + response = self.client.topics.begin_delete( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_begin_update(self, resource_group): + response = self.client.topics.begin_update( + resource_group_name=resource_group.name, + topic_name="str", + topic_update_parameters={ + "dataResidencyBoundary": "str", + "disableLocalAuth": bool, + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_list_by_subscription(self, resource_group): + response = self.client.topics.list_by_subscription( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_list_by_resource_group(self, resource_group): + response = self.client.topics.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_list_shared_access_keys(self, resource_group): + response = self.client.topics.list_shared_access_keys( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_begin_regenerate_key(self, resource_group): + response = self.client.topics.begin_regenerate_key( + resource_group_name=resource_group.name, + topic_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_topics_list_event_types(self, resource_group): + response = self.client.topics.list_event_types( + resource_group_name=resource_group.name, + provider_namespace="str", + resource_type_name="str", + resource_name="str", + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py new file mode 100644 index 000000000000..c9779155050e --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py @@ -0,0 +1,218 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementTopicsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_get(self, resource_group): + response = await self.client.topics.get( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_begin_create_or_update(self, resource_group): + response = await ( + await self.client.topics.begin_create_or_update( + resource_group_name=resource_group.name, + topic_name="str", + topic_info={ + "location": "str", + "dataResidencyBoundary": "str", + "disableLocalAuth": False, + "endpoint": "str", + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "inputSchema": "str", + "inputSchemaMapping": "input_schema_mapping", + "metricResourceId": "str", + "minimumTlsVersionAllowed": "str", + "name": "str", + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_begin_delete(self, resource_group): + response = await ( + await self.client.topics.begin_delete( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_begin_update(self, resource_group): + response = await ( + await self.client.topics.begin_update( + resource_group_name=resource_group.name, + topic_name="str", + topic_update_parameters={ + "dataResidencyBoundary": "str", + "disableLocalAuth": bool, + "eventTypeInfo": { + "inlineEventTypes": { + "str": { + "dataSchemaUrl": "str", + "description": "str", + "displayName": "str", + "documentationUrl": "str", + } + }, + "kind": "str", + }, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inboundIpRules": [{"action": "str", "ipMask": "str"}], + "minimumTlsVersionAllowed": "str", + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_list_by_subscription(self, resource_group): + response = self.client.topics.list_by_subscription( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_list_by_resource_group(self, resource_group): + response = self.client.topics.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_list_shared_access_keys(self, resource_group): + response = await self.client.topics.list_shared_access_keys( + resource_group_name=resource_group.name, + topic_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_begin_regenerate_key(self, resource_group): + response = await ( + await self.client.topics.begin_regenerate_key( + resource_group_name=resource_group.name, + topic_name="str", + regenerate_key_request={"keyName": "str"}, + api_version="2025-02-15", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_topics_list_event_types(self, resource_group): + response = self.client.topics.list_event_types( + resource_group_name=resource_group.name, + provider_namespace="str", + resource_type_name="str", + resource_name="str", + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.py new file mode 100644 index 000000000000..761f7d20da62 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementVerifiedPartnersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_verified_partners_get(self, resource_group): + response = self.client.verified_partners.get( + verified_partner_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_verified_partners_list(self, resource_group): + response = self.client.verified_partners.list( + api_version="2025-02-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.py new file mode 100644 index 000000000000..e12118487077 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.eventgrid.aio import EventGridManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEventGridManagementVerifiedPartnersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_verified_partners_get(self, resource_group): + response = await self.client.verified_partners.get( + verified_partner_name="str", + api_version="2025-02-15", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_verified_partners_list(self, resource_group): + response = self.client.verified_partners.list( + api_version="2025-02-15", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py index 882225833cb5..194f115204c2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ],